lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.12.5 vs lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.12.6
- old
+ new
@@ -1078,10 +1078,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_">
@@ -1385,10 +1386,14 @@
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</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="font-size">11pt</xsl:attribute>
<xsl:attribute name="margin-top">12pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1407,10 +1412,14 @@
<xsl:attribute-set name="termexample-name-style">
</xsl:attribute-set> <!-- termexample-name-style -->
+ <xsl:template name="refine_termexample-name-style">
+
+ </xsl:template>
+
<!-- ========================== -->
<!-- Table styles -->
<!-- ========================== -->
<xsl:variable name="table-border_">
@@ -1607,18 +1616,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>
@@ -3966,12 +3983,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">
@@ -5105,15 +5123,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>
@@ -5146,26 +5169,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']">
@@ -5198,10 +5223,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">
@@ -6600,10 +6628,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">
@@ -7314,10 +7347,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">
@@ -7332,20 +7367,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>
@@ -7358,22 +7395,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>
@@ -8831,10 +8868,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>
@@ -8981,10 +9019,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>
@@ -10192,10 +10231,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 -->
@@ -10212,10 +10252,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>
@@ -11983,7 +12024,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