metanorma-mpfa 0.8.7 → 0.8.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: 202067696e0d6b20293ca309743593c0f8b3eec1e8f3c06b903e54dcb141f447
4
- data.tar.gz: 9b6258ea772e6de5769c4bd60a766dfd10836ff93cac7b1335c990715f1fb41f
3
+ metadata.gz: 16af01006c9ba1b937162a084406d3e5423cc88fff68cd9d63bfcd171dc55f04
4
+ data.tar.gz: 7c0ed6a1fe246257a76c3ce439e0ab6bf03fb8dd88842958b2263cd4a43fb73f
5
5
  SHA512:
6
- metadata.gz: b5aca5e286b07b55aaba0f1ee9093602f807d3c22c887f1487146252d04b0a130061b65a89924c8e3676725f8189c0c7e18846d8af796b880877495a86d47bca
7
- data.tar.gz: 4d154851ff7f268dcf7ab2cff29368067bd073d51726fec8bd3ad1c64472c61e06d826328f6bf692a533e387f97e23607461b5585d5a212f5e90b6dc5709b5b4
6
+ metadata.gz: a655d6eabf158f72d72b2c44eba937d3c4e2338ffe088f0467fd7c40234092a6e2eaea3adc9c39c99c7eb6d99a10de238593870de8dade3a2d6c5e8840eb5f8a
7
+ data.tar.gz: 8a71300c8ad615ddd9b932fa5e7929e900d35ff5a1f2fca9941344d43f63b6ba8c5936af009e86e8cc39e1e33757874bf9336a22a91244c85b855b5ed6e2463a
@@ -50,7 +50,13 @@
50
50
 
51
51
  <xsl:template match="/">
52
52
  <xsl:call-template name="namespaceCheck"/>
53
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
53
+ <fo:root xml:lang="{$lang}">
54
+ <xsl:variable name="root-style">
55
+ <root-style xsl:use-attribute-sets="root-style"/>
56
+ </xsl:variable>
57
+ <xsl:call-template name="insertRootStyle">
58
+ <xsl:with-param name="root-style" select="$root-style"/>
59
+ </xsl:call-template>
54
60
  <fo:layout-master-set>
55
61
 
56
62
  <!-- cover page -->
@@ -722,7 +728,30 @@
722
728
 
723
729
 
724
730
 
725
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
731
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
732
+ <xsl:param name="root-style"/>
733
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
734
+
735
+ <xsl:variable name="additional_fonts_">
736
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
737
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
738
+ </xsl:for-each>
739
+ </xsl:variable>
740
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
741
+
742
+ <xsl:for-each select="$root-style_/root-style/@*">
743
+ <xsl:choose>
744
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
745
+ <xsl:attribute name="{local-name()}">
746
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
747
+ </xsl:attribute>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <xsl:copy-of select="."/>
751
+ </xsl:otherwise>
752
+ </xsl:choose>
753
+ </xsl:for-each>
754
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
726
755
 
727
756
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
728
757
 
@@ -1211,7 +1240,7 @@
1211
1240
 
1212
1241
 
1213
1242
 
1214
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1243
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1215
1244
 
1216
1245
 
1217
1246
 
@@ -3558,24 +3587,28 @@
3558
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3559
3588
  <xsl:param name="text" select="."/>
3560
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3561
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3562
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3563
3594
  <xsl:choose>
3564
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3565
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3566
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3567
3598
  <xsl:value-of select="$zero-space"/>
3568
3599
  <xsl:call-template name="add-zero-spaces-equal">
3569
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3570
- </xsl:call-template>
3601
+ </xsl:call-template> -->
3602
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3571
3603
  </xsl:when>
3572
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3573
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3574
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3575
3607
  <xsl:value-of select="$zero-space"/>
3576
3608
  <xsl:call-template name="add-zero-spaces-equal">
3577
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3578
- </xsl:call-template>
3610
+ </xsl:call-template> -->
3611
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3579
3612
  </xsl:when>
3580
3613
  <xsl:otherwise>
3581
3614
  <xsl:value-of select="$text"/>
@@ -4051,7 +4084,12 @@
4051
4084
 
4052
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4053
4086
 
4087
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4088
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4089
+ </xsl:if>
4090
+
4054
4091
 
4092
+
4055
4093
 
4056
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4057
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5029,17 +5067,15 @@
5029
5067
 
5030
5068
  <!-- split text by zero-width space -->
5031
5069
  <xsl:variable name="text_step4">
