lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-2.0.7 vs lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-2.0.8

- old
+ new

@@ -112,25 +112,33 @@ <xsl:variable name="isAmendment" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:amendment[@language = $lang])"/> <xsl:variable name="isCorrigendum" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:corrigendum[@language = $lang])"/> <xsl:template match="/"> <xsl:call-template name="namespaceCheck"/> - <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}"> - <!-- <xsl:if test="$lang != 'ar'"> - <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute> - </xsl:if> --> - <xsl:if test="$doctype = 'resolution'"> - <xsl:attribute name="font-size">11pt</xsl:attribute> - </xsl:if> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="font-size">11pt</xsl:attribute> - <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute> - </xsl:if> - <xsl:call-template name="setWritingMode"/> - <xsl:if test="$lang = 'ar'"> - <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute> - </xsl:if> + <fo:root xml:lang="{$lang}"> + <xsl:variable name="root-style"> + <root-style xsl:use-attribute-sets="root-style"> + <!-- <xsl:if test="$lang != 'ar'"> + <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute> + </xsl:if> --> + <xsl:if test="$doctype = 'resolution'"> + <xsl:attribute name="font-size">11pt</xsl:attribute> + </xsl:if> + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="font-size">11pt</xsl:attribute> + <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute> + </xsl:if> + <xsl:call-template name="setWritingMode"/> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute> + </xsl:if> + </root-style> + </xsl:variable> + <xsl:call-template name="insertRootStyle"> + <xsl:with-param name="root-style" select="$root-style"/> + </xsl:call-template> + <fo:layout-master-set> <!-- Technical Report first page --> <fo:simple-page-master master-name="TR-first-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> <fo:region-body margin-top="21.6mm" margin-bottom="25.4mm" margin-left="20.1mm" margin-right="22.6mm"/> @@ -2208,12 +2216,35 @@ - </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style"> + </xsl:attribute-set><xsl:template name="insertRootStyle"> + <xsl:param name="root-style"/> + <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/> + <xsl:variable name="additional_fonts_"> + <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']"> + <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/> + + <xsl:for-each select="$root-style_/root-style/@*"> + <xsl:choose> + <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''"> + <xsl:attribute name="{local-name()}"> + <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template><xsl:attribute-set name="copyright-statement-style"> + </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style"> </xsl:attribute-set><xsl:attribute-set name="copyright-statement-p-style"> @@ -2718,11 +2749,11 @@ <xsl:attribute name="margin-top">4pt</xsl:attribute> - </xsl:attribute-set><xsl:attribute-set name="termnote-name-style"> + </xsl:attribute-set><xsl:attribute-set name="termnote-name-style"> </xsl:attribute-set><xsl:attribute-set name="quote-style"> @@ -5174,28 +5205,32 @@ </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="add-zero-spaces-equal"> <xsl:param name="text" select="."/> <xsl:variable name="zero-space-after-equals">==========</xsl:variable> + <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable> <xsl:variable name="zero-space-after-equal">=</xsl:variable> + <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable> <xsl:variable name="zero-space">​</xsl:variable> <xsl:choose> <xsl:when test="contains($text, $zero-space-after-equals)"> - <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/> + <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/> <xsl:value-of select="$zero-space-after-equals"/> <xsl:value-of select="$zero-space"/> <xsl:call-template name="add-zero-spaces-equal"> <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/> - </xsl:call-template> + </xsl:call-template> --> + <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/> </xsl:when> <xsl:when test="contains($text, $zero-space-after-equal)"> - <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/> + <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/> <xsl:value-of select="$zero-space-after-equal"/> <xsl:value-of select="$zero-space"/> <xsl:call-template name="add-zero-spaces-equal"> <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/> - </xsl:call-template> + </xsl:call-template> --> + <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> @@ -5671,11 +5706,16 @@ </xsl:template><xsl:template match="*[local-name() = 'termnote']"> <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style"> <fo:inline xsl:use-attribute-sets="termnote-name-style"> + <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> + + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> --> <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> <xsl:call-template name="append_add-style"/> @@ -6653,31 +6693,53 @@ <!-- add zero-width space after space --> <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/> <!-- split text by zero-width space --> <xsl:variable name="text_step4"> - <xsl:call-template name="split"> + <xsl:call-template name="split_for_interspers"> <xsl:with-param name="pText" select="$text_step3"/> <xsl:with-param name="sep" select="$zero_width_space"/> - <xsl:with-param name="normalize-space">false</xsl:with-param> - <xsl:with-param name="keep_sep">true</xsl:with-param> </xsl:call-template> </xsl:variable> - <xsl:for-each select="xalan:nodeset($text_step4)/item"> + <xsl:for-each select="xalan:nodeset($text_step4)/node()"> <xsl:choose> - <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space --> + <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space --> <xsl:call-template name="interspers"> <xsl:with-param name="str" select="."/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:for-each> + </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers"> + <xsl:param name="pText" select="."/> + <xsl:param name="sep" select="','"/> + <!-- word with length more than 30 will be interspersed with zero-width space --> + <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space --> + <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/> + <xsl:call-template name="replace_tag_interspers"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:template><xsl:template name="replace_tag_interspers"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="contains($text, $interspers_tag_open)"> + <xsl:value-of select="substring-before($text, $interspers_tag_open)"/> + <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/> + <interspers> + <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/> + </interspers> + <xsl:call-template name="replace_tag_interspers"> + <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise> + </xsl:choose> </xsl:template><xsl:template name="interspers"> <xsl:param name="str"/> <xsl:param name="char" select="$zero_width_space"/> <xsl:if test="$str != ''"> <xsl:value-of select="substring($str, 1, 1)"/> @@ -7121,10 +7183,10 @@ <xsl:text>]</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> --> </fo:block> - </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2"> + </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2"> <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/> </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()"> <xsl:if test="normalize-space() != ''"> <xsl:value-of select="."/> </xsl:if> \ No newline at end of file