lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.9.4 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.9.5

- old
+ new

@@ -1081,10 +1081,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_"> @@ -1402,10 +1403,14 @@ <xsl:attribute name="margin-bottom">12pt</xsl:attribute> <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="font-size">11pt</xsl:attribute> <xsl:attribute name="margin-left">12.7mm</xsl:attribute> @@ -1419,10 +1424,14 @@ <xsl:attribute name="padding-right">5mm</xsl:attribute> </xsl:attribute-set> <!-- termexample-name-style --> + <xsl:template name="refine_termexample-name-style"> + + </xsl:template> + <!-- ========================== --> <!-- Table styles --> <!-- ========================== --> <xsl:variable name="table-border_"> @@ -1602,18 +1611,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> @@ -2926,10 +2943,11 @@ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'"> <!-- centered table when table name is centered (see table-name-style) --> <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style"> + <fo:table-column column-width="proportional-column-width(1)"/> <fo:table-column column-width="{@width}"/> <fo:table-column column-width="proportional-column-width(1)"/> <fo:table-body> <fo:table-row> @@ -3967,12 +3985,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"> @@ -5113,15 +5132,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) &gt; 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> @@ -5154,26 +5178,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) &gt; 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']"> @@ -5277,10 +5303,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"> @@ -6679,10 +6708,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"> @@ -7382,10 +7416,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"> @@ -7400,20 +7436,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> @@ -7426,22 +7464,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> @@ -8899,10 +8937,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> @@ -9049,10 +9088,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> @@ -10300,10 +10340,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> @@ -12061,7 +12102,9 @@ <xsl:value-of select="local-name()"/> <xsl:text>&gt;</xsl:text> </fo:block> </xsl:if> </xsl:template> + + <!-- update --> </xsl:stylesheet> \ No newline at end of file