metanorma-ogc 2.0.6 → 2.0.8.1

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: 61e36c2e89b6b98ad39875845197c8614cd4c1906f4d6f4e2359cc33c7933010
4
- data.tar.gz: 151018908ddb1823476252db5ea5a196854999365e34f678c47d9c5f3775c2a9
3
+ metadata.gz: 4976045f5f9e91f8e3063916d3c83b19eeddce73f7e599a00b7f0117a172a329
4
+ data.tar.gz: 431db0941bdfeef065773432b51817e74f32fbdc179ab1315f994106445db6fe
5
5
  SHA512:
6
- metadata.gz: 1ac0c8664160741ddaff9f625c64663338d6c1fd176f6b2d60f59d0810c3b448865cadeb5a15c1a269542cfce7fb98dc192b5a90a9dcb37d18e010db2f1127fc
7
- data.tar.gz: d9b93b3c092a5d9b57d6ce03b8cf865e82ae04f0cb1faaf9feb55a2b67f9827aa7a8a511c6afcbd8fc202c6d12e393f8e2f8e6008c249f9d19448d53af037326
6
+ metadata.gz: 3ce12d5dcb3f4c4020a22e8210a31c39d43d02af6b76099588456b50ac46fbe93cfad0dbe714cdef49295e87b94848899086b21a3c8e82144e2275252ff3bb3f
7
+ data.tar.gz: 055d3c4851ea3d1745a7742e07922ad961e91ecd3067178b7778ac1b15434cf781f9b2f319dca6309cf5845fd720e7774ede7326c421f48846b9eb62e0a51f7b
@@ -130,7 +130,13 @@
130
130
 
131
131
  <xsl:template match="/">
132
132
  <xsl:call-template name="namespaceCheck"/>
133
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
133
+ <fo:root xml:lang="{$lang}">
134
+ <xsl:variable name="root-style">
135
+ <root-style xsl:use-attribute-sets="root-style"/>
136
+ </xsl:variable>
137
+ <xsl:call-template name="insertRootStyle">
138
+ <xsl:with-param name="root-style" select="$root-style"/>
139
+ </xsl:call-template>
134
140
  <fo:layout-master-set>
135
141
  <!-- Cover page -->
136
142
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -1451,7 +1457,7 @@
1451
1457
  </fo:static-content>
1452
1458
  </xsl:template>
1453
1459
 
1454
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
1460
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
1455
1461
  <xsl:call-template name="getLang"/>
1456
1462
  </xsl:variable><xsl:variable name="pageWidth_">
1457
1463
  215.9
@@ -1604,7 +1610,30 @@
1604
1610
 
1605
1611
 
1606
1612
 
1607
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
1613
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
1614
+ <xsl:param name="root-style"/>
1615
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1616
+
1617
+ <xsl:variable name="additional_fonts_">
1618
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
1619
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1620
+ </xsl:for-each>
1621
+ </xsl:variable>
1622
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
1623
+
1624
+ <xsl:for-each select="$root-style_/root-style/@*">
1625
+ <xsl:choose>
1626
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1627
+ <xsl:attribute name="{local-name()}">
1628
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1629
+ </xsl:attribute>
1630
+ </xsl:when>
1631
+ <xsl:otherwise>
1632
+ <xsl:copy-of select="."/>
1633
+ </xsl:otherwise>
1634
+ </xsl:choose>
1635
+ </xsl:for-each>
1636
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
1608
1637
 
1609
1638
  <xsl:attribute name="font-size">8pt</xsl:attribute>
1610
1639
  <xsl:attribute name="line-height">125%</xsl:attribute>
@@ -2195,7 +2224,7 @@
2195
2224
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2196
2225
 
2197
2226
 
2198
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2227
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2199
2228
 
2200
2229
 
2201
2230
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -2930,8 +2959,27 @@
2930
2959
  <xsl:sort select="@displayorder" data-type="number"/>
2931
2960
  <xsl:apply-templates select="."/>
2932
2961
  </xsl:for-each>