5032
- <xsl:call-template name="split">
5070
+ <xsl:call-template name="split_for_interspers">
5033
5071
  <xsl:with-param name="pText" select="$text_step3"/>
5034
5072
  <xsl:with-param name="sep" select="$zero_width_space"/>
5035
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5036
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5037
5073
  </xsl:call-template>
5038
5074
  </xsl:variable>
5039
5075
 
5040
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5041
5077
  <xsl:choose>
5042
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5043
5079
  <xsl:call-template name="interspers">
5044
5080
  <xsl:with-param name="str" select="."/>
5045
5081
  </xsl:call-template>
@@ -5050,6 +5086,30 @@
5050
5086
  </xsl:choose>
5051
5087
  </xsl:for-each>
5052
5088
 
5089
+ </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">
5090
+ <xsl:param name="pText" select="."/>
5091
+ <xsl:param name="sep" select="','"/>
5092
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5093
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5094
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5095
+ <xsl:call-template name="replace_tag_interspers">
5096
+ <xsl:with-param name="text" select="$text"/>
5097
+ </xsl:call-template>
5098
+ </xsl:template><xsl:template name="replace_tag_interspers">
5099
+ <xsl:param name="text"/>
5100
+ <xsl:choose>
5101
+ <xsl:when test="contains($text, $interspers_tag_open)">
5102
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5103
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5104
+ <interspers>
5105
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5106
+ </interspers>
5107
+ <xsl:call-template name="replace_tag_interspers">
5108
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5109
+ </xsl:call-template>
5110
+ </xsl:when>
5111
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5112
+ </xsl:choose>
5053
5113
  </xsl:template><xsl:template name="interspers">
5054
5114
  <xsl:param name="str"/>
5055
5115
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5497,7 +5557,7 @@
5497
5557
  </xsl:otherwise>
5498
5558
  </xsl:choose> -->
5499
5559
  </fo:block>
5500
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5560
+ </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">
5501
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5502
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5503
5563
  <xsl:if test="normalize-space() != ''">
@@ -50,7 +50,13 @@
50
50
 
51
51
  <xsl:template match="/">
52
52
  <xsl:call-template name="namespaceCheck"/>
53
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
53
+ <fo:root xml:lang="{$lang}">
54
+ <xsl:variable name="root-style">
55
+ <root-style xsl:use-attribute-sets="root-style"/>
56
+ </xsl:variable>
57
+ <xsl:call-template name="insertRootStyle">
58
+ <xsl:with-param name="root-style" select="$root-style"/>
59
+ </xsl:call-template>
54
60
  <fo:layout-master-set>
55
61
 
56
62
  <!-- cover page -->
@@ -722,7 +728,30 @@
722
728
 
723
729
 
724
730
 
725
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
731
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
732
+ <xsl:param name="root-style"/>
733
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
734
+
735
+ <xsl:variable name="additional_fonts_">
736
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
737
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
738
+ </xsl:for-each>
739
+ </xsl:variable>
740
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
741
+
742
+ <xsl:for-each select="$root-style_/root-style/@*">
743
+ <xsl:choose>
744
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
745
+ <xsl:attribute name="{local-name()}">
746
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
747
+ </xsl:attribute>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <xsl:copy-of select="."/>
751
+ </xsl:otherwise>
752
+ </xsl:choose>
753
+ </xsl:for-each>
754
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
726
755
 
727
756
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
728
757
 
@@ -1211,7 +1240,7 @@
1211
1240
 
1212
1241
 
1213
1242
 
1214
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1243
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1215
1244
 
1216
1245
 
1217
1246
 
@@ -3558,24 +3587,28 @@
3558
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3559
3588
  <xsl:param name="text" select="."/>
3560
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3561
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3562
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3563
3594
  <xsl:choose>
3564
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3565
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3566
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3567
3598
  <xsl:value-of select="$zero-space"/>
3568
3599
  <xsl:call-template name="add-zero-spaces-equal">
3569
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3570
- </xsl:call-template>
3601
+ </xsl:call-template> -->
3602
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3571
3603
  </xsl:when>
3572
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3573
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3574
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3575
3607
  <xsl:value-of select="$zero-space"/>
3576
3608
  <xsl:call-template name="add-zero-spaces-equal">
3577
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3578
- </xsl:call-template>
3610
+ </xsl:call-template> -->
3611
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3579
3612
  </xsl:when>
3580
3613
  <xsl:otherwise>
3581
3614
  <xsl:value-of select="$text"/>
