metanorma-itu 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -2060,7 +2060,7 @@
2060
2060
  </xsl:if>
2061
2061
  </xsl:template>
2062
2062
 
2063
- <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">
2063
+ <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">
2064
2064
  <xsl:call-template name="getLang"/>
2065
2065
  </xsl:variable><xsl:variable name="pageWidth_">
2066
2066
  210
@@ -6628,7 +6628,51 @@
6628
6628
  <xsl:with-param name="text" select="$text_step1"/>
6629
6629
  </xsl:call-template>
6630
6630
  </xsl:variable>
6631
- <xsl:value-of select="$text_step2"/>
6631
+
6632
+ <!-- <xsl:value-of select="$text_step2"/> -->
6633
+
6634
+ <!-- add zero-width space after space -->
6635
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6636
+
6637
+ <!-- split text by zero-width space -->
6638
+ <xsl:variable name="text_step4">
6639
+ <xsl:call-template name="split">
6640
+ <xsl:with-param name="pText" select="$text_step3"/>
6641
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6642
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6643
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
6644
+ </xsl:call-template>
6645
+ </xsl:variable>
6646
+
6647
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
6648
+ <xsl:choose>
6649
+ <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6650
+ <xsl:call-template name="interspers">
6651
+ <xsl:with-param name="str" select="."/>
6652
+ </xsl:call-template>
6653
+ </xsl:when>
6654
+ <xsl:otherwise>
6655
+ <xsl:value-of select="."/>
6656
+ </xsl:otherwise>
6657
+ </xsl:choose>
6658
+ </xsl:for-each>
6659
+
6660
+ </xsl:template><xsl:template name="interspers">
6661
+ <xsl:param name="str"/>
6662
+ <xsl:param name="char" select="$zero_width_space"/>
6663
+ <xsl:if test="$str != ''">
6664
+ <xsl:value-of select="substring($str, 1, 1)"/>
6665
+
6666
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6667
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6668
+ <xsl:value-of select="$char"/>
6669
+ </xsl:if>
6670
+
6671
+ <xsl:call-template name="interspers">
6672
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6673
+ <xsl:with-param name="char" select="$char"/>
6674
+ </xsl:call-template>
6675
+ </xsl:if>
6632
6676
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6633
6677
  <xsl:apply-templates mode="syntax_highlight"/>
6634
6678
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -7136,11 +7180,24 @@
7136
7180
  </xsl:template><xsl:template match="*[local-name() = 'author']">
7137
7181
  <xsl:text>— </xsl:text>
7138
7182
  <xsl:apply-templates/>
7139
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
7183
+ </xsl:template><xsl:variable name="bibitems_">
7184
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
7185
+ <xsl:copy-of select="."/>
7186
+ </xsl:for-each>
7187
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
7188
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
7189
+ <xsl:copy-of select="."/>
7190
+ </xsl:for-each>
7191
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
7192
+ <xsl:copy-of select="."/>
7193
+ </xsl:for-each>
7194
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
7140
7195
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7141
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
7196
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7197
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
7142
7198
  <xsl:choose>
7143
- <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) -->
7199
+ <!-- <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) -->
7200
+ <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) -->
7144
7201
  <fo:inline xsl:use-attribute-sets="eref-style">
7145
7202
  <xsl:if test="@type = 'footnote'">
7146
7203
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -8291,7 +8348,7 @@
8291
8348
  <xsl:copy>
8292
8349
  <xsl:copy-of select="@*"/>
8293
8350
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8294
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8351
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
8295
8352
  <xsl:sort select="@displayorder" data-type="number"/>
8296
8353
  <xsl:apply-templates select="." mode="update_xml_step1"/>
8297
8354
  </xsl:for-each>
@@ -8540,22 +8597,25 @@
8540
8597
  <xsl:param name="pText" select="."/>
8541
8598
  <xsl:param name="sep" select="','"/>
8542
8599
  <xsl:param name="normalize-space" select="'true'"/>
8600
+ <xsl:param name="keep_sep" select="'false'"/>
8543
8601
  <xsl:if test="string-length($pText) &gt;0">