2933
- </xsl:template><xsl:template match="text()">
2934
- <xsl:value-of select="."/>
2962
+ </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
2963
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2964
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2965
+ <xsl:call-template name="replace_fo_inline">
2966
+ <xsl:with-param name="text" select="$text"/>
2967
+ </xsl:call-template>
2968
+ </xsl:template><xsl:template name="replace_fo_inline">
2969
+ <xsl:param name="text"/>
2970
+ <xsl:choose>
2971
+ <xsl:when test="contains($text, $tag_open)">
2972
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
2973
+ <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2974
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2975
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2976
+ <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2977
+ <xsl:call-template name="replace_fo_inline">
2978
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2979
+ </xsl:call-template>
2980
+ </xsl:when>
2981
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
2982
+ </xsl:choose>
2935
2983
  </xsl:template><xsl:template match="*[local-name()='br']">
2936
2984
  <xsl:value-of select="$linebreak"/>
2937
2985
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
@@ -3018,9 +3066,11 @@
3018
3066
  <xsl:apply-templates/>
3019
3067
  </fo:block>
3020
3068
 
3021
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3022
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3023
- <xsl:call-template name="add-zero-spaces-java"/>
3069
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3070
+
3071
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3072
+ <xsl:call-template name="add-zero-spaces-java"/>
3073
+
3024
3074
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3025
3075
 
3026
3076
  <xsl:variable name="table-preamble">
@@ -3149,16 +3199,9 @@
3149
3199
  </xsl:for-each>
3150
3200
  </xsl:when>
3151
3201
  <xsl:otherwise>
3152
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3153
- <xsl:choose>
3154
- <xsl:when test=". = 1 or . = 0">
3155
- <fo:table-column column-width="proportional-column-width(2)"/>
3156
- </xsl:when>
3157
- <xsl:otherwise>
3158
- <fo:table-column column-width="proportional-column-width({.})"/>
3159
- </xsl:otherwise>
3160
- </xsl:choose>
3161
- </xsl:for-each>
3202
+ <xsl:call-template name="insertTableColumnWidth">
3203
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3204
+ </xsl:call-template>
3162
3205
  </xsl:otherwise>
3163
3206
  </xsl:choose>
3164
3207
 
@@ -3363,6 +3406,12 @@
3363
3406
  <xsl:with-param name="table" select="$table"/>
3364
3407
  </xsl:call-template>
3365
3408
  </xsl:if>
3409
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3410
+ <xsl:apply-templates mode="td_text"/>
3411
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3412
+
3413
+ <xsl:value-of select="."/>
3414
+
3366
3415
  </xsl:template><xsl:template match="text()" mode="td_text">
3367
3416
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3368
3417
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3464,16 +3513,9 @@
3464
3513
  </xsl:for-each>
3465
3514
  </xsl:when>
3466
3515
  <xsl:otherwise>
3467
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3468
- <xsl:choose>
3469
- <xsl:when test=". = 1 or . = 0">
3470
- <fo:table-column column-width="proportional-column-width(2)"/>
3471
- </xsl:when>
3472
- <xsl:otherwise>
3473
- <fo:table-column column-width="proportional-column-width({.})"/>
3474
- </xsl:otherwise>
3475
- </xsl:choose>
3476
- </xsl:for-each>
3516
+ <xsl:call-template name="insertTableColumnWidth">
3517
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3518
+ </xsl:call-template>
3477
3519
  </xsl:otherwise>
3478
3520
  </xsl:choose>
3479
3521
 
@@ -4128,9 +4170,15 @@
4128
4170
  <xsl:variable name="maxlength_dt">
4129
4171
  <xsl:call-template name="getMaxLength_dt"/>
4130
4172
  </xsl:variable>
4173
+ <xsl:variable name="isContainsExpressReference_">
4174
+ false
4175
+ </xsl:variable>
4176
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4177
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4131
4178
  <xsl:call-template name="setColumnWidth_dl">
4132
4179
  <xsl:with-param name="colwidths" select="$colwidths"/>
4133
4180
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4181
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4134
4182
  </xsl:call-template>
4135
4183
  <fo:table-body>
4136
4184
  <xsl:apply-templates>
@@ -4146,6 +4194,7 @@
4146
4194
  </xsl:template><xsl:template name="setColumnWidth_dl">
4147
4195
  <xsl:param name="colwidths"/>
4148
4196
  <xsl:param name="maxlength_dt"/>
