metanorma-itu 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7db89ad5d9d4b7e95fabe204b31d0483a5aa2aff9b8b44b3928c950ee386298f
4
- data.tar.gz: d811c5e55c05040a3dea4ce55c4bda15b1ec8d4d3bc32ea9c450114e7586761a
3
+ metadata.gz: 0e30e3335fc27b626ca6cba25b687f537aac08babe91e60664b75cdf3d15b297
4
+ data.tar.gz: 35647c71c2143a270867b3ac28df029132b57d7aa6f06775eb86f54ed2d2e4b4
5
5
  SHA512:
6
- metadata.gz: e9f972facda295bc86b330f579673aa5b8dcc506db6a1b042867db5845527e4d806bc4abdfefb1266fadd955b323990f2ab4d8cc9a0d9c6dd3c57b888aa07e2f
7
- data.tar.gz: 6eb2bd17053707a2c85d49f4b10841a69b6d69e739c85c0ab37a73d2d2f11821ae0e3c20201d0484b61ee78d75b0a8a2e7f844696840af6b6f6bf796d99c2914
6
+ metadata.gz: 4d5973cea39ad61788f98e1176eae971ab0e7cf680e6aac7fd823d8a240055d73a672f2fcf7484b293dcaf6e6c6bca58dc3732cfdc1a7d1a2ca1f14620dd1768
7
+ data.tar.gz: de137661607d004bd80e2b119f2932abaae1ffc78b4cc57789ecde1c7b20c295ddf6369184c55c6b82774f1d42e2e0f3c54efe97c9a633e070bc7737c12021e5
@@ -114,21 +114,29 @@
114
114
 
115
115
  <xsl:template match="/">
116
116
  <xsl:call-template name="namespaceCheck"/>
117
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
118
- <!-- <xsl:if test="$lang != 'ar'">
119
- <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
120
- </xsl:if> -->
121
- <xsl:if test="$doctype = 'resolution'">
122
- <xsl:attribute name="font-size">11pt</xsl:attribute>
123
- </xsl:if>
124
- <xsl:if test="$doctype = 'service-publication'">
125
- <xsl:attribute name="font-size">11pt</xsl:attribute>
126
- <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
127
- </xsl:if>
128
- <xsl:call-template name="setWritingMode"/>
129
- <xsl:if test="$lang = 'ar'">
130
- <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
131
- </xsl:if>
117
+ <fo:root xml:lang="{$lang}">
118
+ <xsl:variable name="root-style">
119
+ <root-style xsl:use-attribute-sets="root-style">
120
+ <!-- <xsl:if test="$lang != 'ar'">
121
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
122
+ </xsl:if> -->
123
+ <xsl:if test="$doctype = 'resolution'">
124
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
125
+ </xsl:if>
126
+ <xsl:if test="$doctype = 'service-publication'">
127
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
128
+ <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
129
+ </xsl:if>
130
+ <xsl:call-template name="setWritingMode"/>
131
+ <xsl:if test="$lang = 'ar'">
132
+ <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
133
+ </xsl:if>
134
+ </root-style>
135
+ </xsl:variable>
136
+ <xsl:call-template name="insertRootStyle">
137
+ <xsl:with-param name="root-style" select="$root-style"/>
138
+ </xsl:call-template>
139
+
132
140
  <fo:layout-master-set>
133
141
 
134
142
  <!-- Technical Report first page -->
@@ -2210,7 +2218,30 @@
2210
2218
 
2211
2219
 
2212
2220
 
2213
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
2221
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
2222
+ <xsl:param name="root-style"/>
2223
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
2224
+
2225
+ <xsl:variable name="additional_fonts_">
2226
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
2227
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
2228
+ </xsl:for-each>
2229
+ </xsl:variable>
2230
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2231
+
2232
+ <xsl:for-each select="$root-style_/root-style/@*">
2233
+ <xsl:choose>
2234
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2235
+ <xsl:attribute name="{local-name()}">
2236
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2237
+ </xsl:attribute>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:copy-of select="."/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </xsl:for-each>
2244
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
2214
2245
 
2215
2246
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
2216
2247
 
@@ -2720,7 +2751,7 @@
2720
2751
 
2721
2752
 
2722
2753
 
2723
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2754
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2724
2755
 
2725
2756
 
2726
2757
 
