lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.5.4 vs lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.5.5
- old
+ new
@@ -1811,10 +1811,11 @@
<xsl:variable name="non_breaking_hyphen">‑</xsl:variable>
<xsl:variable name="thin_space"> </xsl:variable>
<xsl:variable name="zero_width_space"></xsl:variable>
<xsl:variable name="hair_space"> </xsl:variable>
<xsl:variable name="en_dash">–</xsl:variable>
+ <xsl:variable name="em_dash">—</xsl:variable>
<xsl:template name="getTitle">
<xsl:param name="name"/>
<xsl:param name="lang"/>
<xsl:variable name="lang_">
@@ -2191,10 +2192,14 @@
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set> <!-- example-name-style -->
+ <xsl:template name="refine_example-name-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="example-p-style">
<xsl:attribute name="margin-bottom">14pt</xsl:attribute>
</xsl:attribute-set> <!-- example-p-style -->
@@ -2207,10 +2212,14 @@
<xsl:attribute name="padding-right">10mm</xsl:attribute>
</xsl:attribute-set> <!-- termexample-name-style -->
+ <xsl:template name="refine_termexample-name-style">
+
+ </xsl:template>
+
<!-- ========================== -->
<!-- Table styles -->
<!-- ========================== -->
<xsl:variable name="table-border_">
@@ -2396,18 +2405,26 @@
<xsl:attribute-set name="table-fn-style">
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
</xsl:attribute-set> <!-- table-fn-style -->
+ <xsl:template name="refine_table-fn-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="table-fn-number-style">
<xsl:attribute name="font-size">80%</xsl:attribute>
<xsl:attribute name="padding-right">5mm</xsl:attribute>
<xsl:attribute name="vertical-align">super</xsl:attribute>
</xsl:attribute-set> <!-- table-fn-number-style -->
+ <xsl:template name="refine_table-fn-number-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="fn-container-body-style">
<xsl:attribute name="text-indent">0</xsl:attribute>
<xsl:attribute name="start-indent">0</xsl:attribute>
</xsl:attribute-set>
@@ -4838,12 +4855,13 @@
<xsl:for-each select="xalan:nodeset($references)//fn">
<xsl:variable name="reference" select="@reference"/>
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
<fo:block xsl:use-attribute-sets="table-fn-style">
-
+ <xsl:call-template name="refine_table-fn-style"/>
<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"/>
</fo:inline>
<fo:inline xsl:use-attribute-sets="table-fn-body-style">
@@ -6000,15 +6018,20 @@
</xsl:template>
<xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
<!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
<xsl:variable name="text" select="."/>
- <fo:inline font-size="75%" role="SKIP">
+ <xsl:variable name="ratio_">
+ 0.75
+ </xsl:variable>
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
<xsl:if test="string-length($text) > 0">
<xsl:variable name="smallCapsText">
<xsl:call-template name="recursiveSmallCaps">
<xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="ratio" select="$ratio"/>
</xsl:call-template>
</xsl:variable>
<!-- merge neighboring fo:inline -->
<xsl:for-each select="xalan:nodeset($smallCapsText)/node()">
<xsl:choose>
@@ -6041,26 +6064,28 @@
</fo:inline>
</xsl:template>
<xsl:template name="recursiveSmallCaps">
<xsl:param name="text"/>
+ <xsl:param name="ratio"/>
<xsl:variable name="char" select="substring($text,1,1)"/>
<!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
<xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
<xsl:choose>
<xsl:when test="$char=$upperCase">
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
<xsl:value-of select="$upperCase"/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$upperCase"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length($text) > 1">
<xsl:call-template name="recursiveSmallCaps">
<xsl:with-param name="text" select="substring($text,2)"/>
+ <xsl:with-param name="ratio" select="$ratio"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="*[local-name() = 'pagebreak']">
@@ -6093,10 +6118,13 @@
</xsl:choose>
</xsl:variable>
<xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
<style name="{$key}"><xsl:value-of select="$value"/></style>
</xsl:if>
+ <xsl:if test="$key = 'text-indent'">
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
+ </xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
<xsl:choose>
<xsl:when test="$styles/style">
@@ -7499,10 +7527,15 @@
</fo:basic-link>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
+ <!-- command between two xref points to non-standard bibitem -->
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
<!-- ====== -->
<!-- formula -->
<!-- ====== -->
<xsl:template match="*[local-name() = 'formula']" name="formula">
<fo:block-container margin-left="0mm" role="SKIP">
@@ -8204,10 +8237,12 @@
<xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
+
<xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
<xsl:copy>
<xsl:apply-templates select="@*" mode="svg_update"/>
<xsl:variable name="viewbox_">
<xsl:call-template name="split">
@@ -8222,20 +8257,22 @@
<xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
<xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
<xsl:attribute name="width">
<xsl:choose>
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
<xsl:when test="$width != ''">
<xsl:value-of select="round($width)"/>
</xsl:when>
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:choose>
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
<xsl:when test="$height != ''">
<xsl:value-of select="round($height)"/>
</xsl:when>
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
</xsl:choose>
@@ -8248,22 +8285,22 @@
<xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
<!-- image[@width]/svg -->
<xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
<xsl:attribute name="width">
<xsl:choose>
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
<xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
<!-- image[@height]/svg -->
<xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
<xsl:attribute name="height">
<xsl:choose>
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
@@ -9773,10 +9810,11 @@
</xsl:template>
<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/>
</fo:inline>
</xsl:if>
</xsl:template>
@@ -9923,10 +9961,11 @@
<xsl:apply-templates/>
</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/>:
</fo:inline>
</xsl:otherwise>
</xsl:choose>
@@ -11126,10 +11165,11 @@
<!-- Normative references -->
<xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
<fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
+
<xsl:call-template name="processBibitem"/>
</fo:block>
</xsl:template> <!-- bibitem -->
@@ -11167,10 +11207,11 @@
<xsl:template name="insertListItem_Bibitem">
<xsl:choose>
<xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
<xsl:otherwise>
<fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
+
<fo:list-item-label end-indent="label-end()">
<fo:block role="SKIP">
<fo:inline role="SKIP">
<xsl:apply-templates select="*[local-name() = 'biblio-tag']">
<xsl:with-param name="biblio_tag_part">first</xsl:with-param>
@@ -12931,7 +12972,9 @@
<xsl:value-of select="local-name()"/>
<xsl:text>></xsl:text>
</fo:block>
</xsl:if>
</xsl:template>
+
+ <!-- update -->
</xsl:stylesheet>
\ No newline at end of file