Skip to content

Commit f005e03

Browse files
committed
Add id attrib in <deliverable>
1 parent 0e2f8ae commit f005e03

1 file changed

Lines changed: 51 additions & 5 deletions

File tree

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

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<product id="appliance" series="pas" family="linux" rank="04150" idabbrev="app"/>
7777
<product id="cloudnative" series="pas" family="cn" rank="00030" idabbrev="cn" />
7878
<product id="container" series="pas" family="linux" rank="04130" idabbrev="cont" />
79-
<product id="compliance" series="pas" family="linux" rank="" idabbrev="comp" />
79+
<product id="compliance" series="pas" family="linux" rank="04130" idabbrev="comp" />
8080
<product id="liberty" series="pas" family="linux" rank="00060" idabbrev="lib" />
8181
<product id="releasenotes" series="rn" family="linux" idabbrev="rn"/>
8282
<product id="sbp" series="sbp" family="linux" />
@@ -485,14 +485,17 @@
485485

486486
<xsl:template name="docset-without-builddocs">
487487
<resources>
488-
<xsl:apply-templates select="external[link[not(starts-with(language/url/@href, 'https://'))]]" mode="builddocs" />
488+
<git remote="https://TODO" />
489+
<xsl:apply-templates select="external[link[not(starts-with(language/url/@href, 'https://'))]]"
490+
mode="builddocs" />
489491
</resources>
490492
</xsl:template>
491493

492494

493495
<xsl:template match="docset/external" mode="builddocs">
494496
<locale lang="en-us">
495-
<xsl:apply-templates select="link[not(starts-with(language/url/@href, 'https://'))]" mode="builddocs" />
497+
<branch>main</branch>
498+
<xsl:apply-templates select="link[not(starts-with(language/url/@href, 'https://'))]" mode="builddocs" />
496499
</locale>
497500
<xsl:if test="link[not(starts-with(language/url/@href, 'https://')) and @lang != 'en-us']">
498501
<xsl:message>TODO: Found non-English links in docset/external</xsl:message>
@@ -525,20 +528,63 @@
525528
</xsl:template>
526529

527530
<xsl:template match="link" mode="builddocs">
528-
<deliverable type="prebuilt" category="{@category}">
531+
<xsl:variable name="href" select="language[@lang='en-us']/url/@href"/>
532+
<!-- Extract product ID from URL like /product/docset/... -->
533+
<xsl:variable name="pid" select="substring-before(substring-after($href, '/'), '/')"/>
534+
535+
<xsl:variable name="abbrev" select="$config/product[@id=$pid]/@idabbrev"/>
536+
537+
<xsl:variable name="product.idabbrev">
538+
<xsl:choose>
539+
<xsl:when test="string($abbrev) != ''">
540+
<xsl:value-of select="$abbrev"/>
541+
</xsl:when>
542+
<xsl:otherwise>
543+
<xsl:value-of select="$pid"/>
544+
</xsl:otherwise>
545+
</xsl:choose>
546+
</xsl:variable>
547+
548+
<xsl:variable name="filename">
549+
<xsl:call-template name="substring-after-last">
550+
<xsl:with-param name="string" select="$href"/>
551+
<xsl:with-param name="char" select="'/'"/>
552+
</xsl:call-template>
553+
</xsl:variable>
554+
555+
<xsl:variable name="doc">
556+
<xsl:choose>
557+
<xsl:when test="contains($filename, '.')">
558+
<xsl:value-of select="substring-before($filename, '.')"/>
559+
</xsl:when>
560+
<xsl:otherwise>
561+
<xsl:value-of select="$filename"/>
562+
</xsl:otherwise>
563+
</xsl:choose>
564+
</xsl:variable>
565+
566+
<xsl:variable name="id">
567+
<xsl:call-template name="generate.id">
568+
<xsl:with-param name="product.idabbrev" select="$product.idabbrev"/>
569+
<xsl:with-param name="docset" select="ancestor::docset/@setid"/>
570+
<xsl:with-param name="dc" select="$doc"/>
571+
</xsl:call-template>
572+
</xsl:variable>
573+
574+
<deliverable id="{$id}" type="prebuilt" category="{@category}">
529575
<xsl:apply-templates mode="builddocs" />
530576
</deliverable>
531577
</xsl:template>
532578

533579
<xsl:template match="docset/external/link/language" mode="builddocs">
534580
<prebuilt>
535581
<title><xsl:value-of select="normalize-space(@title)"/></title>
582+
<xsl:copy-of select="url"/>
536583
<descriptions>
537584
<desc lang="en-us">
538585
<p><xsl:comment>TODO</xsl:comment></p>
539586
</desc>
540587
</descriptions>
541-
<xsl:copy-of select="url"/>
542588
</prebuilt>
543589
</xsl:template>
544590

0 commit comments

Comments
 (0)