@@ -5176,24 +5207,28 @@
5176
5207
  </xsl:template><xsl:template name="add-zero-spaces-equal">
5177
5208
  <xsl:param name="text" select="."/>
5178
5209
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
5210
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
5179
5211
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
5212
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
5180
5213
  <xsl:variable name="zero-space">​</xsl:variable>
5181
5214
  <xsl:choose>
5182
5215
  <xsl:when test="contains($text, $zero-space-after-equals)">
5183
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5216
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5184
5217
  <xsl:value-of select="$zero-space-after-equals"/>
5185
5218
  <xsl:value-of select="$zero-space"/>
5186
5219
  <xsl:call-template name="add-zero-spaces-equal">
5187
5220
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
5188
- </xsl:call-template>
5221
+ </xsl:call-template> -->
5222
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
5189
5223
  </xsl:when>
5190
5224
  <xsl:when test="contains($text, $zero-space-after-equal)">
5191
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5225
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5192
5226
  <xsl:value-of select="$zero-space-after-equal"/>
5193
5227
  <xsl:value-of select="$zero-space"/>
5194
5228
  <xsl:call-template name="add-zero-spaces-equal">
5195
5229
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
5196
- </xsl:call-template>
5230
+ </xsl:call-template> -->
5231
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
5197
5232
  </xsl:when>
5198
5233
  <xsl:otherwise>
5199
5234
  <xsl:value-of select="$text"/>
@@ -5673,7 +5708,12 @@
5673
5708
 
5674
5709
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5675
5710
 
5711
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5712
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5713
+ </xsl:if>
5714
+
5676
5715
 
5716
+
5677
5717
 
5678
5718
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5679
5719
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -6655,17 +6695,15 @@
6655
6695
 
6656
6696
  <!-- split text by zero-width space -->
6657
6697
  <xsl:variable name="text_step4">
6658
- <xsl:call-template name="split">
6698
+ <xsl:call-template name="split_for_interspers">
6659
6699
  <xsl:with-param name="pText" select="$text_step3"/>
6660
6700
  <xsl:with-param name="sep" select="$zero_width_space"/>
6661
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6662
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6663
6701
  </xsl:call-template>
6664
6702
  </xsl:variable>
6665
6703
 
6666
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6704
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6667
6705
  <xsl:choose>
6668
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6706
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6669
6707
  <xsl:call-template name="interspers">
6670
6708
  <xsl:with-param name="str" select="."/>
6671
6709
  </xsl:call-template>
@@ -6676,6 +6714,30 @@
6676
6714
  </xsl:choose>
6677
6715
  </xsl:for-each>
6678
6716
 
6717
+ </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">
6718
+ <xsl:param name="pText" select="."/>
6719
+ <xsl:param name="sep" select="','"/>
6720
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6721
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6722
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6723
+ <xsl:call-template name="replace_tag_interspers">
6724
+ <xsl:with-param name="text" select="$text"/>
6725
+ </xsl:call-template>
6726
+ </xsl:template><xsl:template name="replace_tag_interspers">
6727
+ <xsl:param name="text"/>
6728
+ <xsl:choose>
6729
+ <xsl:when test="contains($text, $interspers_tag_open)">
6730
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6731
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6732
+ <interspers>
6733
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6734
+ </interspers>
6735
+ <xsl:call-template name="replace_tag_interspers">
6736
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6737
+ </xsl:call-template>
6738
+ </xsl:when>
6739
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6740
+ </xsl:choose>
6679
6741
  </xsl:template><xsl:template name="interspers">
6680
6742
  <xsl:param name="str"/>
6681
6743
  <xsl:param name="char" select="$zero_width_space"/>
@@ -7123,7 +7185,7 @@
7123
7185
  </xsl:otherwise>
7124
7186
  </xsl:choose> -->
7125
7187
  </fo:block>
7126
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7188
+ </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">
7127
7189
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
7128
7190
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
7129
7191
  <xsl:if test="normalize-space() != ''">
@@ -114,21 +114,29 @@
114
114
 
115
115
  <xsl:template match="/">
116
116
  <xsl:call-template name="namespaceCheck"/>