@@ -4051,7 +4084,12 @@
4051
4084
 
4052
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4053
4086
 
4087
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4088
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4089
+ </xsl:if>
4090
+
4054
4091
 
4092
+
4055
4093
 
4056
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4057
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5029,17 +5067,15 @@
5029
5067
 
5030
5068
  <!-- split text by zero-width space -->
5031
5069
  <xsl:variable name="text_step4">
5032
- <xsl:call-template name="split">
5070
+ <xsl:call-template name="split_for_interspers">
5033
5071
  <xsl:with-param name="pText" select="$text_step3"/>
5034
5072
  <xsl:with-param name="sep" select="$zero_width_space"/>
5035
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5036
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5037
5073
  </xsl:call-template>
5038
5074
  </xsl:variable>
5039
5075
 
5040
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5041
5077
  <xsl:choose>
5042
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5043
5079
  <xsl:call-template name="interspers">
5044
5080
  <xsl:with-param name="str" select="."/>
5045
5081
  </xsl:call-template>
@@ -5050,6 +5086,30 @@
5050
5086
  </xsl:choose>
5051
5087
  </xsl:for-each>
5052
5088
 
5089
+ </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">
5090
+ <xsl:param name="pText" select="."/>
5091
+ <xsl:param name="sep" select="','"/>
5092
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5093
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5094
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5095
+ <xsl:call-template name="replace_tag_interspers">
5096
+ <xsl:with-param name="text" select="$text"/>
5097
+ </xsl:call-template>
5098
+ </xsl:template><xsl:template name="replace_tag_interspers">
5099
+ <xsl:param name="text"/>
5100
+ <xsl:choose>
5101
+ <xsl:when test="contains($text, $interspers_tag_open)">
5102
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5103
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5104
+ <interspers>
5105
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5106
+ </interspers>
5107
+ <xsl:call-template name="replace_tag_interspers">
5108
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5109
+ </xsl:call-template>
5110
+ </xsl:when>
5111
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5112
+ </xsl:choose>
5053
5113
  </xsl:template><xsl:template name="interspers">
5054
5114
  <xsl:param name="str"/>
5055
5115
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5497,7 +5557,7 @@
5497
5557
  </xsl:otherwise>
5498
5558
  </xsl:choose> -->
5499
5559
  </fo:block>
5500
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5560
+ </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">
5501
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5502
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5503
5563
  <xsl:if test="normalize-space() != ''">
@@ -50,7 +50,13 @@
50
50
 
51
51
  <xsl:template match="/">
52
52
  <xsl:call-template name="namespaceCheck"/>
53
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
53
+ <fo:root xml:lang="{$lang}">
54
+ <xsl:variable name="root-style">
55
+ <root-style xsl:use-attribute-sets="root-style"/>
56
+ </xsl:variable>
57
+ <xsl:call-template name="insertRootStyle">
58
+ <xsl:with-param name="root-style" select="$root-style"/>
59
+ </xsl:call-template>
54
60
  <fo:layout-master-set>
55
61
 
56
62
  <!-- cover page -->
@@ -722,7 +728,30 @@
722
728
 
723
729
 
724
730
 
725
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
731
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
732
+ <xsl:param name="root-style"/>
733
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
734
+
735
+ <xsl:variable name="additional_fonts_">
736
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
737
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
738
+ </xsl:for-each>
739
+ </xsl:variable>
740
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
741
+
742
+ <xsl:for-each select="$root-style_/root-style/@*">
743
+ <xsl:choose>
744
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
745
+ <xsl:attribute name="{local-name()}">
746
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
747
+ </xsl:attribute>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <xsl:copy-of select="."/>
751
+ </xsl:otherwise>
752
+ </xsl:choose>
753
+ </xsl:for-each>
754
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
726
755
 
727
756
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
728
757
 
@@ -1211,7 +1240,7 @@
1211
1240
 
1212
1241
 
1213
1242
 
1214
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1243
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1215
1244
 
1216
1245
 
1217
1246
 
@@ -3558,24 +3587,28 @@
3558
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3559
3588
  <xsl:param name="text" select="."/>
3560
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3561
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3562
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3563
3594
  <xsl:choose>
3564
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3565
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3566
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3567
3598
  <xsl:value-of select="$zero-space"/>
3568
3599
  <xsl:call-template name="add-zero-spaces-equal">
3569
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3570
- </xsl:call-template>
3601
+ </xsl:call-template> -->
3602
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3571
3603
  </xsl:when>
