Skip to content

Commit

Permalink
Merge pull request #172 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jun 30, 2023
2 parents fb61a8c + be00cc7 commit 4f0bbac
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 50 deletions.
98 changes: 73 additions & 25 deletions lib/isodoc/m3aawg/m3aawg.policy.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@
</xsl:attribute-set>

<xsl:attribute-set name="figure-block-style">
<xsl:attribute name="role">SKIP</xsl:attribute>

<xsl:attribute name="margin-bottom">12pt</xsl:attribute>

Expand All @@ -1605,6 +1606,7 @@
</xsl:attribute-set>

<xsl:attribute-set name="figure-name-style">
<xsl:attribute name="role">Caption</xsl:attribute>

<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="margin-top">12pt</xsl:attribute>
Expand Down Expand Up @@ -1653,6 +1655,7 @@
</xsl:template>

<xsl:attribute-set name="image-style">
<xsl:attribute name="role">SKIP</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>

</xsl:attribute-set>
Expand Down Expand Up @@ -1910,6 +1913,11 @@

</xsl:attribute-set> <!-- bibitem-non-normative-list-style -->

<xsl:attribute-set name="bibitem-non-normative-list-item-style">
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>

</xsl:attribute-set>

<!-- bibitem in bibliography section (references/@normative="false"), list body -->
<xsl:attribute-set name="bibitem-normative-list-body-style">

Expand Down Expand Up @@ -2314,14 +2322,14 @@
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
</xsl:when>
<xsl:otherwise>
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
<fo:inline keep-together.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>

<xsl:otherwise>
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
<fo:inline keep-together.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
</xsl:otherwise>

</xsl:choose>
Expand All @@ -2331,7 +2339,7 @@
<!-- Preface boilerplate sections processing -->
<!-- ================================= -->
<xsl:template match="*[local-name()='copyright-statement']">
<fo:block xsl:use-attribute-sets="copyright-statement-style">
<fo:block xsl:use-attribute-sets="copyright-statement-style" role="SKIP">
<xsl:apply-templates/>
</fo:block>
</xsl:template> <!-- copyright-statement -->
Expand Down Expand Up @@ -3534,7 +3542,7 @@
</xsl:choose>
</xsl:variable>
<xsl:variable name="footnote_inline">
<fo:inline>
<fo:inline role="Reference">

<xsl:variable name="fn_styles">
<xsl:choose>
Expand All @@ -3557,7 +3565,7 @@

<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
<fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
<xsl:copy-of select="$current_fn_number_text"/>
</fo:basic-link>
</xsl:with-param>
Expand All @@ -3570,17 +3578,17 @@
<xsl:copy-of select="$footnote_inline"/>
</xsl:when>
<xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
<fo:footnote xsl:use-attribute-sets="fn-style">
<fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
<xsl:copy-of select="$footnote_inline"/>
<fo:footnote-body>
<fo:footnote-body role="Note">

<fo:block-container xsl:use-attribute-sets="fn-container-body-style">
<fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">

<fo:block xsl:use-attribute-sets="fn-body-style">
<fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">

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

<fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
<fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">

<xsl:call-template name="refine_fn-body-num-style"/>

Expand Down Expand Up @@ -3842,11 +3850,11 @@
</xsl:template>

<xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
<fo:inline><xsl:value-of select="."/></fo:inline>
<fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
</xsl:template>

<xsl:template match="*[local-name()='fn']//*[local-name()='p']">
<fo:inline>
<fo:inline role="P">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
Expand Down Expand Up @@ -4564,6 +4572,9 @@

<xsl:template name="refine_strong_style">

<xsl:if test="ancestor::*['preferred']">
<xsl:attribute name="role">SKIP</xsl:attribute>
</xsl:if>
</xsl:template>

<xsl:template match="*[local-name()='padding']">
Expand Down Expand Up @@ -6493,12 +6504,13 @@

<xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']">
<xsl:if test="normalize-space() != ''">
<xsl:variable name="level">
<!-- <xsl:variable name="level">
<xsl:call-template name="getLevelTermName"/>
</xsl:variable>
<fo:inline role="H{$level}">
<xsl:apply-templates/>
</fo:inline>
<xsl:apply-templates />
</fo:inline> -->
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<!-- ====== -->
Expand All @@ -6522,7 +6534,7 @@
<!-- Example: Dimensions in millimeters -->
<xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>

<fo:block xsl:use-attribute-sets="figure-style">
<fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
</fo:block>
<xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
Expand Down Expand Up @@ -8837,18 +8849,18 @@

<xsl:choose>
<xsl:when test="$lang = 'zh'">
<fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
<fo:inline role="SKIP"><xsl:value-of select="$tab_zh"/></fo:inline>
</xsl:when>
<xsl:when test="../../@inline-header = 'true'">
<fo:inline font-size="90%">
<fo:inline font-size="90%" role="SKIP">
<xsl:call-template name="insertNonBreakSpaces">
<xsl:with-param name="count" select="$padding-right"/>
</xsl:call-template>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
<fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
<fo:inline padding-right="{$padding-right}mm" role="SKIP"><xsl:value-of select="$direction"/>​</fo:inline>
</xsl:otherwise>
</xsl:choose>

Expand Down Expand Up @@ -8878,12 +8890,12 @@
<fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">

<xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
<fo:block xsl:use-attribute-sets="term-name-style">
<fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
<xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
</fo:block>
</xsl:if>

<fo:block xsl:use-attribute-sets="preferred-term-style">
<fo:block xsl:use-attribute-sets="preferred-term-style" role="SKIP">
<xsl:call-template name="setStyle_preferred"/>
<xsl:apply-templates/>
</fo:block>
Expand Down Expand Up @@ -8924,7 +8936,7 @@
<!-- definition -->
<!-- ========== -->
<xsl:template match="*[local-name() = 'definition']">
<fo:block xsl:use-attribute-sets="definition-style">
<fo:block xsl:use-attribute-sets="definition-style" role="SKIP">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
Expand Down Expand Up @@ -8974,6 +8986,10 @@

<xsl:template match="*[local-name() = 'clause']">
<fo:block>
<xsl:if test="parent::*[local-name() = 'copyright-statement']">
<xsl:attribute name="role">SKIP</xsl:attribute>
</xsl:if>

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

<xsl:call-template name="setBlockSpanAll"/>
Expand Down Expand Up @@ -9229,7 +9245,7 @@
</xsl:when>
<xsl:otherwise>

<fo:block>
<fo:block role="SKIP">
<xsl:apply-templates select="." mode="list"/>
</fo:block>

Expand Down Expand Up @@ -9651,7 +9667,10 @@
<!-- Reference sections (Normative References and Bibliography) -->
<!-- ========================================================== -->
<xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/>
<xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/>
<xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3">
<xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/>

</xsl:template>
<!-- don't display bibitem with @id starts with '_hidden', that was introduced for references integrity -->
<xsl:template match="*[local-name() = 'bibitem'][starts-with(@id, 'hidden_bibitem_')]" priority="3"/>

Expand Down Expand Up @@ -9707,7 +9726,7 @@

<!-- Bibliography (non-normative references) -->
<xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" name="bibitem_non_normative" priority="2">

<xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
<!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
$namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
<!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
Expand Down Expand Up @@ -9735,6 +9754,35 @@

</xsl:template> <!-- references[not(@normative='true')]/bibitem -->

<xsl:template name="insertListItem_Bibitem">
<xsl:choose>
<xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
<xsl:otherwise>
<fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
<fo:list-item-label end-indent="label-end()">
<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>
</xsl:apply-templates>
</fo:inline>
</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" role="SKIP">
<xsl:call-template name="processBibitem">
<xsl:with-param name="biblio_tag_part">last</xsl:with-param>
</xsl:call-template>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="following-sibling::*[1][local-name() = 'bibitem']">
<xsl:with-param name="skip">false</xsl:with-param>
</xsl:apply-templates>
</xsl:template>

<xsl:template name="processBibitem">
<xsl:param name="biblio_tag_part">both</xsl:param>

Expand Down
Loading

0 comments on commit 4f0bbac

Please sign in to comment.