117
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
118
- <!-- <xsl:if test="$lang != 'ar'">
119
- <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
120
- </xsl:if> -->
121
- <xsl:if test="$doctype = 'resolution'">
122
- <xsl:attribute name="font-size">11pt</xsl:attribute>
123
- </xsl:if>
124
- <xsl:if test="$doctype = 'service-publication'">
125
- <xsl:attribute name="font-size">11pt</xsl:attribute>
126
- <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
127
- </xsl:if>
128
- <xsl:call-template name="setWritingMode"/>
129
- <xsl:if test="$lang = 'ar'">
130
- <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
131
- </xsl:if>
117
+ <fo:root xml:lang="{$lang}">
118
+ <xsl:variable name="root-style">
119
+ <root-style xsl:use-attribute-sets="root-style">
120
+ <!-- <xsl:if test="$lang != 'ar'">
121
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
122
+ </xsl:if> -->
123
+ <xsl:if test="$doctype = 'resolution'">
124
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
125
+ </xsl:if>
126
+ <xsl:if test="$doctype = 'service-publication'">
127
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
128
+ <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
129
+ </xsl:if>
130
+ <xsl:call-template name="setWritingMode"/>
131
+ <xsl:if test="$lang = 'ar'">
132
+ <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
133
+ </xsl:if>
134
+ </root-style>
135
+ </xsl:variable>
136
+ <xsl:call-template name="insertRootStyle">
137
+ <xsl:with-param name="root-style" select="$root-style"/>
138
+ </xsl:call-template>
139
+
132
140
  <fo:layout-master-set>
133
141
 
134
142
  <!-- Technical Report first page -->
@@ -2210,7 +2218,30 @@
2210
2218
 
2211
2219
 
2212
2220
 
2213
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
2221
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
2222
+ <xsl:param name="root-style"/>
2223
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
2224
+
2225
+ <xsl:variable name="additional_fonts_">
2226
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
2227
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
2228
+ </xsl:for-each>
2229
+ </xsl:variable>
2230
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2231
+
2232
+ <xsl:for-each select="$root-style_/root-style/@*">
2233
+ <xsl:choose>
2234
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2235
+ <xsl:attribute name="{local-name()}">
2236
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2237
+ </xsl:attribute>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:copy-of select="."/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </xsl:for-each>
2244
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
2214
2245
 
2215
2246
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
2216
2247
 
@@ -2720,7 +2751,7 @@
2720
2751
 
2721
2752
 
2722
2753
 
2723
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2754
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2724
2755
 
2725
2756
 
2726
2757
 
@@ -5176,24 +5207,28 @@
5176
5207
  </xsl:template><xsl:template name="add-zero-spaces-equal">
5177
5208
  <xsl:param name="text" select="."/>
5178
5209
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
5210
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
5179
5211
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
5212
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
5180
5213
  <xsl:variable name="zero-space">​</xsl:variable>
5181
5214
  <xsl:choose>
5182
5215
  <xsl:when test="contains($text, $zero-space-after-equals)">
5183
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5216
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5184
5217
  <xsl:value-of select="$zero-space-after-equals"/>
5185
5218
  <xsl:value-of select="$zero-space"/>
5186
5219
  <xsl:call-template name="add-zero-spaces-equal">
5187
5220
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
5188
- </xsl:call-template>
5221
+ </xsl:call-template> -->
5222
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
5189
5223
  </xsl:when>
5190
5224
  <xsl:when test="contains($text, $zero-space-after-equal)">
5191
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5225
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5192
5226
  <xsl:value-of select="$zero-space-after-equal"/>
5193
5227
  <xsl:value-of select="$zero-space"/>
5194
5228
  <xsl:call-template name="add-zero-spaces-equal">
5195
5229
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
5196
- </xsl:call-template>
5230
+ </xsl:call-template> -->
5231
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
5197
5232
  </xsl:when>
5198
5233
  <xsl:otherwise>
5199
5234
  <xsl:value-of select="$text"/>
@@ -5673,7 +5708,12 @@
5673
5708
 
5674
5709
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5675
5710
 
5711
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5712
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5713
+ </xsl:if>
5714
+
5676
5715
 
5716
+
5677
5717
 
5678
5718
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5679
5719
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -6655,17 +6695,15 @@
6655
6695
 
6656
6696
  <!-- split text by zero-width space -->
6657
6697
  <xsl:variable name="text_step4">
6658
- <xsl:call-template name="split">
6698
+ <xsl:call-template name="split_for_interspers">
6659
6699
  <xsl:with-param name="pText" select="$text_step3"/>