8544
- <item>
8545
- <xsl:choose>
8546
- <xsl:when test="$normalize-space = 'true'">
8547
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8548
- </xsl:when>
8549
- <xsl:otherwise>
8550
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8551
- </xsl:otherwise>
8552
- </xsl:choose>
8553
- </item>
8554
- <xsl:call-template name="split">
8555
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8556
- <xsl:with-param name="sep" select="$sep"/>
8557
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8558
- </xsl:call-template>
8602
+ <item>
8603
+ <xsl:choose>
8604
+ <xsl:when test="$normalize-space = 'true'">
8605
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8606
+ </xsl:when>
8607
+ <xsl:otherwise>
8608
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8609
+ </xsl:otherwise>
8610
+ </xsl:choose>
8611
+ </item>
8612
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8613
+ <xsl:call-template name="split">
8614
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8615
+ <xsl:with-param name="sep" select="$sep"/>
8616
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8617
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8618
+ </xsl:call-template>
8559
8619
  </xsl:if>
8560
8620
  </xsl:template><xsl:template name="getDocumentId">
8561
8621
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
@@ -2060,7 +2060,7 @@
2060
2060
  </xsl:if>
2061
2061
  </xsl:template>
2062
2062
 
2063
- <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">
2063
+ <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">
2064
2064
  <xsl:call-template name="getLang"/>
2065
2065
  </xsl:variable><xsl:variable name="pageWidth_">
2066
2066
  210
@@ -6628,7 +6628,51 @@
6628
6628
  <xsl:with-param name="text" select="$text_step1"/>
6629
6629
  </xsl:call-template>
6630
6630
  </xsl:variable>
6631
- <xsl:value-of select="$text_step2"/>
6631
+
6632
+ <!-- <xsl:value-of select="$text_step2"/> -->
6633
+
6634
+ <!-- add zero-width space after space -->
6635
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6636
+
6637
+ <!-- split text by zero-width space -->
6638
+ <xsl:variable name="text_step4">
6639
+ <xsl:call-template name="split">
6640
+ <xsl:with-param name="pText" select="$text_step3"/>
6641
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6642
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6643
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
6644
+ </xsl:call-template>
6645
+ </xsl:variable>
6646
+
6647
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
6648
+ <xsl:choose>
6649
+ <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6650
+ <xsl:call-template name="interspers">
6651
+ <xsl:with-param name="str" select="."/>
6652
+ </xsl:call-template>
6653
+ </xsl:when>
6654
+ <xsl:otherwise>
6655
+ <xsl:value-of select="."/>
6656
+ </xsl:otherwise>
6657
+ </xsl:choose>
6658
+ </xsl:for-each>
6659
+
6660
+ </xsl:template><xsl:template name="interspers">
6661
+ <xsl:param name="str"/>
6662
+ <xsl:param name="char" select="$zero_width_space"/>
6663
+ <xsl:if test="$str != ''">
6664
+ <xsl:value-of select="substring($str, 1, 1)"/>
6665
+
6666
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6667
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6668
+ <xsl:value-of select="$char"/>
6669
+ </xsl:if>
6670
+
6671
+ <xsl:call-template name="interspers">
6672
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6673
+ <xsl:with-param name="char" select="$char"/>
6674
+ </xsl:call-template>
6675
+ </xsl:if>
6632
6676
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6633
6677
  <xsl:apply-templates mode="syntax_highlight"/>
6634
6678
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -7136,11 +7180,24 @@
7136
7180
  </xsl:template><xsl:template match="*[local-name() = 'author']">
7137
7181
  <xsl:text>— </xsl:text>
7138
7182
  <xsl:apply-templates/>
7139
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
7183
+ </xsl:template><xsl:variable name="bibitems_">
7184
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
7185
+ <xsl:copy-of select="."/>
7186
+ </xsl:for-each>
7187
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
7188
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
7189
+ <xsl:copy-of select="."/>
7190
+ </xsl:for-each>
7191
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
7192
+ <xsl:copy-of select="."/>
7193
+ </xsl:for-each>
7194
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
7140
7195
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7141
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
7196
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7197
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
7142
7198
  <xsl:choose>
