Skip to content

Commit

Permalink
xslt update based on metanorma/mn-native-pdf@b32eb06
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 authored Nov 5, 2024
1 parent 2fd9466 commit c77d5c2
Showing 1 changed file with 76 additions and 20 deletions.
96 changes: 76 additions & 20 deletions lib/isodoc/plateau/plateau.international-standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5371,7 +5371,9 @@
<!-- EMD table's footnotes rendering -->
<!-- ============================ -->

<!-- ============================ -->
<!-- figure's footnotes rendering -->
<!-- ============================ -->
<xsl:template name="fn_display_figure">

<!-- current figure id -->
Expand Down Expand Up @@ -5485,9 +5487,28 @@

</fo:block>
</xsl:if>

</xsl:template> <!-- fn_display_figure -->

<!-- added for https://github.com/metanorma/isodoc/issues/607 -->
<!-- figure's footnote label -->
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'dl'][@key = 'true']/*[local-name() = 'dt']/ *[local-name() = 'p'][count(node()[normalize-space() != '']) = 1]/*[local-name() = 'sup']" priority="3">
<xsl:variable name="key_iso">

</xsl:variable>
<xsl:if test="normalize-space($key_iso) = 'true'">
<xsl:attribute name="font-size">10pt</xsl:attribute>

</xsl:if>
<fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
<!-- <xsl:value-of select="@reference"/> -->
<xsl:apply-templates/>
</fo:inline>
</xsl:template>

<!-- ============================ -->
<!-- END: figure's footnotes rendering -->
<!-- ============================ -->

<!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
<xsl:template match="*[local-name()='fn']">
<fo:inline xsl:use-attribute-sets="fn-reference-style">
Expand Down Expand Up @@ -5631,18 +5652,20 @@
</fo:block>
</xsl:when> <!-- END: a few components -->
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
<!-- commented, Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
<!-- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">

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

<xsl:variable name="title-key">
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">key</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$title-key"/>
</fo:block> -->
<!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
<xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">

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

<xsl:variable name="title-key">
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">key</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$title-key"/>
</fo:block>
</xsl:if>
</xsl:when> <!-- END: definition list in a figure -->
</xsl:choose>

Expand Down Expand Up @@ -5828,7 +5851,7 @@

</xsl:template> <!-- END: dl -->

<!-- caption for figure key and another caption -->
<!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
<fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
<xsl:call-template name="refine_figure_key_style"/>
Expand Down Expand Up @@ -8117,9 +8140,11 @@
</xsl:template>

<xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
<!-- https://github.com/metanorma/isodoc/issues/607
<xsl:if test="normalize-space() != ''">
<xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
</xsl:if>
<xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
</xsl:if> -->
<xsl:apply-templates/>
</xsl:template>

<!-- stem inside formula with name (with formula's number) -->
Expand Down Expand Up @@ -8275,6 +8300,17 @@
</xsl:when>
<xsl:otherwise>

<!-- https://github.com/metanorma/isodoc/issues/607 -->
<!-- <xsl:if test="$namespace = 'ieee'">
<xsl:text>—</xsl:text> em dash &#x2014;
</xsl:if> -->
<!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
<xsl:text>:</xsl:text>
</xsl:if> -->

<!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
<xsl:text> – </xsl:text> en dash &#x2013;
</xsl:if> -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Expand All @@ -8293,6 +8329,16 @@
</xsl:when>
<xsl:otherwise>

<!-- https://github.com/metanorma/isodoc/issues/607 -->
<!-- <xsl:if test="$namespace = 'ieee'">
<xsl:text>—</xsl:text> em dash &#x2014;
</xsl:if> -->
<!-- <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' or $namespace = 'rsd' or $namespace = 'jcgm'">
<xsl:text>:</xsl:text>
</xsl:if> -->
<!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
<xsl:text> – </xsl:text> en dash &#x2013;
</xsl:if> -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Expand Down Expand Up @@ -10802,15 +10848,17 @@

<fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
<fo:block role="BlockQuote">
<xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
<xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source') and not(local-name() = 'attribution')]"/> <!-- process all nested nodes, except author and source -->
</fo:block>
</fo:block-container>
</fo:block-container>
<xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
<xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
<fo:block xsl:use-attribute-sets="quote-source-style">
<!-- — ISO, ISO 7301:2011, Clause 1 -->
<xsl:apply-templates select="*[local-name() = 'author']"/>
<xsl:apply-templates select="*[local-name() = 'source']"/>
<!-- added for https://github.com/metanorma/isodoc/issues/607 -->
<xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
</fo:block>
</xsl:if>

Expand All @@ -10832,9 +10880,13 @@
</xsl:template>

<xsl:template match="*[local-name() = 'author']">
<xsl:text>— </xsl:text>
<xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
<xsl:text>— </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
<!-- ====== -->
<!-- ====== -->

Expand Down Expand Up @@ -11007,8 +11059,12 @@
</xsl:template>

<xsl:template match="*[local-name() = 'domain']">
<!-- https://github.com/metanorma/isodoc/issues/607
<fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
<xsl:text> </xsl:text>
<xsl:text> </xsl:text> -->
<xsl:if test="not(@hidden = 'true')">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>

<xsl:template match="*[local-name() = 'admitted']">
Expand Down

0 comments on commit c77d5c2

Please sign in to comment.