Skip to content

Commit

Permalink
Merge pull request #112 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 29, 2024
2 parents 3e725a4 + 5c92f21 commit 38a99b6
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion lib/isodoc/plateau/plateau.international-standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5026,6 +5026,7 @@

<fo:block role="SKIP">
<xsl:apply-templates/>
<xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
</fo:block>
</fo:table-cell>
</xsl:template> <!-- cell in table header row - 'th' -->
Expand Down Expand Up @@ -5089,6 +5090,8 @@

<xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->

<xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>

</fo:block>
</fo:table-cell>
</xsl:template> <!-- td -->
Expand Down Expand Up @@ -7933,6 +7936,9 @@
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
<xsl:if test="$isLinkToEmbeddedFile = 'true'">
<xsl:attribute name="role">Annot</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="normalize-space(.) = ''">
<xsl:call-template name="add-zero-spaces-link-java">
Expand Down Expand Up @@ -13628,6 +13634,12 @@
<!-- Get or calculate depth of the element -->
<xsl:template name="getLevel">
<xsl:param name="depth"/>
<!-- <xsl:message>
<xsl:choose>
<xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
<xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
</xsl:choose>
</xsl:message> -->
<xsl:choose>
<xsl:when test="normalize-space(@depth) != ''">
<xsl:value-of select="@depth"/>
Expand All @@ -13648,15 +13660,45 @@
<xsl:when test="ancestor::*[local-name() = 'preface']">
<xsl:value-of select="$level_total - 2"/>
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
<xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
<xsl:choose>
<xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
<xsl:value-of select="number($upper_clause_depth + 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level_total - 2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'sections']">
<xsl:value-of select="$level_total - 1"/>
<xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
<xsl:choose>
<xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
<xsl:value-of select="number($upper_clause_depth + 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level_total - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'bibliography']">
<xsl:value-of select="$level_total - 1"/>
</xsl:when>
<xsl:when test="parent::*[local-name() = 'annex']">
<xsl:value-of select="$level_total - 1"/>
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
<xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
<xsl:choose>
<xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
<xsl:value-of select="number($upper_clause_depth + 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level_total - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'annex']">
<xsl:value-of select="$level_total"/>
</xsl:when>
Expand Down Expand Up @@ -14314,4 +14356,18 @@
</xsl:if>
</xsl:template>

<xsl:template match="@*|node()" mode="set_table_role_skip">
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
</xsl:copy>
</xsl:template>

<xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
<xsl:copy>
<xsl:apply-templates select="@*" mode="set_table_role_skip"/>
<xsl:attribute name="role">SKIP</xsl:attribute>
<xsl:apply-templates select="node()" mode="set_table_role_skip"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 38a99b6

Please sign in to comment.