7143
- <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) -->
7199
+ <!-- <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) -->
7200
+ <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) -->
7144
7201
  <fo:inline xsl:use-attribute-sets="eref-style">
7145
7202
  <xsl:if test="@type = 'footnote'">
7146
7203
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -8291,7 +8348,7 @@
8291
8348
  <xsl:copy>
8292
8349
  <xsl:copy-of select="@*"/>
8293
8350
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8294
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8351
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
8295
8352
  <xsl:sort select="@displayorder" data-type="number"/>
8296
8353
  <xsl:apply-templates select="." mode="update_xml_step1"/>
8297
8354
  </xsl:for-each>
@@ -8540,22 +8597,25 @@
8540
8597
  <xsl:param name="pText" select="."/>
8541
8598
  <xsl:param name="sep" select="','"/>
8542
8599
  <xsl:param name="normalize-space" select="'true'"/>
8600
+ <xsl:param name="keep_sep" select="'false'"/>
8543
8601
  <xsl:if test="string-length($pText) &gt;0">
8544
- <item>
8545
- <xsl:choose>
8546
- <xsl:when test="$normalize-space = 'true'">
8547
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8548
- </xsl:when>
8549
- <xsl:otherwise>
8550
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8551
- </xsl:otherwise>
8552
- </xsl:choose>
8553
- </item>
8554
- <xsl:call-template name="split">
8555
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8556
- <xsl:with-param name="sep" select="$sep"/>
8557
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8558
- </xsl:call-template>
8602
+ <item>
8603
+ <xsl:choose>
8604
+ <xsl:when test="$normalize-space = 'true'">
8605
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8606
+ </xsl:when>
8607
+ <xsl:otherwise>
8608
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8609
+ </xsl:otherwise>
8610
+ </xsl:choose>
8611
+ </item>
8612
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8613
+ <xsl:call-template name="split">
8614
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8615
+ <xsl:with-param name="sep" select="$sep"/>
8616
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8617
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8618
+ </xsl:call-template>
8559
8619
  </xsl:if>
8560
8620
  </xsl:template><xsl:template name="getDocumentId">
8561
8621
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
@@ -2060,7 +2060,7 @@
2060
2060
  </xsl:if>
2061
2061
  </xsl:template>
2062
2062
 
2063
- <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">
2063
+ <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">
2064
2064
  <xsl:call-template name="getLang"/>
2065
2065
  </xsl:variable><xsl:variable name="pageWidth_">
2066
2066
  210
@@ -6628,7 +6628,51 @@
6628
6628
  <xsl:with-param name="text" select="$text_step1"/>
6629
6629
  </xsl:call-template>
6630
6630
  </xsl:variable>
6631
- <xsl:value-of select="$text_step2"/>
6631
+
6632
+ <!-- <xsl:value-of select="$text_step2"/> -->
6633
+
6634
+ <!-- add zero-width space after space -->
6635
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6636
+
6637
+ <!-- split text by zero-width space -->
6638
+ <xsl:variable name="text_step4">
6639
+ <xsl:call-template name="split">
6640
+ <xsl:with-param name="pText" select="$text_step3"/>
6641
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6642
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6643
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
6644
+ </xsl:call-template>
6645
+ </xsl:variable>
6646
+
6647
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
6648
+ <xsl:choose>
6649
+ <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6650
+ <xsl:call-template name="interspers">
6651
+ <xsl:with-param name="str" select="."/>
6652
+ </xsl:call-template>
6653
+ </xsl:when>
6654
+ <xsl:otherwise>
6655
+ <xsl:value-of select="."/>
6656
+ </xsl:otherwise>
6657
+ </xsl:choose>
6658
+ </xsl:for-each>
6659
+
6660
+ </xsl:template><xsl:template name="interspers">
6661
+ <xsl:param name="str"/>
6662
+ <xsl:param name="char" select="$zero_width_space"/>
6663
+ <xsl:if test="$str != ''">
6664
+ <xsl:value-of select="substring($str, 1, 1)"/>
6665
+
6666
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6667
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6668
+ <xsl:value-of select="$char"/>
6669
+ </xsl:if>
6670
+
6671
+ <xsl:call-template name="interspers">
6672
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6673
+ <xsl:with-param name="char" select="$char"/>
6674
+ </xsl:call-template>
6675
+ </xsl:if>
6632
6676
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6633
6677
  <xsl:apply-templates mode="syntax_highlight"/>
