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

common.xsl updated for fmt-stem, metanorma/isodoc#645 #816

Merged
merged 2 commits into from
Feb 12, 2025
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
49 changes: 42 additions & 7 deletions xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -12423,6 +12423,8 @@
<!-- ======================================= -->
<!-- math -->
<!-- ======================================= -->
<xsl:template match="*[local-name() = 'stem'][following-sibling::*[1][local-name() = 'fmt-stem']]"/> <!-- for tablesonly.xml generated by mn2pdf -->

<xsl:template match="mathml:math">
<xsl:variable name="isAdded" select="@added"/>
<xsl:variable name="isDeleted" select="@deleted"/>
Expand Down Expand Up @@ -14594,7 +14596,9 @@
<xsl:apply-templates mode="bookmarks"/>
</xsl:template>

<xsl:template match="*[local-name() = 'title' or local-name() = 'name' or local-name() = 'fmt-title' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
<xsl:template match="*[local-name() = 'stem']" mode="contents"/>

<xsl:template match="*[local-name() = 'title' or local-name() = 'name' or local-name() = 'fmt-title' or local-name() = 'fmt-name']//*[local-name() = 'fmt-stem']" mode="contents">
<xsl:apply-templates select="."/>
</xsl:template>

Expand All @@ -14611,7 +14615,8 @@
<xsl:apply-templates mode="contents"/>
</xsl:template>

<xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
<xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
<xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
<xsl:apply-templates mode="bookmarks"/>
</xsl:template>

Expand Down Expand Up @@ -15087,7 +15092,8 @@
</xsl:copy>
</xsl:template>

<xsl:template match="*[local-name() = 'stem']" mode="contents_item">
<xsl:template match="*[local-name() = 'stem']" mode="contents_item"/>
<xsl:template match="*[local-name() = 'fmt-stem']" mode="contents_item">
<xsl:copy-of select="." />
</xsl:template>

Expand Down Expand Up @@ -19595,8 +19601,37 @@
<xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
<xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>

<xsl:template match="*[local-name() = 'stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])] |
*[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] |
<xsl:template match="*[local-name() = 'stem']" mode="update_xml_step1"/>
<xsl:template match="*[local-name() = 'stem']" mode="update_xml_pres"/>

<xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_step1">
<xsl:element name="stem" namespace="{$namespace_full}">
<xsl:copy-of select="@*"/>
<xsl:choose>
<xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
<xsl:copy-of select="*[local-name() = 'semx']/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_pres">
<xsl:element name="stem" namespace="{$namespace_full}">
<xsl:copy-of select="@*"/>
<xsl:choose>
<xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
<xsl:copy-of select="*[local-name() = 'semx']/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>

<xsl:template match="*[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] |
*[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough']) and not(.//*[local-name() = 'fmt-name'])] |
*[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] |
*[local-name() = 'localized-strings']" mode="update_xml_step1">
Expand Down Expand Up @@ -21386,10 +21421,10 @@

<xsl:variable name="data_value">
<xsl:choose>
<xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
<xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != 0">
<xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
</xsl:when>
<xsl:when test="string-length($bibdata_updated) != ''">
<xsl:when test="string-length($bibdata_updated) != 0">
<xsl:value-of select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
</xsl:when>
<xsl:when test="$formatted = 'true'">
Expand Down
16 changes: 16 additions & 0 deletions xslt_src/jcgm.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,22 @@
</xsl:template>

<xsl:template match="*[local-name() = 'fmt-xref-label']" mode="flatxml_step1"/>

<xsl:template match="*[local-name() = 'stem']" mode="flatxml_step1"/>

<xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="flatxml_step1">
<xsl:element name="stem" namespace="{$namespace_full}">
<xsl:copy-of select="@*"/>
<xsl:choose>
<xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
<xsl:copy-of select="*[local-name() = 'semx']/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>

<xsl:template name="setCrossAlignAttributes">
<xsl:variable name="is_cross_aligned">
Expand Down
Loading