Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xslt update based on metanorma/mn-native-pdf@b32eb067bbe953038419aa029b5883f19423352a #430

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 75 additions & 23 deletions lib/isodoc/ieee/ieee.amendment.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7419,7 +7419,9 @@
<!-- EMD table's footnotes rendering -->
<!-- ============================ -->

<!-- ============================ -->
<!-- figure's footnotes rendering -->
<!-- ============================ -->
<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="fn_display_figure">

<!-- current figure id -->
Expand Down Expand Up @@ -7533,9 +7535,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 xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='fn']">
<fo:inline xsl:use-attribute-sets="fn-reference-style">
Expand Down Expand Up @@ -7677,18 +7698,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 @@ -7874,7 +7897,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 xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 @@ -10165,9 +10188,11 @@
</xsl:template>

<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 @@ -10323,8 +10348,17 @@
</xsl:when>
<xsl:otherwise>

<xsl:text>—</xsl:text>
<!-- 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 @@ -10343,8 +10377,16 @@
</xsl:when>
<xsl:otherwise>

<xsl:text>—</xsl:text>

<!-- 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 @@ -12858,15 +12900,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 @@ -12888,9 +12932,13 @@
</xsl:template>

<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
<!-- ====== -->
<!-- ====== -->

Expand Down Expand Up @@ -13066,8 +13114,12 @@
</xsl:template>

<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'admitted']">
Expand Down
98 changes: 75 additions & 23 deletions lib/isodoc/ieee/ieee.standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7419,7 +7419,9 @@
<!-- EMD table's footnotes rendering -->
<!-- ============================ -->

<!-- ============================ -->
<!-- figure's footnotes rendering -->
<!-- ============================ -->
<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="fn_display_figure">

<!-- current figure id -->
Expand Down Expand Up @@ -7533,9 +7535,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 xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='fn']">
<fo:inline xsl:use-attribute-sets="fn-reference-style">
Expand Down Expand Up @@ -7677,18 +7698,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 @@ -7874,7 +7897,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 xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 @@ -10165,9 +10188,11 @@
</xsl:template>

<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 @@ -10323,8 +10348,17 @@
</xsl:when>
<xsl:otherwise>

<xsl:text>—</xsl:text>
<!-- 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 @@ -10343,8 +10377,16 @@
</xsl:when>
<xsl:otherwise>

<xsl:text>—</xsl:text>

<!-- 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 @@ -12858,15 +12900,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 @@ -12888,9 +12932,13 @@
</xsl:template>

<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
<!-- ====== -->
<!-- ====== -->

Expand Down Expand Up @@ -13066,8 +13114,12 @@
</xsl:template>

<xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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 xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'admitted']">
Expand Down
Loading