6634
6678
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -7136,11 +7180,24 @@
7136
7180
  </xsl:template><xsl:template match="*[local-name() = 'author']">
7137
7181
  <xsl:text>— </xsl:text>
7138
7182
  <xsl:apply-templates/>
7139
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
7183
+ </xsl:template><xsl:variable name="bibitems_">
7184
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
7185
+ <xsl:copy-of select="."/>
7186
+ </xsl:for-each>
7187
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
7188
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
7189
+ <xsl:copy-of select="."/>
7190
+ </xsl:for-each>
7191
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
7192
+ <xsl:copy-of select="."/>
7193
+ </xsl:for-each>
7194
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
7140
7195
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7141
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
7196
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7197
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
7142
7198
  <xsl:choose>
7143
- <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) -->
7199
+ <!-- <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) -->
7200
+ <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) -->
7144
7201
  <fo:inline xsl:use-attribute-sets="eref-style">
7145
7202
  <xsl:if test="@type = 'footnote'">
7146
7203
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -8291,7 +8348,7 @@
8291
8348
  <xsl:copy>
8292
8349
  <xsl:copy-of select="@*"/>
8293
8350
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8294
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8351
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
8295
8352
  <xsl:sort select="@displayorder" data-type="number"/>
8296
8353
  <xsl:apply-templates select="." mode="update_xml_step1"/>
8297
8354
  </xsl:for-each>
@@ -8540,22 +8597,25 @@
8540
8597
  <xsl:param name="pText" select="."/>
8541
8598
  <xsl:param name="sep" select="','"/>
8542
8599
  <xsl:param name="normalize-space" select="'true'"/>
8600
+ <xsl:param name="keep_sep" select="'false'"/>
8543
8601
  <xsl:if test="string-length($pText) &gt;0">
8544
- <item>
8545
- <xsl:choose>
8546
- <xsl:when test="$normalize-space = 'true'">
8547
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8548
- </xsl:when>
8549
- <xsl:otherwise>
8550
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8551
- </xsl:otherwise>
8552
- </xsl:choose>
8553
- </item>
8554
- <xsl:call-template name="split">
8555
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8556
- <xsl:with-param name="sep" select="$sep"/>
8557
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8558
- </xsl:call-template>
8602
+ <item>
8603
+ <xsl:choose>
8604
+ <xsl:when test="$normalize-space = 'true'">
8605
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8606
+ </xsl:when>
8607
+ <xsl:otherwise>
8608
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8609
+ </xsl:otherwise>
8610
+ </xsl:choose>
8611
+ </item>
8612
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8613
+ <xsl:call-template name="split">
8614
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8615
+ <xsl:with-param name="sep" select="$sep"/>
8616
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8617
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8618
+ </xsl:call-template>
8559
8619
  </xsl:if>
8560
8620
  </xsl:template><xsl:template name="getDocumentId">
8561
8621
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
@@ -2060,7 +2060,7 @@
2060
2060
  </xsl:if>
2061
2061
  </xsl:template>
2062
2062
 
2063
- <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">
2063
+ <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">
2064
2064
  <xsl:call-template name="getLang"/>
2065
2065
  </xsl:variable><xsl:variable name="pageWidth_">
2066
2066
  210
@@ -6628,7 +6628,51 @@
6628
6628
  <xsl:with-param name="text" select="$text_step1"/>
6629
6629
  </xsl:call-template>
6630
6630
  </xsl:variable>
