lib/isodoc/ogc/ogc.white-paper.xsl in metanorma-ogc-2.6.5 vs lib/isodoc/ogc/ogc.white-paper.xsl in metanorma-ogc-2.6.6
- old
+ new
@@ -510,10 +510,11 @@
<fo:block break-after="page"/>
</xsl:if>
<fo:block>
<xsl:call-template name="setId"/>
+ <xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!-- ====== -->
@@ -4347,20 +4348,25 @@
<fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
<xsl:call-template name="refine_table-fn-number-style"/>
<xsl:value-of select="@reference"/>
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
+ <!-- <xsl:if test="$namespace = 'itu'">
+ <xsl:text>)</xsl:text>
+ </xsl:if> -->
+
</fo:inline>
<fo:inline xsl:use-attribute-sets="table-fn-body-style">
<xsl:copy-of select="./node()"/>
</fo:inline>
</fo:block>
</xsl:if>
</xsl:for-each>
- </xsl:template>
+ </xsl:template> <!-- table_fn_display -->
<xsl:template name="create_fn">
<fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
<xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
<xsl:attribute name="id">
@@ -4390,12 +4396,14 @@
</xsl:template>
<!-- ============================ -->
<!-- EMD table's footnotes rendering -->
<!-- ============================ -->
+ <!-- ============================ -->
<!-- figure's footnotes rendering -->
- <xsl:template name="fn_display_figure">
+ <!-- ============================ -->
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
<!-- current figure id -->
<xsl:variable name="figure_id_">
<xsl:value-of select="@id"/>
<xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
@@ -4504,13 +4512,32 @@
</fo:table-body>
</fo:table>
</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">
<xsl:call-template name="refine_fn-reference-style"/>
@@ -4527,10 +4554,14 @@
<xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
</xsl:attribute>
<xsl:value-of select="@reference"/>
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
+ <!-- <xsl:if test="$namespace = 'jis'">
+ <fo:inline font-weight="normal">)</fo:inline>
+ </xsl:if> -->
</fo:basic-link>
</fo:inline>
</xsl:template>
<xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
@@ -4653,21 +4684,26 @@
<!-- preceding 'p' with word 'where' -->
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
</fo:block>
</xsl:when> <!-- END: a few components -->
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
+ <!-- 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 -->
- <xsl:call-template name="refine_figure_key_style"/>
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
- <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: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>
<!-- a few components -->
<xsl:if test="$onlyOneComponent = 'false'">
@@ -4849,10 +4885,18 @@
<xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
</xsl:if>
</xsl:template> <!-- END: dl -->
+ <!-- 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"/>
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
<xsl:template name="refine_dl_formula_where_style">
</xsl:template> <!-- refine_dl_formula_where_style -->
<xsl:template name="refine_figure_key_style">
@@ -6884,10 +6928,43 @@
</xsl:if>
<xsl:apply-templates mode="mathml"/>
</xsl:copy>
</xsl:template>
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- split math into two math -->
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
+ <xsl:variable name="math_elements_tree_">
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
+ <element pos="{position()}">
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
+ <xsl:value-of select="name()"/>
+ </element>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
+
+ <xsl:call-template name="insertClosingElements">
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
+ </xsl:call-template>
+
+ <xsl:element name="br" namespace="{$namespace_full}"/>
+
+ <xsl:call-template name="insertOpeningElements">
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
+ <xsl:with-param name="add_continue">false</xsl:with-param>
+ </xsl:call-template>
+
+ </xsl:template>
+
<!-- Examples:
<stem type="AsciiMath">x = 1</stem>
<stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
<stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
-->
@@ -7135,13 +7212,15 @@
<xsl:apply-templates/>
</fo:inline>
</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) -->
<xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
<fo:block xsl:use-attribute-sets="formula-style">
@@ -7293,10 +7372,21 @@
<xsl:when test="$sfx != ''">
<xsl:value-of select="$sfx"/>
</xsl:when>
<xsl:otherwise>
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
+ <!-- <xsl:if test="$namespace = 'ieee'">
+ <xsl:text>—</xsl:text> em dash —
+ </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 –
+ </xsl:if> -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="normalize-space() != ''">
<xsl:apply-templates/>
@@ -7311,12 +7401,20 @@
<xsl:when test="$sfx != ''">
<xsl:value-of select="$sfx"/>
</xsl:when>
<xsl:otherwise>
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
+ <!-- <xsl:if test="$namespace = 'ieee'">
+ <xsl:text>—</xsl:text> em dash —
+ </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 –
+ </xsl:if> -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="normalize-space() != ''">
<xsl:apply-templates/>
@@ -9500,11 +9598,11 @@
<xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
<xsl:if test="normalize-space() != ''">
<fo:inline xsl:use-attribute-sets="termexample-name-style">
<xsl:call-template name="refine_termexample-name-style"/>
- <xsl:apply-templates/>
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
</fo:inline>
</xsl:if>
</xsl:template>
<xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
@@ -9662,11 +9760,11 @@
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="example-name-style">
<xsl:call-template name="refine_example-name-style"/>
- <xsl:apply-templates/>
+ <xsl:apply-templates/> <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -9844,19 +9942,21 @@
<xsl:call-template name="refine_quote-style"/>
<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>
</fo:block-container>
</fo:block-container>
@@ -9874,13 +9974,17 @@
</xsl:with-param>
</xsl:call-template>
</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']"/>
<!-- ====== -->
<!-- ====== -->
<xsl:variable name="bibitems_">
<xsl:for-each select="//*[local-name() = 'bibitem']">
@@ -10067,12 +10171,16 @@
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="*[local-name() = 'domain']">
+ <!-- https://github.com/metanorma/isodoc/issues/607
<fo:inline xsl:use-attribute-sets="domain-style"><<xsl:apply-templates/>></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']">
<fo:block xsl:use-attribute-sets="admitted-style">
<xsl:apply-templates/>
@@ -10116,18 +10224,43 @@
</xsl:template>
<!-- ========== -->
<!-- END definition -->
<!-- ========== -->
+ <xsl:variable name="reviews_">
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
+ <xsl:copy>
+ <xsl:copy-of select="@from"/>
+ <xsl:copy-of select="@id"/>
+ </xsl:copy>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
+
+ <xsl:template name="addReviewHelper">
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
+ <xsl:variable name="curr_id" select="@id"/>
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
+ </xsl:if>
+ <!-- <fo:block>
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
+ <xsl:copy-of select="$reviews"/>
+ </fo:block> -->
+ </xsl:template>
+
<!-- main sections -->
<xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="sections_element_style"/>
+ <xsl:call-template name="addReviewHelper"/>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
@@ -10164,10 +10297,11 @@
<fo:block break-after="page"/>
<fo:block>
<xsl:call-template name="setId"/>
+ <xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!-- preface/ page_sequence/clause -->
@@ -10200,10 +10334,12 @@
<xsl:call-template name="setBlockSpanAll"/>
<xsl:call-template name="refine_clause_style"/>
+ <xsl:call-template name="addReviewHelper"/>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template name="refine_clause_style">
@@ -10252,23 +10388,41 @@
<!-- <fo:block font-weight="bold">Review:</fo:block>
<xsl:apply-templates /> -->
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
+ <xsl:if test="1 = 1">
<xsl:choose>
<!-- if there isn't the attribute '@from', then -->
<xsl:when test="$id_from = ''">
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
+ </xsl:when>
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
+ </xsl:when>
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="1 = 2">
+ <xsl:choose>
+ <!-- if there isn't the attribute '@from', then -->
+ <xsl:when test="$id_from = ''">
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
</xsl:when>
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
</xsl:when>
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
</xsl:when>
</xsl:choose>
+ </xsl:if>
</xsl:template>
<!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
<xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
@@ -11630,11 +11784,11 @@
<xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
<!-- remove preprocess-xslt -->
<xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
+ <xsl:template match="*[local-name() = 'stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])] | *[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
<xsl:copy>
@@ -11696,10 +11850,26 @@
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
+ <xsl:apply-templates mode="update_xml_step1"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- split math by element with @linebreak into maths -->
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
+ <xsl:variable name="maths">
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
+ </xsl:variable>
+ <xsl:copy-of select="$maths"/>
+ </xsl:template>
+
<!-- =========================================================================== -->
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
<!-- =========================================================================== -->
<!-- =========================================================================== -->
@@ -11799,20 +11969,23 @@
</xsl:for-each>
</xsl:template>
<xsl:template name="insertOpeningElements">
<xsl:param name="tree"/>
+ <xsl:param name="xmlns"/>
+ <xsl:param name="add_continue">true</xsl:param>
<xsl:for-each select="$tree//element">
<xsl:text disable-output-escaping="yes"><</xsl:text>
<xsl:value-of select="."/>
<xsl:for-each select="@*[local-name() != 'pos']">
<xsl:text> </xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:for-each>
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
<xsl:text disable-output-escaping="yes">></xsl:text>
<xsl:if test="$debug = 'true'">
<xsl:message><<xsl:value-of select="."/>></xsl:message>
</xsl:if>
</xsl:for-each>
\ No newline at end of file