4197
+ <xsl:param name="isContainsExpressReference"/>
4149
4198
  <xsl:choose>
4150
4199
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4151
4200
  <fo:table-column column-width="50%"/>
@@ -4153,6 +4202,11 @@
4153
4202
  </xsl:when>
4154
4203
  <xsl:otherwise>
4155
4204
  <xsl:choose>
4205
+ <xsl:when test="$isContainsExpressReference">
4206
+ <xsl:call-template name="insertTableColumnWidth">
4207
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4208
+ </xsl:call-template>
4209
+ </xsl:when>
4156
4210
  <!-- to set width check most wide chars like `W` -->
4157
4211
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4158
4212
  <fo:table-column column-width="7%"/>
@@ -4183,20 +4237,25 @@
4183
4237
  <fo:table-column column-width="60%"/>
4184
4238
  </xsl:when>
4185
4239
  <xsl:otherwise>
4186
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4187
- <xsl:choose>
4188
- <xsl:when test=". = 1 or . = 0">
4189
- <fo:table-column column-width="proportional-column-width(2)"/>
4190
- </xsl:when>
4191
- <xsl:otherwise>
4192
- <fo:table-column column-width="proportional-column-width({.})"/>
4193
- </xsl:otherwise>
4194
- </xsl:choose>
4195
- </xsl:for-each>
4240
+ <xsl:call-template name="insertTableColumnWidth">
4241
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4242
+ </xsl:call-template>
4196
4243
  </xsl:otherwise>
4197
4244
  </xsl:choose>
4198
4245
  </xsl:otherwise>
4199
4246
  </xsl:choose>
4247
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4248
+ <xsl:param name="colwidths"/>
4249
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4250
+ <xsl:choose>
4251
+ <xsl:when test=". = 1 or . = 0">
4252
+ <fo:table-column column-width="proportional-column-width(2)"/>
4253
+ </xsl:when>
4254
+ <xsl:otherwise>
4255
+ <fo:table-column column-width="proportional-column-width({.})"/>
4256
+ </xsl:otherwise>
4257
+ </xsl:choose>
4258
+ </xsl:for-each>
4200
4259
  </xsl:template><xsl:template name="getMaxLength_dt">
4201
4260
  <xsl:variable name="lengths">
4202
4261
  <xsl:for-each select="*[local-name()='dt']">
@@ -4615,24 +4674,28 @@
4615
4674
  </xsl:template><xsl:template name="add-zero-spaces-equal">
4616
4675
  <xsl:param name="text" select="."/>
4617
4676
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4677
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
4618
4678
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4679
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
4619
4680
  <xsl:variable name="zero-space">​</xsl:variable>
4620
4681
  <xsl:choose>
4621
4682
  <xsl:when test="contains($text, $zero-space-after-equals)">
4622
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4683
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4623
4684
  <xsl:value-of select="$zero-space-after-equals"/>
4624
4685
  <xsl:value-of select="$zero-space"/>
4625
4686
  <xsl:call-template name="add-zero-spaces-equal">
4626
4687
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
4627
- </xsl:call-template>
4688
+ </xsl:call-template> -->
4689
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
4628
4690
  </xsl:when>
4629
4691
  <xsl:when test="contains($text, $zero-space-after-equal)">
4630
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4692
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4631
4693
  <xsl:value-of select="$zero-space-after-equal"/>
4632
4694
  <xsl:value-of select="$zero-space"/>
4633
4695
  <xsl:call-template name="add-zero-spaces-equal">
4634
4696
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
4635
- </xsl:call-template>
4697
+ </xsl:call-template> -->
4698
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
4636
4699
  </xsl:when>
4637
4700
  <xsl:otherwise>
4638
4701
  <xsl:value-of select="$text"/>
@@ -4800,6 +4863,9 @@
4800
4863
  <xsl:variable name="isDeleted" select="@deleted"/>
4801
4864
 
4802
4865
  <fo:inline xsl:use-attribute-sets="mathml-style">
4866
+
4867
+
4868
+
4803
4869
 
4804
4870
 
4805
4871
  <xsl:call-template name="setTrackChangesStyles">
@@ -4807,48 +4873,80 @@
4807
4873
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4808
4874
  </xsl:call-template>
