metanorma-mpfa 0.8.5 → 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: 847f9fc4181ffd0e63fecc08767ab4371d0a3d47f602d55b80e3b277399e1f48
4
- data.tar.gz: e37eed52267bd1e8138abd3aa2a9e5833fa868e26d146c145d773ce576a08fcb
3
+ metadata.gz: 16af01006c9ba1b937162a084406d3e5423cc88fff68cd9d63bfcd171dc55f04
4
+ data.tar.gz: 7c0ed6a1fe246257a76c3ce439e0ab6bf03fb8dd88842958b2263cd4a43fb73f
5
5
  SHA512:
6
- metadata.gz: c859387d71bd8f527b8b06fbba7623917dc661ee0facf583fccb5904d0cc1b94fb10a8f219e6737d0089a0b1eb0c64fcd964f5857dd061b66af63d433d5cc714
7
- data.tar.gz: 8965a8483b443f86e3e76a5d4bc583df06e6463d7cb0c77a1e81ef36b1b4d663745cd8afc100e38522f5e162bbe80b152a70fda488e4fd331efdc02bc95399b8
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 -->
@@ -570,7 +576,7 @@
570
576
  </xsl:template>
571
577
 
572
578
 
573
- <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:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
579
+ <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">
574
580
  <xsl:call-template name="getLang"/>
575
581
  </xsl:variable><xsl:variable name="pageWidth_">
576
582
  210
@@ -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
 
@@ -1898,8 +1927,27 @@
1898
1927
  <xsl:sort select="@displayorder" data-type="number"/>
1899
1928
  <xsl:apply-templates select="."/>
1900
1929
  </xsl:for-each>
1901
- </xsl:template><xsl:template match="text()">
1902
- <xsl:value-of select="."/>
1930
+ </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">
1931
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
1932
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
1933
+ <xsl:call-template name="replace_fo_inline">
1934
+ <xsl:with-param name="text" select="$text"/>
1935
+ </xsl:call-template>
1936
+ </xsl:template><xsl:template name="replace_fo_inline">
1937
+ <xsl:param name="text"/>
1938
+ <xsl:choose>
1939
+ <xsl:when test="contains($text, $tag_open)">
1940
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
1941
+ <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
1942
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
1943
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
1944
+ <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
1945
+ <xsl:call-template name="replace_fo_inline">
1946
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
1947
+ </xsl:call-template>
1948
+ </xsl:when>
1949
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
1950
+ </xsl:choose>
1903
1951
  </xsl:template><xsl:template match="*[local-name()='br']">
1904
1952
  <xsl:value-of select="$linebreak"/>
1905
1953
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
@@ -3539,24 +3587,28 @@
3539
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3540
3588
  <xsl:param name="text" select="."/>
3541
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3542
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3543
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3544
3594
  <xsl:choose>
3545
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3546
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3547
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3548
3598
  <xsl:value-of select="$zero-space"/>
3549
3599
  <xsl:call-template name="add-zero-spaces-equal">
3550
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3551
- </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))"/>
3552
3603
  </xsl:when>
3553
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3554
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3555
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3556
3607
  <xsl:value-of select="$zero-space"/>
3557
3608
  <xsl:call-template name="add-zero-spaces-equal">
3558
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3559
- </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))"/>
3560
3612
  </xsl:when>
3561
3613
  <xsl:otherwise>
3562
3614
  <xsl:value-of select="$text"/>
@@ -4032,7 +4084,12 @@
4032
4084
 
4033
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4034
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
+
4035
4091
 
4092
+
4036
4093
 
4037
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4038
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5002,7 +5059,73 @@
5002
5059
  <xsl:with-param name="text" select="$text_step1"/>
5003
5060
  </xsl:call-template>
5004
5061
  </xsl:variable>
