Skip to content

Commit

Permalink
mn2sts.xsl updated key table id, #246
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Jan 10, 2023
1 parent e9eb268 commit 4ed58b2
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main/resources/mn2sts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,10 @@

<xsl:if test="$metanorma_type = 'ISO'">
<xsl:attribute name="id_new">
<xsl:text>tab_</xsl:text>
<xsl:number level="any" format="a" count="array"/>
<xsl:if test="not(contains(@content-type , '-index'))"> <!-- no need id for formula-index and figure-index tables -->
<xsl:text>tab_</xsl:text>
<xsl:number level="any" format="a" count="array"/>
</xsl:if>
</xsl:attribute>
</xsl:if>

Expand Down Expand Up @@ -851,8 +853,17 @@

<xsl:template match="*[@id_new]" mode="id_replace" priority="2">
<xsl:copy>
<xsl:apply-templates select="@*[not(local-name() = 'id_new')]" mode="id_replace"/>
<xsl:attribute name="id"><xsl:value-of select="@id_new"/></xsl:attribute>
<xsl:choose>
<xsl:when test="normalize-space(@id_new) != ''">
<xsl:apply-templates select="@*[not(local-name() = 'id_new')]" mode="id_replace"/>
<xsl:attribute name="id"><xsl:value-of select="@id_new"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<!-- no need create id for 'Key' tables for figures, formulas -->
<xsl:apply-templates select="@*[not(local-name() = 'id_new' or local-name() = 'id')]" mode="id_replace"/>
</xsl:otherwise>
</xsl:choose>

<xsl:apply-templates select="node()" mode="id_replace" />
</xsl:copy>
</xsl:template>
Expand Down

0 comments on commit 4ed58b2

Please sign in to comment.