4809
4875
 
4876
+ <xsl:if test="$add_math_as_text = 'true'">
4877
+ <!-- insert helper tag -->
4878
+ <!-- set unique font-size (fiction) -->
4879
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4880
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
4881
+ </xsl:if>
4810
4882
 
4811
-
4812
- <xsl:variable name="mathml">
4813
- <xsl:apply-templates select="." mode="mathml"/>
4883
+ <xsl:variable name="mathml_content">
4884
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4814
4885
  </xsl:variable>
4815
- <fo:instream-foreign-object fox:alt-text="Math">
4816
4886
 
4887
+
4888
+ <xsl:call-template name="mathml_instream_object">
4889
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4890
+ </xsl:call-template>
4817
4891
 
4818
-
4819
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4820
- <xsl:variable name="comment_text_">
4821
- <xsl:choose>
4822
- <xsl:when test="normalize-space($comment_text_following) != ''">
4823
- <xsl:value-of select="$comment_text_following"/>
4824
- </xsl:when>
4825
- <xsl:otherwise>
4826
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4827
- </xsl:otherwise>
4828
- </xsl:choose>
4829
- </xsl:variable>
4830
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4831
-
4832
- <xsl:if test="normalize-space($comment_text) != ''">
4833
- <!-- put Mathin Alternate Text -->
4834
- <xsl:attribute name="fox:alt-text">
4835
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4836
- </xsl:attribute>
4837
- </xsl:if>
4838
-
4839
- <xsl:variable name="mathml_content">
4840
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4841
- </xsl:variable>
4842
- <!-- put MathML in Actual Text -->
4843
- <xsl:attribute name="fox:actual-text">
4844
- <xsl:value-of select="$mathml_content"/>
4845
- </xsl:attribute>
4846
-
4847
-
4848
-
4849
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4850
- </fo:instream-foreign-object>
4892
+
4851
4893
  </fo:inline>
4894
+ </xsl:template><xsl:template name="getMathml_comment_text">
4895
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4896
+ <xsl:variable name="comment_text_">
4897
+ <xsl:choose>
4898
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4899
+ <xsl:value-of select="$comment_text_following"/>
4900
+ </xsl:when>
4901
+ <xsl:otherwise>
4902
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4903
+ </xsl:otherwise>
4904
+ </xsl:choose>
4905
+ </xsl:variable>
4906
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4907
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4908
+ <xsl:value-of select="$comment_text"/>
4909
+ </xsl:template><xsl:template name="mathml_instream_object">
4910
+ <xsl:param name="comment_text"/>
4911
+ <xsl:param name="mathml_content"/>
4912
+
4913
+ <xsl:variable name="comment_text_">
4914
+ <xsl:choose>
4915
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4916
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4917
+ </xsl:choose>
4918
+ </xsl:variable>
4919
+
4920
+ <xsl:variable name="mathml">
4921
+ <xsl:apply-templates select="." mode="mathml"/>
4922
+ </xsl:variable>
4923
+
4924
+ <fo:instream-foreign-object fox:alt-text="Math">
4925
+
4926
+
4927
+
4928
+
4929
+
4930
+
4931
+
4932
+ <!-- put MathML in Actual Text -->
4933
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4934
+ <xsl:attribute name="fox:actual-text">
4935
+ <xsl:value-of select="$mathml_content"/>
4936
+ </xsl:attribute>
4937
+
4938
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4939
+ <xsl:if test="normalize-space($comment_text_) != ''">
4940
+ <!-- put Mathin Alternate Text -->
4941
+ <xsl:attribute name="fox:alt-text">
4942
+ <xsl:value-of select="$comment_text_"/>
4943
+ </xsl:attribute>
4944
+ </xsl:if>
4945
+ <!-- </xsl:if> -->
4946
+
4947
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4948
+
4949
+ </fo:instream-foreign-object>
4852
4950
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4853
4951
  <!-- <xsl:text>a+b</xsl:text> -->
4854
4952
  <xsl:text>&lt;</xsl:text>
@@ -5112,7 +5210,12 @@
5112
5210
 
5113
5211
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5114
5212
 
5213
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5214
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5215
+ </xsl:if>
5216
+
5115
5217
 
5218
+
5116
5219
 