6660
6700
  <xsl:with-param name="sep" select="$zero_width_space"/>
6661
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6662
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6663
6701
  </xsl:call-template>
6664
6702
  </xsl:variable>
6665
6703
 
6666
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6704
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6667
6705
  <xsl:choose>
6668
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6706
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6669
6707
  <xsl:call-template name="interspers">
6670
6708
  <xsl:with-param name="str" select="."/>
6671
6709
  </xsl:call-template>
@@ -6676,6 +6714,30 @@
6676
6714
  </xsl:choose>
6677
6715
  </xsl:for-each>
6678
6716
 
6717
+ </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">
6718
+ <xsl:param name="pText" select="."/>
6719
+ <xsl:param name="sep" select="','"/>
6720
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6721
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6722
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6723
+ <xsl:call-template name="replace_tag_interspers">
6724
+ <xsl:with-param name="text" select="$text"/>
6725
+ </xsl:call-template>
6726
+ </xsl:template><xsl:template name="replace_tag_interspers">
6727
+ <xsl:param name="text"/>
6728
+ <xsl:choose>
6729
+ <xsl:when test="contains($text, $interspers_tag_open)">
6730
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6731
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6732
+ <interspers>
6733
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6734
+ </interspers>
6735
+ <xsl:call-template name="replace_tag_interspers">
6736
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6737
+ </xsl:call-template>
6738
+ </xsl:when>
6739
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6740
+ </xsl:choose>
6679
6741
  </xsl:template><xsl:template name="interspers">
6680
6742
  <xsl:param name="str"/>
6681
6743
  <xsl:param name="char" select="$zero_width_space"/>
@@ -7123,7 +7185,7 @@
7123
7185
  </xsl:otherwise>
7124
7186
  </xsl:choose> -->
7125
7187
  </fo:block>
7126
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7188
+ </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">
7127
7189
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
7128
7190
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
7129
7191
  <xsl:if test="normalize-space() != ''">
@@ -114,21 +114,29 @@
114
114
 
115
115
  <xsl:template match="/">
116
116
  <xsl:call-template name="namespaceCheck"/>
117
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
118
- <!-- <xsl:if test="$lang != 'ar'">
119
- <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
120
- </xsl:if> -->
121
- <xsl:if test="$doctype = 'resolution'">
122
- <xsl:attribute name="font-size">11pt</xsl:attribute>
123
- </xsl:if>
124
- <xsl:if test="$doctype = 'service-publication'">
125
- <xsl:attribute name="font-size">11pt</xsl:attribute>
126
- <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
127
- </xsl:if>
128
- <xsl:call-template name="setWritingMode"/>
129
- <xsl:if test="$lang = 'ar'">
130
- <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
131
- </xsl:if>
117
+ <fo:root xml:lang="{$lang}">
118
+ <xsl:variable name="root-style">
119
+ <root-style xsl:use-attribute-sets="root-style">
120
+ <!-- <xsl:if test="$lang != 'ar'">
121
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
122
+ </xsl:if> -->
123
+ <xsl:if test="$doctype = 'resolution'">
124
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
125
+ </xsl:if>
126
+ <xsl:if test="$doctype = 'service-publication'">
127
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
128
+ <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
129
+ </xsl:if>
130
+ <xsl:call-template name="setWritingMode"/>
131
+ <xsl:if test="$lang = 'ar'">
132
+ <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
133
+ </xsl:if>
134
+ </root-style>
135
+ </xsl:variable>
136
+ <xsl:call-template name="insertRootStyle">
137
+ <xsl:with-param name="root-style" select="$root-style"/>
138
+ </xsl:call-template>
139
+
132
140
  <fo:layout-master-set>
133
141
 
134
142
  <!-- Technical Report first page -->
@@ -2210,7 +2218,30 @@
2210
2218
 
2211
2219
 
2212
2220
 
2213
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
2221
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
2222
+ <xsl:param name="root-style"/>
2223
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
2224
+
2225
+ <xsl:variable name="additional_fonts_">
2226
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
2227
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
2228
+ </xsl:for-each>
2229
+ </xsl:variable>
2230
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2231
+
2232
+ <xsl:for-each select="$root-style_/root-style/@*">
2233
+ <xsl:choose>
2234
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2235
+ <xsl:attribute name="{local-name()}">
2236
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2237
+ </xsl:attribute>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:copy-of select="."/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </xsl:for-each>
2244
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
2214
2245
 