6631
- <xsl:value-of select="$text_step2"/>
6631
+
6632
+ <!-- <xsl:value-of select="$text_step2"/> -->
6633
+
6634
+ <!-- add zero-width space after space -->
6635
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6636
+
6637
+ <!-- split text by zero-width space -->
6638
+ <xsl:variable name="text_step4">
6639
+ <xsl:call-template name="split">
6640
+ <xsl:with-param name="pText" select="$text_step3"/>
6641
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6642
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6643
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
6644
+ </xsl:call-template>
6645
+ </xsl:variable>
6646
+
6647
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
6648
+ <xsl:choose>
6649
+ <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6650
+ <xsl:call-template name="interspers">
6651
+ <xsl:with-param name="str" select="."/>
6652
+ </xsl:call-template>
6653
+ </xsl:when>
6654
+ <xsl:otherwise>
6655
+ <xsl:value-of select="."/>
6656
+ </xsl:otherwise>
6657
+ </xsl:choose>
6658
+ </xsl:for-each>
6659
+
6660
+ </xsl:template><xsl:template name="interspers">
6661
+ <xsl:param name="str"/>
6662
+ <xsl:param name="char" select="$zero_width_space"/>
6663
+ <xsl:if test="$str != ''">
6664
+ <xsl:value-of select="substring($str, 1, 1)"/>
6665
+
6666
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6667
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6668
+ <xsl:value-of select="$char"/>
6669
+ </xsl:if>
6670
+
6671
+ <xsl:call-template name="interspers">
6672
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6673
+ <xsl:with-param name="char" select="$char"/>
6674
+ </xsl:call-template>
6675
+ </xsl:if>
6632
6676
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6633
6677
  <xsl:apply-templates mode="syntax_highlight"/>
6634
6678
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -7136,11 +7180,24 @@
7136
7180
  </xsl:template><xsl:template match="*[local-name() = 'author']">
7137
7181
  <xsl:text>— </xsl:text>
7138
7182
  <xsl:apply-templates/>
7139
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
7183
+ </xsl:template><xsl:variable name="bibitems_">
7184
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
7185
+ <xsl:copy-of select="."/>
7186
+ </xsl:for-each>
7187
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
7188
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
7189
+ <xsl:copy-of select="."/>
7190
+ </xsl:for-each>
7191
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
7192
+ <xsl:copy-of select="."/>
7193
+ </xsl:for-each>
7194
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
7140
7195
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7141
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
7196
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7197
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
7142
7198
  <xsl:choose>
7143
- <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) -->
7199
+ <!-- <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) -->
7200
+ <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) -->
7144
7201
  <fo:inline xsl:use-attribute-sets="eref-style">
7145
7202
  <xsl:if test="@type = 'footnote'">
7146
7203
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -8291,7 +8348,7 @@
8291
8348
  <xsl:copy>
8292
8349
  <xsl:copy-of select="@*"/>
8293
8350
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8294
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8351
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
8295
8352
  <xsl:sort select="@displayorder" data-type="number"/>
8296
8353
  <xsl:apply-templates select="." mode="update_xml_step1"/>
8297
8354
  </xsl:for-each>
@@ -8540,22 +8597,25 @@
8540
8597
  <xsl:param name="pText" select="."/>
8541
8598
  <xsl:param name="sep" select="','"/>
8542
8599
  <xsl:param name="normalize-space" select="'true'"/>
8600
+ <xsl:param name="keep_sep" select="'false'"/>
8543
8601
  <xsl:if test="string-length($pText) &gt;0">
8544
- <item>
8545
- <xsl:choose>
8546
- <xsl:when test="$normalize-space = 'true'">
8547
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8548
- </xsl:when>
8549
- <xsl:otherwise>
8550
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8551
- </xsl:otherwise>
8552
- </xsl:choose>
8553
- </item>
8554
- <xsl:call-template name="split">
8555
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8556
- <xsl:with-param name="sep" select="$sep"/>
8557
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8558
- </xsl:call-template>
8602
+ <item>
8603
+ <xsl:choose>
8604
+ <xsl:when test="$normalize-space = 'true'">
8605
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8606
+ </xsl:when>
8607
+ <xsl:otherwise>
8608
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8609
+ </xsl:otherwise>
8610
+ </xsl:choose>
8611
+ </item>
8612
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8613
+ <xsl:call-template name="split">
8614
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8615
+ <xsl:with-param name="sep" select="$sep"/>
8616
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8617
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8618
+ </xsl:call-template>
8559
8619
  </xsl:if>
8560
8620
  </xsl:template><xsl:template name="getDocumentId">
8561
8621
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>