5117
5220
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5118
5221
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5475,18 +5578,33 @@
5475
5578
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5476
5579
  <xsl:copy>
5477
5580
  <xsl:apply-templates select="@*" mode="svg_update"/>
5478
- <xsl:variable name="viewbox">
5581
+ <xsl:variable name="viewbox_">
5479
5582
  <xsl:call-template name="split">
5480
5583
  <xsl:with-param name="pText" select="@viewBox"/>
5481
5584
  <xsl:with-param name="sep" select="' '"/>
5482
5585
  </xsl:call-template>
5483
5586
  </xsl:variable>
5587
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5588
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5589
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5590
+
5484
5591
  <xsl:attribute name="width">
5485
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5592
+ <xsl:choose>
5593
+ <xsl:when test="$width != ''">
5594
+ <xsl:value-of select="round($width)"/>
5595
+ </xsl:when>
5596
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5597
+ </xsl:choose>
5486
5598
  </xsl:attribute>
5487
5599
  <xsl:attribute name="height">
5488
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5600
+ <xsl:choose>
5601
+ <xsl:when test="$height != ''">
5602
+ <xsl:value-of select="round($height)"/>
5603
+ </xsl:when>
5604
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5605
+ </xsl:choose>
5489
5606
  </xsl:attribute>
5607
+
5490
5608
  <xsl:apply-templates mode="svg_update"/>
5491
5609
  </xsl:copy>
5492
5610
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -6121,17 +6239,15 @@
6121
6239
 
6122
6240
  <!-- split text by zero-width space -->
6123
6241
  <xsl:variable name="text_step4">
6124
- <xsl:call-template name="split">
6242
+ <xsl:call-template name="split_for_interspers">
6125
6243
  <xsl:with-param name="pText" select="$text_step3"/>
6126
6244
  <xsl:with-param name="sep" select="$zero_width_space"/>
6127
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6128
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6129
6245
  </xsl:call-template>
6130
6246
  </xsl:variable>
6131
6247
 
6132
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6248
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6133
6249
  <xsl:choose>
6134
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6250
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6135
6251
  <xsl:call-template name="interspers">
6136
6252
  <xsl:with-param name="str" select="."/>
6137
6253
  </xsl:call-template>
@@ -6142,6 +6258,30 @@
6142
6258
  </xsl:choose>
6143
6259
  </xsl:for-each>
6144
6260
 
6261
+ </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">
6262
+ <xsl:param name="pText" select="."/>
6263
+ <xsl:param name="sep" select="','"/>
6264
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6265
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6266
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6267
+ <xsl:call-template name="replace_tag_interspers">
6268
+ <xsl:with-param name="text" select="$text"/>
6269
+ </xsl:call-template>
6270
+ </xsl:template><xsl:template name="replace_tag_interspers">
6271
+ <xsl:param name="text"/>
6272
+ <xsl:choose>
6273
+ <xsl:when test="contains($text, $interspers_tag_open)">
6274
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6275
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6276
+ <interspers>
6277
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6278
+ </interspers>
6279
+ <xsl:call-template name="replace_tag_interspers">
6280
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6281
+ </xsl:call-template>
6282
+ </xsl:when>
6283
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6284
+ </xsl:choose>
6145
6285
  </xsl:template><xsl:template name="interspers">
6146
6286
  <xsl:param name="str"/>
6147
6287
  <xsl:param name="char" select="$zero_width_space"/>
@@ -6599,7 +6739,7 @@
6599
6739
  </xsl:otherwise>
6600
6740
  </xsl:choose> -->
6601
6741
  </fo:block>
6602
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6742
+ </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">
6603
6743
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6604
6744
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6605
6745
  <xsl:if test="normalize-space() != ''">
@@ -6635,7 +6775,8 @@
6635
6775
  <fo:inline><xsl:apply-templates/></fo:inline>
6636
6776
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
6637
6777
  <xsl:if test="normalize-space() != ''">
6638
- <xsl:value-of select="."/>
6778
+ <!-- <xsl:value-of select="."/> -->
6779
+ <xsl:call-template name="text"/>
6639
6780
  </xsl:if>
6640
6781
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
6641
6782
  <fo:block-container margin-left="0mm">