lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-2.5.6 vs lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-2.5.8

- old
+ new

@@ -1936,10 +1936,11 @@ </fo:block> </xsl:otherwise> </xsl:choose> <fo:block> <xsl:call-template name="setId"/> + <xsl:call-template name="addReviewHelper"/> <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="itu:preface/*/itu:clause" priority="3"> @@ -2071,23 +2072,29 @@ <xsl:apply-templates/> <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </fo:block> <xsl:if test="$doctype != 'resolution'"> <fo:block font-size="12pt" font-weight="normal" margin-top="6pt"> - <xsl:choose> + <!-- <xsl:choose> <xsl:when test="parent::*[@obligation = 'informative']"> <xsl:text>(This appendix does not form an integral part of this Recommendation.)</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>(This annex forms an integral part of this Recommendation.)</xsl:text> </xsl:otherwise> - </xsl:choose> + </xsl:choose> --> + <!-- Added for https://github.com/metanorma/isodoc/issues/614 --> + <xsl:apply-templates select="following-sibling::itu:p[not(preceding-sibling::itu:clause)][starts-with(normalize-space(), '(')]/node()"/> </fo:block> </xsl:if> </fo:block> </xsl:template> + <!-- Added for https://github.com/metanorma/isodoc/issues/614 --> + <!-- renders in the annex/title template --> + <xsl:template match="itu:annex/itu:p[preceding-sibling::*[1][self::itu:title or self::itu:variant-title]][starts-with(normalize-space(), '(')]" priority="3"/> + <!-- Bibliography --> <xsl:template match="itu:references[not(@normative='true')]/itu:title"> <fo:block font-size="14pt" font-weight="bold" text-align="center" margin-bottom="18pt" role="H1"> <xsl:if test="$doctype = 'implementers-guide'"> <xsl:attribute name="text-align">left</xsl:attribute> @@ -2223,36 +2230,54 @@ </fo:inline> <fo:inline font-weight="bold"> <xsl:call-template name="setStyle_preferred"/> <xsl:apply-templates/> </fo:inline> - <xsl:if test="../itu:termsource/itu:origin"> - <xsl:text>: </xsl:text> + <xsl:if test="../itu:termsource"> + <!-- https://github.com/metanorma/isodoc/issues/614 --> + <!-- <xsl:text>: </xsl:text> --> + <xsl:text> </xsl:text> <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/> <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/> <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/> - <xsl:call-template name="insert_basic_link"> - <xsl:with-param name="element"> - <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}"> - <xsl:choose> - <xsl:when test="$origin_text != ''"> - <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/> - </xsl:when> - <xsl:when test="contains($citeas, '[')"> - <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" --> - </xsl:when> - <xsl:otherwise> - <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text> - </xsl:otherwise> - </xsl:choose> - </fo:basic-link> - </xsl:with-param> - </xsl:call-template> + <xsl:choose> + <xsl:when test="$origin_text != '' or $citeas != ''"> + <xsl:call-template name="insert_basic_link"> + <xsl:with-param name="element"> + <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}"> + <xsl:choose> + <xsl:when test="$origin_text != ''"> + <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/> + </xsl:when> + <!-- https://github.com/metanorma/isodoc/issues/614 --> + <!-- <xsl:when test="contains($citeas, '[')"> + <xsl:text> </xsl:text><xsl:value-of select="$citeas"/>disable-output-escaping="yes" + </xsl:when> + <xsl:otherwise> + <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text> + </xsl:otherwise> --> + <xsl:otherwise> + <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> + </xsl:otherwise> + </xsl:choose> + </fo:basic-link> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="../itu:termsource"> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> </xsl:if> <xsl:if test="following-sibling::itu:definition/node()"> - <xsl:text>: </xsl:text> + <xsl:if test="../itu:termsource"> + <xsl:text>:</xsl:text> + </xsl:if> + <xsl:text> </xsl:text> <!-- <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> --> <xsl:apply-templates select="following-sibling::itu:definition"> <xsl:with-param name="process">true</xsl:with-param> </xsl:apply-templates> </xsl:if> @@ -2260,11 +2285,16 @@ <!-- <xsl:if test="following-sibling::itu:table"> <fo:block space-after="18pt">&#xA0;</fo:block> </xsl:if> --> </xsl:template> <!-- preferred --> - <xsl:template match="itu:term[itu:preferred]/itu:termsource" priority="2"/> + <xsl:template match="itu:term[itu:preferred]/itu:termsource" priority="2"> + <xsl:param name="process">false</xsl:param> + <xsl:if test="$process = 'true'"> + <xsl:apply-templates/> + </xsl:if> + </xsl:template> <xsl:template match="itu:term[itu:preferred]/itu:definition" priority="2"> <xsl:param name="process">false</xsl:param> <xsl:if test="$process = 'true'"> <xsl:apply-templates/> @@ -6294,22 +6324,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"> @@ -6337,12 +6370,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> @@ -6451,13 +6486,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"/> @@ -6469,10 +6523,14 @@ </xsl:attribute> </xsl:if> <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() != '']"> @@ -6629,21 +6687,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'"> @@ -6825,10 +6888,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:attribute name="margin-bottom">6pt</xsl:attribute> </xsl:template> <!-- refine_dl_formula_where_style --> @@ -8867,10 +8938,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> --> @@ -9118,13 +9222,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"> @@ -9280,12 +9386,21 @@ <xsl:when test="$sfx != ''"> <xsl:value-of select="$sfx"/> </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> <xsl:if test="normalize-space() != ''"> <xsl:apply-templates/> @@ -9300,12 +9415,20 @@ <xsl:when test="$sfx != ''"> <xsl:value-of select="$sfx"/> </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> <xsl:if test="normalize-space() != ''"> <xsl:apply-templates/> @@ -11469,11 +11592,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']"> @@ -11631,11 +11754,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> @@ -11813,19 +11936,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> @@ -11843,13 +11968,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']"> @@ -12026,12 +12155,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">&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']"> <fo:block xsl:use-attribute-sets="admitted-style"> <xsl:apply-templates/> @@ -12075,18 +12208,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> @@ -12125,10 +12283,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 --> @@ -12161,10 +12320,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"> @@ -12217,23 +12378,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']"/> @@ -13619,11 +13798,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> @@ -13685,10 +13864,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 --> <!-- =========================================================================== --> <!-- =========================================================================== --> @@ -13788,20 +13983,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">&lt;</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">&gt;</xsl:text> <xsl:if test="$debug = 'true'"> <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message> </xsl:if> </xsl:for-each> \ No newline at end of file