3572
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3573
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3574
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3575
3607
  <xsl:value-of select="$zero-space"/>
3576
3608
  <xsl:call-template name="add-zero-spaces-equal">
3577
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3578
- </xsl:call-template>
3610
+ </xsl:call-template> -->
3611
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3579
3612
  </xsl:when>
3580
3613
  <xsl:otherwise>
3581
3614
  <xsl:value-of select="$text"/>
@@ -4051,7 +4084,12 @@
4051
4084
 
4052
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4053
4086
 
4087
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4088
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4089
+ </xsl:if>
4090
+
4054
4091
 
4092
+
4055
4093
 
4056
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4057
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5029,17 +5067,15 @@
5029
5067
 
5030
5068
  <!-- split text by zero-width space -->
5031
5069
  <xsl:variable name="text_step4">
5032
- <xsl:call-template name="split">
5070
+ <xsl:call-template name="split_for_interspers">
5033
5071
  <xsl:with-param name="pText" select="$text_step3"/>
5034
5072
  <xsl:with-param name="sep" select="$zero_width_space"/>
5035
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5036
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5037
5073
  </xsl:call-template>
5038
5074
  </xsl:variable>
5039
5075
 
5040
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5041
5077
  <xsl:choose>
5042
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5043
5079
  <xsl:call-template name="interspers">
5044
5080
  <xsl:with-param name="str" select="."/>
5045
5081
  </xsl:call-template>
@@ -5050,6 +5086,30 @@
5050
5086
  </xsl:choose>
5051
5087
  </xsl:for-each>
5052
5088
 
5089
+ </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">
5090
+ <xsl:param name="pText" select="."/>
5091
+ <xsl:param name="sep" select="','"/>
5092
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5093
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5094
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5095
+ <xsl:call-template name="replace_tag_interspers">
5096
+ <xsl:with-param name="text" select="$text"/>
5097
+ </xsl:call-template>
5098
+ </xsl:template><xsl:template name="replace_tag_interspers">
5099
+ <xsl:param name="text"/>
5100
+ <xsl:choose>
5101
+ <xsl:when test="contains($text, $interspers_tag_open)">
5102
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5103
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5104
+ <interspers>
5105
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5106
+ </interspers>
5107
+ <xsl:call-template name="replace_tag_interspers">
5108
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5109
+ </xsl:call-template>
5110
+ </xsl:when>
5111
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5112
+ </xsl:choose>
5053
5113
  </xsl:template><xsl:template name="interspers">
5054
5114
  <xsl:param name="str"/>
5055
5115
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5497,7 +5557,7 @@
5497
5557
  </xsl:otherwise>
5498
5558
  </xsl:choose> -->
5499
5559
  </fo:block>
5500
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5560
+ </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">
5501
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5502
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5503
5563
  <xsl:if test="normalize-space() != ''">
@@ -50,7 +50,13 @@
50
50
 
51
51
  <xsl:template match="/">
52
52
  <xsl:call-template name="namespaceCheck"/>
53
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
53
+ <fo:root xml:lang="{$lang}">
54
+ <xsl:variable name="root-style">
55
+ <root-style xsl:use-attribute-sets="root-style"/>
56
+ </xsl:variable>
57
+ <xsl:call-template name="insertRootStyle">
58
+ <xsl:with-param name="root-style" select="$root-style"/>
59
+ </xsl:call-template>
54
60
  <fo:layout-master-set>
55
61
 
56
62
  <!-- cover page -->
@@ -722,7 +728,30 @@
722
728
 
723
729
 
724
730
 
725
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
731
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
732
+ <xsl:param name="root-style"/>
733
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
734
+
735
+ <xsl:variable name="additional_fonts_">
736
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
737
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
738
+ </xsl:for-each>
739
+ </xsl:variable>
740
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
741
+
742
+ <xsl:for-each select="$root-style_/root-style/@*">
743
+ <xsl:choose>
744
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
745
+ <xsl:attribute name="{local-name()}">
746
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
747
+ </xsl:attribute>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <xsl:copy-of select="."/>
751
+ </xsl:otherwise>
752
+ </xsl:choose>
753
+ </xsl:for-each>
754
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
726
755
 
727
756
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
728
757
 
@@ -1211,7 +1240,7 @@
1211
1240
 
1212
1241
 
1213
1242
 
1214
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1243
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1215
1244
 
1216
1245
 
1217
1246
 
@@ -3558,24 +3587,28 @@
3558
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3559
3588
  <xsl:param name="text" select="."/>