2215
2246
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
2216
2247
 
@@ -2720,7 +2751,7 @@
2720
2751
 
2721
2752
 
2722
2753
 
2723
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2754
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2724
2755
 
2725
2756
 
2726
2757
 
@@ -5176,24 +5207,28 @@
5176
5207
  </xsl:template><xsl:template name="add-zero-spaces-equal">
5177
5208
  <xsl:param name="text" select="."/>
5178
5209
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
5210
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
5179
5211
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
5212
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
5180
5213
  <xsl:variable name="zero-space">​</xsl:variable>
5181
5214
  <xsl:choose>
5182
5215
  <xsl:when test="contains($text, $zero-space-after-equals)">
5183
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5216
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5184
5217
  <xsl:value-of select="$zero-space-after-equals"/>
5185
5218
  <xsl:value-of select="$zero-space"/>
5186
5219
  <xsl:call-template name="add-zero-spaces-equal">
5187
5220
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
5188
- </xsl:call-template>
5221
+ </xsl:call-template> -->
5222
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
5189
5223
  </xsl:when>
5190
5224
  <xsl:when test="contains($text, $zero-space-after-equal)">
5191
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5225
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5192
5226
  <xsl:value-of select="$zero-space-after-equal"/>
5193
5227
  <xsl:value-of select="$zero-space"/>
5194
5228
  <xsl:call-template name="add-zero-spaces-equal">
5195
5229
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
5196
- </xsl:call-template>
5230
+ </xsl:call-template> -->
5231
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
5197
5232
  </xsl:when>
5198
5233
  <xsl:otherwise>
5199
5234
  <xsl:value-of select="$text"/>
@@ -5673,7 +5708,12 @@
5673
5708
 
5674
5709
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5675
5710
 
5711
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5712
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5713
+ </xsl:if>
5714
+
5676
5715
 
5716
+
5677
5717
 
5678
5718
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5679
5719
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -6655,17 +6695,15 @@
6655
6695
 
6656
6696
  <!-- split text by zero-width space -->
6657
6697
  <xsl:variable name="text_step4">
6658
- <xsl:call-template name="split">
6698
+ <xsl:call-template name="split_for_interspers">
6659
6699
  <xsl:with-param name="pText" select="$text_step3"/>
6660
6700
  <xsl:with-param name="sep" select="$zero_width_space"/>
6661
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6662
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6663
6701
  </xsl:call-template>
6664
6702
  </xsl:variable>
6665
6703
 
6666
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6704
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6667
6705
  <xsl:choose>
6668
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6706
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6669
6707
  <xsl:call-template name="interspers">
6670
6708
  <xsl:with-param name="str" select="."/>
6671
6709
  </xsl:call-template>
@@ -6676,6 +6714,30 @@
6676
6714
  </xsl:choose>
6677
6715
  </xsl:for-each>
6678
6716
 
6717
+ </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">
6718
+ <xsl:param name="pText" select="."/>
6719
+ <xsl:param name="sep" select="','"/>
6720
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6721
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6722
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6723
+ <xsl:call-template name="replace_tag_interspers">
6724
+ <xsl:with-param name="text" select="$text"/>
6725
+ </xsl:call-template>
6726
+ </xsl:template><xsl:template name="replace_tag_interspers">
6727
+ <xsl:param name="text"/>
6728
+ <xsl:choose>
6729
+ <xsl:when test="contains($text, $interspers_tag_open)">
6730
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6731
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6732
+ <interspers>
6733
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6734
+ </interspers>
6735
+ <xsl:call-template name="replace_tag_interspers">
6736
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6737
+ </xsl:call-template>
6738
+ </xsl:when>
6739
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6740
+ </xsl:choose>
6679
6741
  </xsl:template><xsl:template name="interspers">
6680
6742
  <xsl:param name="str"/>
6681
6743
  <xsl:param name="char" select="$zero_width_space"/>
@@ -7123,7 +7185,7 @@
7123
7185
  </xsl:otherwise>
7124
7186
  </xsl:choose> -->
7125
7187
  </fo:block>
7126
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7188
+ </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">
7127
7189
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
7128
7190
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
7129
7191
  <xsl:if test="normalize-space() != ''">