Skip to content
This repository has been archived by the owner on Jul 4, 2021. It is now read-only.

Commit

Permalink
xslt updated for for metanorma/mn-samples-bsi#2, title and label proc…
Browse files Browse the repository at this point in the history
…essing updated
  • Loading branch information
Intelligent2013 committed May 23, 2021
1 parent 9025636 commit 85a7933
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/main/resources/mn2sts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
<xsl:when test="local-name() = 'term' and normalize-space(*[local-name() = 'name']) != '' and normalize-space(translate(*[local-name() = 'name'], '0123456789.', '')) = ''">
<xsl:value-of select="*[local-name() = 'name']"/>
</xsl:when>
<xsl:when test="*[local-name() = 'title'] and not(*[local-name() = 'title']/*[local-name() = 'tab']) and normalize-space(translate(*[local-name() = 'title'], '0123456789.', '')) = ''">
<xsl:value-of select="*[local-name() = 'title']"/>
</xsl:when>
<xsl:when test="local-name() = 'figure' and contains(*[local-name() = 'name'], '&#8212; ')">
<xsl:variable name="figure_name" select="substring-before(*[local-name() = 'name'], '&#8212; ')"/>
<xsl:value-of select="translate(normalize-space(translate($figure_name, '&#xa0;', ' ')), ' ', '&#xa0;')"/>
Expand Down Expand Up @@ -2056,16 +2059,21 @@
</xsl:template>

<xsl:template match="*[local-name() = 'title']">
<title>
<xsl:choose>
<xsl:when test="*[local-name() = 'tab']">
<xsl:apply-templates select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</title>
<xsl:choose>
<xsl:when test="not(*[local-name() = 'tab']) and normalize-space(translate(., '0123456789.', '')) = ''"><!-- put number in label, see above --></xsl:when>
<xsl:otherwise>
<title>
<xsl:choose>
<xsl:when test="*[local-name() = 'tab']">
<xsl:apply-templates select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</title>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="*[local-name() = 'title']/@depth"/>
Expand Down

0 comments on commit 85a7933

Please sign in to comment.