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

Commit

Permalink
index and annex obligation processing fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed May 25, 2021
1 parent 9eb9469 commit da4cb45
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions src/main/resources/mn2sts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
</app-group>
</xsl:if>
<xsl:apply-templates select="*[local-name() = 'bibliography']/*[local-name() = 'references'][not(@normative='true')]" mode="back"/>
<xsl:apply-templates select="*[local-name() = 'indexsect']"/>
</back>
</xsl:if>
<xsl:if test="$debug = 'true'">
Expand Down Expand Up @@ -864,8 +865,9 @@
<app id="{$id}" content-type="inform-annex">
<xsl:attribute name="content-type">
<xsl:choose>
<xsl:when test="@obligation = 'informative'">inform-annex</xsl:when>
<xsl:otherwise><xsl:value-of select="@obligation"/></xsl:otherwise>
<xsl:when test="@obligation = 'informative'">inform-annex</xsl:when>
<xsl:when test="normalize-space(@obligation) != ''"><xsl:value-of select="@obligation"/></xsl:when>
<!-- <xsl:otherwise></xsl:otherwise> -->
</xsl:choose>
</xsl:attribute>
<label>
Expand All @@ -878,7 +880,9 @@
</xsl:otherwise>
</xsl:choose>
</label>
<annex-type>(<xsl:value-of select="@obligation"/>)</annex-type>
<xsl:if test="normalize-space(@obligation) != ''">
<annex-type>(<xsl:value-of select="@obligation"/>)</annex-type>
</xsl:if>
<xsl:apply-templates />
</app>
</xsl:template>
Expand Down Expand Up @@ -924,10 +928,10 @@
<xsl:variable name="count_non_normative_references" select="count(//*[local-name() = 'references'][not(@normative='true')])"/>

<xsl:template match="*[local-name() = 'bibitem']" name="bibitem">
<xsl:variable name="current_id">
<!-- <xsl:variable name="current_id">
<xsl:call-template name="getId"/>
</xsl:variable>
<!-- <xsl:variable name="id" select="$elements//element[@source_id = $current_id]/@id"/> -->
<xsl:variable name="id" select="$elements//element[@source_id = $current_id]/@id"/> -->
<xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>
<ref>
<xsl:if test="normalize-space(@type) != ''">
Expand All @@ -936,15 +940,16 @@
</xsl:attribute>
</xsl:if>

<xsl:attribute name="id"><xsl:value-of select="$id"/>
<!-- <xsl:attribute name="id"><xsl:value-of select="$id"/>
<xsl:if test="$count_non_normative_references &gt; 1">
<xsl:number format="_1" count="*[local-name() = 'references'][not(@normative='true')]"/>
</xsl:if>
</xsl:attribute>
</xsl:attribute> -->
<xsl:copy-of select="@id"/>

<xsl:apply-templates select="*[local-name() = 'docidentifier'][@type = 'metanorma']" mode="docidentifier_metanorma"/>
<xsl:if test="not(*[local-name() = 'docidentifier'][@type='metanorma'])">
<label><xsl:number format="[1]"/></label> <!-- see docidentifier @type="metanorma" -->
<!-- <label><xsl:number format="[1]"/></label> --> <!-- see docidentifier @type="metanorma" -->
</xsl:if>

<xsl:choose>
Expand Down Expand Up @@ -1106,7 +1111,7 @@
<xsl:when test="@type='scope'">scope</xsl:when>
<xsl:when test="@type='intro'">intro</xsl:when>
<xsl:when test="@normative='true'">norm-refs</xsl:when>
<xsl:when test="@id = 'tda' or @id = 'terms' or local-name() = 'terms'">terms</xsl:when>
<xsl:when test="@id = 'tda' or @id = 'terms' or local-name() = 'terms' or (contains(*[local-name() = 'title'][1], 'Terms') and not(ancestor::*[local-name() = 'clause']))">terms</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'foreword']"><xsl:value-of select="@type"/></xsl:when>
<xsl:otherwise><!-- <xsl:value-of select="@id"/> --></xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -1629,7 +1634,12 @@

<xsl:template match="*[local-name() = 'xref'][normalize-space() != '' and string-length(normalize-space()) = string-length(translate(normalize-space(), '0123456789', '')) and not(contains(normalize-space(), 'Annex'))]" priority="2">
<named-content>
<xsl:attribute name="content-type">term</xsl:attribute>
<xsl:attribute name="content-type">
<xsl:choose>
<xsl:when test="starts-with(@target, 'abbrev')">abbrev</xsl:when>
<xsl:otherwise>term</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="xlink:href">#<xsl:value-of select="@target"/></xsl:attribute>
<xsl:apply-templates />
</named-content>
Expand Down Expand Up @@ -2177,6 +2187,13 @@
<xsl:value-of disable-output-escaping="yes" select="substring-after(., 'STS: ')"/>
</xsl:template>

<xsl:template match="*[local-name() = 'indexsect']">
<sec sec-type="index">
<xsl:copy-of select="@id"/>
<xsl:apply-templates/>
</sec>
</xsl:template>

<xsl:template name="getLevel">
<xsl:variable name="level_total" select="count(ancestor::*)"/>
<xsl:variable name="level">
Expand Down

0 comments on commit da4cb45

Please sign in to comment.