5005
- <xsl:value-of select="$text_step2"/>
5062
+
5063
+ <!-- <xsl:value-of select="$text_step2"/> -->
5064
+
5065
+ <!-- add zero-width space after space -->
5066
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
5067
+
5068
+ <!-- split text by zero-width space -->
5069
+ <xsl:variable name="text_step4">
5070
+ <xsl:call-template name="split_for_interspers">
5071
+ <xsl:with-param name="pText" select="$text_step3"/>
5072
+ <xsl:with-param name="sep" select="$zero_width_space"/>
5073
+ </xsl:call-template>
5074
+ </xsl:variable>
5075
+
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5077
+ <xsl:choose>
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5079
+ <xsl:call-template name="interspers">
5080
+ <xsl:with-param name="str" select="."/>
5081
+ </xsl:call-template>
5082
+ </xsl:when>
5083
+ <xsl:otherwise>
5084
+ <xsl:value-of select="."/>
5085
+ </xsl:otherwise>
5086
+ </xsl:choose>
5087
+ </xsl:for-each>
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>
5113
+ </xsl:template><xsl:template name="interspers">
5114
+ <xsl:param name="str"/>
5115
+ <xsl:param name="char" select="$zero_width_space"/>
5116
+ <xsl:if test="$str != ''">
5117
+ <xsl:value-of select="substring($str, 1, 1)"/>
5118
+
5119
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
5120
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
5121
+ <xsl:value-of select="$char"/>
5122
+ </xsl:if>
5123
+
5124
+ <xsl:call-template name="interspers">
5125
+ <xsl:with-param name="str" select="substring($str, 2)"/>
5126
+ <xsl:with-param name="char" select="$char"/>
5127
+ </xsl:call-template>
5128
+ </xsl:if>
5006
5129
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5007
5130
  <xsl:apply-templates mode="syntax_highlight"/>
5008
5131
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5434,7 +5557,7 @@
5434
5557
  </xsl:otherwise>
5435
5558
  </xsl:choose> -->
5436
5559
  </fo:block>
5437
- </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">
5438
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5439
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5440
5563
  <xsl:if test="normalize-space() != ''">
@@ -5470,7 +5593,8 @@
5470
5593
  <fo:inline><xsl:apply-templates/></fo:inline>
5471
5594
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
5472
5595
  <xsl:if test="normalize-space() != ''">
5473
- <xsl:value-of select="."/>
5596
+ <!-- <xsl:value-of select="."/> -->
5597
+ <xsl:call-template name="text"/>
5474
5598
  </xsl:if>
5475
5599
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
5476
5600
  <fo:block-container margin-left="0mm">
@@ -5510,11 +5634,24 @@
5510
5634
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5511
5635
  <xsl:text>— </xsl:text>
5512
5636
  <xsl:apply-templates/>
5513
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
5637
+ </xsl:template><xsl:variable name="bibitems_">
5638
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
5639
+ <xsl:copy-of select="."/>
5640
+ </xsl:for-each>
5641
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
5642
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5643
+ <xsl:copy-of select="."/>
5644
+ </xsl:for-each>
5645
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
5646
+ <xsl:copy-of select="."/>
5647
+ </xsl:for-each>
5648
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5514
5649
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
5515
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
5650
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
5651
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
5516
5652
  <xsl:choose>
5517
- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5653
+ <!-- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> --> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5654
+ <xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid])"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5518
5655
  <fo:inline xsl:use-attribute-sets="eref-style">
5519
5656
  <xsl:if test="@type = 'footnote'">
5520
5657
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6622,7 +6759,7 @@
6622
6759
  <xsl:copy>
6623
6760
  <xsl:copy-of select="@*"/>
6624
6761
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
6625
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
6762
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
6626
6763
  <xsl:sort select="@displayorder" data-type="number"/>
6627
6764
  <xsl:apply-templates select="." mode="update_xml_step1"/>
6628
6765
  </xsl:for-each>
@@ -6871,22 +7008,25 @@
6871
7008
  <xsl:param name="pText" select="."/>
6872
7009
  <xsl:param name="sep" select="','"/>
6873
7010
  <xsl:param name="normalize-space" select="'true'"/>
7011
+ <xsl:param name="keep_sep" select="'false'"/>
6874
7012
  <xsl:if test="string-length($pText) &gt;0">
6875
- <item>
6876
- <xsl:choose>
6877
- <xsl:when test="$normalize-space = 'true'">
6878
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
6879
- </xsl:when>
6880
- <xsl:otherwise>
6881
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
6882
- </xsl:otherwise>
6883
- </xsl:choose>
6884
- </item>
6885
- <xsl:call-template name="split">
6886
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
6887
- <xsl:with-param name="sep" select="$sep"/>
6888
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
6889
- </xsl:call-template>
7013
+ <item>
7014
+ <xsl:choose>
7015
+ <xsl:when test="$normalize-space = 'true'">
7016
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
7017
+ </xsl:when>
7018
+ <xsl:otherwise>
7019
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
7020
+ </xsl:otherwise>
7021
+ </xsl:choose>
7022
+ </item>
7023
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
7024
+ <xsl:call-template name="split">
7025
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
7026
+ <xsl:with-param name="sep" select="$sep"/>
7027
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
7028
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
7029
+ </xsl:call-template>
6890
7030
  </xsl:if>
