Skip to content

Commit f0912c0

Browse files
committed
Transform a docset without builddocs (externals)
* Preserve the formatting * Create resources/locale/deliverables when there is no builddocs
1 parent 157a6d0 commit f0912c0

1 file changed

Lines changed: 46 additions & 3 deletions

File tree

src/docbuild/config/xml/data/convert-v6-to-v7.xsl

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
extension-element-prefixes="exsl">
3535

3636
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
37-
<xsl:preserve-space elements="*"/>
38-
<xsl:strip-space elements="product"/>
37+
<xsl:strip-space elements="*"/>
38+
<xsl:preserve-space elements="p div pre h1 h2 h3 h4 h5 h6 li dt dd span em strong code q s u sub sup cite a br hr title subtitle desc"/>
3939

4040
<!-- ======== Parameters -->
4141
<xsl:param name="use.xincludes" select="true()" />
@@ -433,7 +433,15 @@
433433

434434
<xsl:variable name="content">
435435
<docset xmlns:xi="http://www.w3.org/2001/XInclude">
436-
<xsl:apply-templates select="@*|node()" />
436+
<xsl:choose>
437+
<xsl:when test="builddocs">
438+
<xsl:apply-templates select="@*|node()" />
439+
</xsl:when>
440+
<xsl:otherwise>
441+
<xsl:apply-templates select="@*|node()[not(self::external)]" />
442+
<xsl:call-template name="docset-without-builddocs" ></xsl:call-template>
443+
</xsl:otherwise>
444+
</xsl:choose>
437445
</docset>
438446
</xsl:variable>
439447

@@ -466,6 +474,41 @@
466474
</resources>
467475
</xsl:template>
468476

477+
<xsl:template name="docset-without-builddocs">
478+
<resources>
479+
<xsl:apply-templates select="external" mode="builddocs" />
480+
</resources>
481+
</xsl:template>
482+
483+
484+
<xsl:template match="docset/external" mode="builddocs">
485+
<locale lang="en-us">
486+
<xsl:apply-templates select="link" mode="builddocs" />
487+
</locale>
488+
<xsl:if test="link[@lang != 'en-us']">
489+
<xsl:message>TODO: Found non-English links in docset/external</xsl:message>
490+
</xsl:if>
491+
</xsl:template>
492+
493+
<xsl:template match="link" mode="builddocs">
494+
<deliverable type="prebuilt" category="{@category}">
495+
<xsl:apply-templates mode="builddocs" />
496+
</deliverable>
497+
</xsl:template>
498+
499+
<xsl:template match="docset/external/link/language" mode="builddocs">
500+
<prebuilt>
501+
<title><xsl:value-of select="normalize-space(@title)"/></title>
502+
<descriptions>
503+
<desc lang="en-us">
504+
<p><xsl:comment>TODO</xsl:comment></p>
505+
</desc>
506+
</descriptions>
507+
<xsl:copy-of select="url"/>
508+
</prebuilt>
509+
</xsl:template>
510+
511+
469512
<!-- builddocs -->
470513
<xsl:template match="builddocs/language">
471514
<locale lang="{@lang}">

0 commit comments

Comments
 (0)