3560
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3561
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3562
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3563
3594
  <xsl:choose>
3564
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3565
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3566
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3567
3598
  <xsl:value-of select="$zero-space"/>
3568
3599
  <xsl:call-template name="add-zero-spaces-equal">
3569
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3570
- </xsl:call-template>
3601
+ </xsl:call-template> -->
3602
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3571
3603
  </xsl:when>
3572
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3573
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3574
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3575
3607
  <xsl:value-of select="$zero-space"/>
3576
3608
  <xsl:call-template name="add-zero-spaces-equal">
3577
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3578
- </xsl:call-template>
3610
+ </xsl:call-template> -->
3611
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3579
3612
  </xsl:when>
3580
3613
  <xsl:otherwise>
3581
3614
  <xsl:value-of select="$text"/>
@@ -4051,7 +4084,12 @@
4051
4084
 
4052
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4053
4086
 
4087
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4088
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4089
+ </xsl:if>
4090
+
4054
4091
 
4092
+
4055
4093
 
4056
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4057
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5029,17 +5067,15 @@
5029
5067
 
5030
5068
  <!-- split text by zero-width space -->
5031
5069
  <xsl:variable name="text_step4">
5032
- <xsl:call-template name="split">
5070
+ <xsl:call-template name="split_for_interspers">
5033
5071
  <xsl:with-param name="pText" select="$text_step3"/>
5034
5072
  <xsl:with-param name="sep" select="$zero_width_space"/>
5035
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5036
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5037
5073
  </xsl:call-template>
5038
5074
  </xsl:variable>
5039
5075
 
5040
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5041
5077
  <xsl:choose>
5042
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5043
5079
  <xsl:call-template name="interspers">
5044
5080
  <xsl:with-param name="str" select="."/>
5045
5081
  </xsl:call-template>
@@ -5050,6 +5086,30 @@
5050
5086
  </xsl:choose>
5051
5087
  </xsl:for-each>
5052
5088
 
5089
+ </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">
5090
+ <xsl:param name="pText" select="."/>
5091
+ <xsl:param name="sep" select="','"/>
5092
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5093
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5094
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5095
+ <xsl:call-template name="replace_tag_interspers">
5096
+ <xsl:with-param name="text" select="$text"/>
5097
+ </xsl:call-template>
5098
+ </xsl:template><xsl:template name="replace_tag_interspers">
5099
+ <xsl:param name="text"/>
5100
+ <xsl:choose>
5101
+ <xsl:when test="contains($text, $interspers_tag_open)">
5102
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5103
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5104
+ <interspers>
5105
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5106
+ </interspers>
5107
+ <xsl:call-template name="replace_tag_interspers">
5108
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5109
+ </xsl:call-template>
5110
+ </xsl:when>
5111
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5112
+ </xsl:choose>
5053
5113
  </xsl:template><xsl:template name="interspers">
5054
5114
  <xsl:param name="str"/>
5055
5115
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5497,7 +5557,7 @@
5497
5557
  </xsl:otherwise>
5498
5558
  </xsl:choose> -->
5499
5559
  </fo:block>
5500
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5560
+ </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">
5501
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5502
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5503
5563
  <xsl:if test="normalize-space() != ''">
@@ -50,7 +50,13 @@
50
50
 
51
51
  <xsl:template match="/">
52
52
  <xsl:call-template name="namespaceCheck"/>
53
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
53
+ <fo:root xml:lang="{$lang}">
54
+ <xsl:variable name="root-style">
55
+ <root-style xsl:use-attribute-sets="root-style"/>
56
+ </xsl:variable>
57
+ <xsl:call-template name="insertRootStyle">
58
+ <xsl:with-param name="root-style" select="$root-style"/>
59
+ </xsl:call-template>
54
60
  <fo:layout-master-set>
55
61
 
56
62
  <!-- cover page -->
@@ -722,7 +728,30 @@
722
728
 
723
729
 
724
730
 
725
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
731
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
732
+ <xsl:param name="root-style"/>
733
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
734
+
735
+ <xsl:variable name="additional_fonts_">
736
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
737
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
738
+ </xsl:for-each>
739
+ </xsl:variable>
740
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
741
+
742
+ <xsl:for-each select="$root-style_/root-style/@*">
743
+ <xsl:choose>
744
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
745
+ <xsl:attribute name="{local-name()}">
746
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
747
+ </xsl:attribute>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <xsl:copy-of select="."/>
751
+ </xsl:otherwise>
752
+ </xsl:choose>
753
+ </xsl:for-each>
754
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
726
755
 
