Skip to content

Commit

Permalink
Merge pull request #168 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jun 14, 2023
2 parents 9026637 + fa5bc75 commit fc7247e
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 70 deletions.
100 changes: 65 additions & 35 deletions lib/isodoc/m3aawg/m3aawg.policy.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2173,12 +2173,12 @@
<xsl:apply-templates select="." mode="contents"/>
</xsl:for-each>

<xsl:for-each select="/*/*[local-name()='annex']">
<!-- <xsl:for-each select="/*/*[local-name()='annex']">
<xsl:sort select="@displayorder" data-type="number"/>
<xsl:apply-templates select="." mode="contents"/>
</xsl:for-each>
</xsl:for-each> -->

<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]">
<xsl:for-each select="/*/*[local-name()='annex'] | /*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]">
<xsl:sort select="@displayorder" data-type="number"/>
<xsl:apply-templates select="." mode="contents"/>
</xsl:for-each>
Expand Down Expand Up @@ -2639,7 +2639,7 @@
<fo:table-row>
<fo:table-cell column-number="2">
<xsl:copy-of select="$table-preamble"/>
<fo:block>
<fo:block role="SKIP">
<xsl:call-template name="setTrackChangesStyles">
<xsl:with-param name="isAdded" select="$isAdded"/>
<xsl:with-param name="isDeleted" select="$isDeleted"/>
Expand Down Expand Up @@ -2682,7 +2682,7 @@
<xsl:param name="continued"/>
<xsl:if test="normalize-space() != ''">

<fo:block xsl:use-attribute-sets="table-name-style">
<fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">

<xsl:call-template name="refine_table-name-style">
<xsl:with-param name="continued" select="$continued"/>
Expand Down Expand Up @@ -3067,8 +3067,8 @@
<xsl:template name="table-header-title">
<xsl:param name="cols-count"/>
<!-- row for title -->
<fo:table-row>
<fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
<fo:table-row role="SKIP">
<fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black" role="SKIP">

<xsl:call-template name="refine_table-header-title-style"/>

Expand All @@ -3077,7 +3077,7 @@
</xsl:apply-templates>

<xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
<fo:block/>
<fo:block role="SKIP"/>
</xsl:if>

</fo:table-cell>
Expand Down Expand Up @@ -3388,7 +3388,7 @@

<xsl:call-template name="refine_table-header-cell-style"/>

<fo:block>
<fo:block role="SKIP">
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
Expand Down Expand Up @@ -3441,7 +3441,7 @@
<xsl:attribute name="text-align">left</xsl:attribute>
</xsl:if>

<fo:block>
<fo:block role="SKIP">

<xsl:if test="$isGenerateTableIF = 'true'">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
Expand Down Expand Up @@ -4304,7 +4304,7 @@
-->
<fo:table-row>
<fo:table-cell number-columns-spanned="2">
<fo:block>
<fo:block role="SKIP">
<xsl:call-template name="note"/>
</fo:block>
</fo:table-cell>
Expand Down Expand Up @@ -4369,7 +4369,7 @@

<xsl:call-template name="refine_dt-cell-style"/>

<fo:block xsl:use-attribute-sets="dt-block-style">
<fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
<xsl:copy-of select="@id"/>

<xsl:if test="normalize-space($key_iso) = 'true'">
Expand Down Expand Up @@ -4399,7 +4399,7 @@

<xsl:call-template name="refine_dd-cell-style"/>

<fo:block>
<fo:block role="SKIP">

<xsl:if test="$isGenerateTableIF = 'true'">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
Expand Down Expand Up @@ -4777,11 +4777,41 @@

<xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
<xsl:variable name="text" select="normalize-space(.)"/>
<fo:inline font-size="75%">
<fo:inline font-size="75%" role="SKIP">
<xsl:if test="string-length($text) &gt; 0">
<xsl:call-template name="recursiveSmallCaps">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
<xsl:variable name="smallCapsText">
<xsl:call-template name="recursiveSmallCaps">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:variable>
<!-- merge neighboring fo:inline -->
<xsl:for-each select="xalan:nodeset($smallCapsText)/node()">
<xsl:choose>
<xsl:when test="self::fo:inline and preceding-sibling::node()[1][self::fo:inline]"><!-- <xsl:copy-of select="."/> --></xsl:when>
<xsl:when test="self::fo:inline and @font-size">
<xsl:variable name="curr_pos" select="count(preceding-sibling::node()) + 1"/>
<!-- <curr_pos><xsl:value-of select="$curr_pos"/></curr_pos> -->
<xsl:variable name="next_text_" select="count(following-sibling::node()[not(local-name() = 'inline')][1]/preceding-sibling::node())"/>
<xsl:variable name="next_text">
<xsl:choose>
<xsl:when test="$next_text_ = 0">99999999</xsl:when>
<xsl:otherwise><xsl:value-of select="$next_text_ + 1"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- <next_text><xsl:value-of select="$next_text"/></next_text> -->
<fo:inline>
<xsl:copy-of select="@*"/>
<xsl:copy-of select="./node()"/>
<xsl:for-each select="following-sibling::node()[position() &lt; $next_text - $curr_pos]"> <!-- [self::fo:inline] -->
<xsl:copy-of select="./node()"/>
</xsl:for-each>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
</fo:inline>
</xsl:template>
Expand All @@ -4793,7 +4823,7 @@
<xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
<xsl:choose>
<xsl:when test="$char=$upperCase">
<fo:inline font-size="{100 div 0.75}%">
<fo:inline font-size="{100 div 0.75}%" role="SKIP">
<xsl:value-of select="$upperCase"/>
</fo:inline>
</xsl:when>
Expand Down Expand Up @@ -6203,15 +6233,15 @@
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="center">
<fo:block xsl:use-attribute-sets="formula-stem-block-style">
<fo:block xsl:use-attribute-sets="formula-stem-block-style" role="SKIP">

<xsl:call-template name="refine_formula-stem-block-style"/>

<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
<fo:table-cell display-align="center">
<fo:block xsl:use-attribute-sets="formula-stem-number-style">
<fo:block xsl:use-attribute-sets="formula-stem-number-style" role="SKIP">

<xsl:call-template name="refine_formula-stem-number-style"/>

Expand Down Expand Up @@ -7728,7 +7758,7 @@
<!-- second td with sourcecode -->
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
<fo:table-cell>
<fo:block>
<fo:block role="SKIP">
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
Expand Down Expand Up @@ -8215,7 +8245,7 @@

<xsl:call-template name="setTableCellAttributes"/>

<fo:block>
<fo:block role="SKIP">
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
Expand All @@ -8237,7 +8267,7 @@

<xsl:call-template name="setTableCellAttributes"/>

<fo:block>
<fo:block role="SKIP">
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
Expand Down Expand Up @@ -9253,7 +9283,7 @@
<xsl:call-template name="refine_list-item-style"/>

<fo:list-item-label end-indent="label-end()">
<fo:block xsl:use-attribute-sets="list-item-label-style">
<fo:block xsl:use-attribute-sets="list-item-label-style" role="SKIP">

<xsl:call-template name="refine_list-item-label-style"/>

Expand All @@ -9267,7 +9297,7 @@
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
<fo:block>
<fo:block role="SKIP">

<xsl:call-template name="refine_list-item-body-style"/>

Expand Down Expand Up @@ -9546,10 +9576,10 @@
<fo:table-body>
<fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">

<fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block>Pages</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block role="SKIP">Date</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block role="SKIP">Type</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block role="SKIP">Change</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid black"><fo:block role="SKIP">Pages</fo:block></fo:table-cell>
</fo:table-row>
<xsl:apply-templates/>
</fo:table-body>
Expand All @@ -9564,7 +9594,7 @@

<xsl:template match="*[local-name() = 'errata']/*[local-name() = 'row']/*">
<fo:table-cell border="1pt solid black" padding-left="1mm" padding-top="0.5mm">
<fo:block><xsl:apply-templates/></fo:block>
<fo:block role="SKIP"><xsl:apply-templates/></fo:block>
</fo:table-cell>
</xsl:template>
<!-- ============ -->
Expand Down Expand Up @@ -9642,8 +9672,8 @@
<fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:inline>
<fo:block role="SKIP">
<fo:inline role="SKIP">

<xsl:apply-templates select="*[local-name() = 'biblio-tag']">
<xsl:with-param name="biblio_tag_part">first</xsl:with-param>
Expand All @@ -9652,7 +9682,7 @@
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
<fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style" role="SKIP">
<xsl:call-template name="processBibitem">
<xsl:with-param name="biblio_tag_part">last</xsl:with-param>
</xsl:call-template>
Expand Down Expand Up @@ -9874,7 +9904,7 @@
<xsl:for-each select="*[local-name() = 'tab']">
<xsl:variable name="current_id" select="generate-id()"/>
<fo:table-cell>
<fo:block line-height-shift-adjustment="disregard-shifts">
<fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
Expand All @@ -9892,7 +9922,7 @@
</xsl:for-each>
<!-- last column - for page numbers -->
<fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
<fo:block>
<fo:block role="SKIP">
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
Expand Down
Loading

0 comments on commit fc7247e

Please sign in to comment.