6891
7031
  </xsl:template><xsl:template name="getDocumentId">
6892
7032
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
@@ -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 -->
@@ -570,7 +576,7 @@
570
576
  </xsl:template>
571
577
 
572
578
 
573
- <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:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
579
+ <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">
574
580
  <xsl:call-template name="getLang"/>
575
581
  </xsl:variable><xsl:variable name="pageWidth_">
576
582
  210
@@ -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
 
@@ -1898,8 +1927,27 @@
1898
1927
  <xsl:sort select="@displayorder" data-type="number"/>
1899
1928
  <xsl:apply-templates select="."/>
1900
1929
  </xsl:for-each>
1901
- </xsl:template><xsl:template match="text()">
1902
- <xsl:value-of select="."/>
1930
+ </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">
1931
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
1932
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
1933
+ <xsl:call-template name="replace_fo_inline">
1934
+ <xsl:with-param name="text" select="$text"/>
1935
+ </xsl:call-template>
1936
+ </xsl:template><xsl:template name="replace_fo_inline">
1937
+ <xsl:param name="text"/>
1938
+ <xsl:choose>
1939
+ <xsl:when test="contains($text, $tag_open)">
1940
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
1941
+ <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
1942
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
1943
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
1944
+ <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
1945
+ <xsl:call-template name="replace_fo_inline">
1946
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
1947
+ </xsl:call-template>
1948
+ </xsl:when>
1949
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
1950
+ </xsl:choose>
1903
1951
  </xsl:template><xsl:template match="*[local-name()='br']">
1904
1952
  <xsl:value-of select="$linebreak"/>
1905
1953
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
@@ -3539,24 +3587,28 @@
3539
3587
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3540
3588
  <xsl:param name="text" select="."/>
3541
3589
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3590
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3542
3591
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3592
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3543
3593
  <xsl:variable name="zero-space">​</xsl:variable>
3544
3594
  <xsl:choose>
3545
3595
  <xsl:when test="contains($text, $zero-space-after-equals)">
3546
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3596
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3547
3597
  <xsl:value-of select="$zero-space-after-equals"/>
3548
3598
  <xsl:value-of select="$zero-space"/>
3549
3599
  <xsl:call-template name="add-zero-spaces-equal">
3550
3600
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3551
- </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))"/>
3552
3603
  </xsl:when>
3553
3604
  <xsl:when test="contains($text, $zero-space-after-equal)">
3554
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3605
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3555
3606
  <xsl:value-of select="$zero-space-after-equal"/>
3556
3607
  <xsl:value-of select="$zero-space"/>
3557
3608
  <xsl:call-template name="add-zero-spaces-equal">
3558
3609
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3559
- </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))"/>
3560
3612
  </xsl:when>
3561
3613
  <xsl:otherwise>
3562
3614
  <xsl:value-of select="$text"/>
@@ -4032,7 +4084,12 @@
4032
4084
 
4033
4085
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4034
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
+
4035
4091
 
4092
+
4036
4093
 
4037
4094
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4038
4095
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5002,7 +5059,73 @@
5002
5059
  <xsl:with-param name="text" select="$text_step1"/>
5003
5060
  </xsl:call-template>
5004
5061
  </xsl:variable>
5005
- <xsl:value-of select="$text_step2"/>
5062
+
5063
+ <!-- <xsl:value-of select="$text_step2"/> -->
5064
+
5065
+ <!-- add zero-width space after space -->
5066
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
5067
+
5068
+ <!-- split text by zero-width space -->
5069
+ <xsl:variable name="text_step4">
5070
+ <xsl:call-template name="split_for_interspers">
5071
+ <xsl:with-param name="pText" select="$text_step3"/>
5072
+ <xsl:with-param name="sep" select="$zero_width_space"/>
5073
+ </xsl:call-template>
5074
+ </xsl:variable>
5075
+
5076
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5077
+ <xsl:choose>
5078
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5079
+ <xsl:call-template name="interspers">
5080
+ <xsl:with-param name="str" select="."/>
5081
+ </xsl:call-template>
5082
+ </xsl:when>
5083
+ <xsl:otherwise>
5084
+ <xsl:value-of select="."/>
5085
+ </xsl:otherwise>
5086
+ </xsl:choose>
5087
+ </xsl:for-each>
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>
5113
+ </xsl:template><xsl:template name="interspers">
5114
+ <xsl:param name="str"/>
5115
+ <xsl:param name="char" select="$zero_width_space"/>
5116
+ <xsl:if test="$str != ''">
5117
+ <xsl:value-of select="substring($str, 1, 1)"/>
5118
+
5119
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
5120
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
5121
+ <xsl:value-of select="$char"/>
5122
+ </xsl:if>
5123
+
5124
+ <xsl:call-template name="interspers">
5125
+ <xsl:with-param name="str" select="substring($str, 2)"/>
5126
+ <xsl:with-param name="char" select="$char"/>
5127
+ </xsl:call-template>
5128
+ </xsl:if>
5006
5129
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5007
5130
  <xsl:apply-templates mode="syntax_highlight"/>
5008
5131
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5434,7 +5557,7 @@
5434
5557
  </xsl:otherwise>
5435
5558
  </xsl:choose> -->
5436
5559
  </fo:block>
5437
- </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">
5438
5561
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5439
5562
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5440
5563
  <xsl:if test="normalize-space() != ''">
@@ -5470,7 +5593,8 @@
5470
5593
  <fo:inline><xsl:apply-templates/></fo:inline>
5471
5594
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
5472
5595
  <xsl:if test="normalize-space() != ''">
5473
- <xsl:value-of select="."/>
5596
+ <!-- <xsl:value-of select="."/> -->
5597
+ <xsl:call-template name="text"/>
5474
5598
  </xsl:if>
5475
5599
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
5476
5600
  <fo:block-container margin-left="0mm">
@@ -5510,11 +5634,24 @@
5510
5634
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5511
5635
  <xsl:text>— </xsl:text>
5512
5636
  <xsl:apply-templates/>
5513
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
5637
+ </xsl:template><xsl:variable name="bibitems_">
5638
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
5639
+ <xsl:copy-of select="."/>
5640
+ </xsl:for-each>
5641
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
5642
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5643
+ <xsl:copy-of select="."/>
5644
+ </xsl:for-each>
5645
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
5646
+ <xsl:copy-of select="."/>
5647
+ </xsl:for-each>
5648
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5514
5649
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
5515
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
5650
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
5651
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
5516
5652
  <xsl:choose>
5517
- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5653
+ <!-- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> --> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5654
+ <xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid])"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5518
5655
  <fo:inline xsl:use-attribute-sets="eref-style">
5519
5656
  <xsl:if test="@type = 'footnote'">
5520
5657
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6622,7 +6759,7 @@
6622
6759
  <xsl:copy>
6623
6760
  <xsl:copy-of select="@*"/>
6624
6761
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
6625
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
6762
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
6626
6763
  <xsl:sort select="@displayorder" data-type="number"/>
6627
6764
  <xsl:apply-templates select="." mode="update_xml_step1"/>
6628
6765
  </xsl:for-each>
@@ -6871,22 +7008,25 @@
6871
7008
  <xsl:param name="pText" select="."/>
6872
7009
  <xsl:param name="sep" select="','"/>
6873
7010
  <xsl:param name="normalize-space" select="'true'"/>
7011
+ <xsl:param name="keep_sep" select="'false'"/>
6874
7012
  <xsl:if test="string-length($pText) &gt;0">
6875
- <item>
6876
- <xsl:choose>
6877
- <xsl:when test="$normalize-space = 'true'">
6878
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
6879
- </xsl:when>
6880
- <xsl:otherwise>
6881
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
6882
- </xsl:otherwise>
6883
- </xsl:choose>
6884
- </item>
6885
- <xsl:call-template name="split">
6886
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
6887
- <xsl:with-param name="sep" select="$sep"/>
6888
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
6889
- </xsl:call-template>
7013
+ <item>
7014
+ <xsl:choose>
7015
+ <xsl:when test="$normalize-space = 'true'">
7016
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
7017
+ </xsl:when>
7018
+ <xsl:otherwise>
7019
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
7020
+ </xsl:otherwise>
7021
+ </xsl:choose>
7022
+ </item>
7023
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
7024
+ <xsl:call-template name="split">
7025
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
7026
+ <xsl:with-param name="sep" select="$sep"/>
7027
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
7028
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
7029
+ </xsl:call-template>
6890
7030
  </xsl:if>
6891
7031
  </xsl:template><xsl:template name="getDocumentId">
6892
7032
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>