727
756
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
728
757
 
@@ -1211,7 +1240,7 @@
1211
1240
 
1212
1241
 
1213
1242
 
1214
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1243
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1215
1244
 
1216
1245
 
1217
1246
 
@@ -3558,24 +3587,28 @@
3558
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3559
3588
  <xsl:param name="text" select="."/>
3560
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3561
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3562
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3563
3594
  <xsl:choose>
3564
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3565
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3566
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3567
3598
  <xsl:value-of select="$zero-space"/>
3568
3599
  <xsl:call-template name="add-zero-spaces-equal">
3569
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3570
- </xsl:call-template>
3601
+ </xsl:call-template> -->
3602
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3571
3603
  </xsl:when>
3572
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3573
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3574
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3575
3607
  <xsl:value-of select="$zero-space"/>
3576
3608
  <xsl:call-template name="add-zero-spaces-equal">
3577
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3578
- </xsl:call-template>
3610
+ </xsl:call-template> -->
3611
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3579
3612
  </xsl:when>
3580
3613
  <xsl:otherwise>
3581
3614
  <xsl:value-of select="$text"/>
@@ -4051,7 +4084,12 @@
4051
4084
 
4052
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4053
4086
 
4087
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4088
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4089
+ </xsl:if>
4090
+
4054
4091
 
4092
+
4055
4093
 
4056
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4057
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5029,17 +5067,15 @@
5029
5067
 
5030
5068
  <!-- split text by zero-width space -->
5031
5069
  <xsl:variable name="text_step4">
5032
- <xsl:call-template name="split">
5070
+ <xsl:call-template name="split_for_interspers">
5033
5071
  <xsl:with-param name="pText" select="$text_step3"/>
5034
5072
  <xsl:with-param name="sep" select="$zero_width_space"/>
5035
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5036
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5037
5073
  </xsl:call-template>
5038
5074
  </xsl:variable>
5039
5075
 
5040
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5041
5077
  <xsl:choose>
5042
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5043
5079
  <xsl:call-template name="interspers">
5044
5080
  <xsl:with-param name="str" select="."/>
5045
5081
  </xsl:call-template>
@@ -5050,6 +5086,30 @@
5050
5086
  </xsl:choose>
5051
5087
  </xsl:for-each>
5052
5088
 
5089
+ </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">
5090
+ <xsl:param name="pText" select="."/>
5091
+ <xsl:param name="sep" select="','"/>
5092
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5093
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5094
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5095
+ <xsl:call-template name="replace_tag_interspers">
5096
+ <xsl:with-param name="text" select="$text"/>
5097
+ </xsl:call-template>
5098
+ </xsl:template><xsl:template name="replace_tag_interspers">
5099
+ <xsl:param name="text"/>
5100
+ <xsl:choose>
5101
+ <xsl:when test="contains($text, $interspers_tag_open)">
5102
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5103
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5104
+ <interspers>
5105
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5106
+ </interspers>
5107
+ <xsl:call-template name="replace_tag_interspers">
5108
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5109
+ </xsl:call-template>
5110
+ </xsl:when>
5111
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5112
+ </xsl:choose>
5053
5113
  </xsl:template><xsl:template name="interspers">
5054
5114
  <xsl:param name="str"/>
5055
5115
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5497,7 +5557,7 @@
5497
5557
  </xsl:otherwise>
5498
5558
  </xsl:choose> -->
5499
5559
  </fo:block>
5500
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5560
+ </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">
5501
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5502
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5503
5563
  <xsl:if test="normalize-space() != ''">
@@ -527,7 +527,7 @@
527
527
  </define>
528
528
  <define name="LocalityType">
529
529
  <data type="string">
530
- <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
530
+ <param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
531
531
  </data>
532
532
  </define>
533
533
  <define name="referenceFrom">
@@ -677,6 +677,9 @@
677
677
  <zeroOrMore>
678
678
  <ref name="extent"/>
679
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
680
683
  <zeroOrMore>
681
684
  <ref name="accesslocation"/>
682
685
  </zeroOrMore>
@@ -922,9 +925,29 @@
922
925
  <text/>
923
926
  </element>
924
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
925
941
  <define name="extent">
926
942
  <element name="extent">
927
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
928
951
  </element>
929
952
  </define>
930
953
  <define name="series">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module MPFA
3
- VERSION = "0.8.7".freeze
3
+ VERSION = "0.8.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-mpfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities