metanorma-itu 2.2.6 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -2684,7 +2684,6 @@
2684
2684
 
2685
2685
  <xsl:attribute-set name="table-header-cell-style">
2686
2686
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2687
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2688
2687
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2689
2688
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2690
2689
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -2693,10 +2692,10 @@
2693
2692
 
2694
2693
  <xsl:attribute-set name="table-cell-style">
2695
2694
  <xsl:attribute name="display-align">center</xsl:attribute>
2696
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2697
2695
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2698
2696
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2699
2697
 
2698
+ <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2700
2699
  <xsl:attribute name="display-align">before</xsl:attribute>
2701
2700
 
2702
2701
  </xsl:attribute-set> <!-- table-cell-style -->
@@ -3439,7 +3438,7 @@
3439
3438
  <xsl:apply-templates select="." mode="contents"/>
3440
3439
  </xsl:for-each>
3441
3440
 
3442
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3441
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]">
3443
3442
  <xsl:sort select="@displayorder" data-type="number"/>
3444
3443
  <xsl:apply-templates select="." mode="contents"/>
3445
3444
  </xsl:for-each>
@@ -4388,6 +4387,10 @@
4388
4387
  </xsl:choose>
4389
4388
  </xsl:variable>
4390
4389
 
4390
+ <xsl:variable name="table_fn_block">
4391
+ <xsl:call-template name="table_fn_display"/>
4392
+ </xsl:variable>
4393
+
4391
4394
  <xsl:variable name="tableWithNotesAndFootnotes">
4392
4395
 
4393
4396
  <fo:table keep-with-previous="always">
@@ -4454,11 +4457,25 @@
4454
4457
 
4455
4458
  <xsl:apply-templates select="../*[local-name()='note']"/>
4456
4459
 
4460
+ <xsl:variable name="isDisplayRowSeparator">
4461
+
4462
+ </xsl:variable>
4463
+
4457
4464
  <!-- horizontal row separator -->
4465
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4466
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
4467
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4468
+
4469
+ <xsl:call-template name="setBordersTableArray"/>
4470
+ <fo:block font-size="1pt"> </fo:block>
4471
+ </fo:block-container>
4472
+ </xsl:if>
4473
+ </xsl:if>
4458
4474
 
4459
4475
  <!-- fn processing -->
4460
4476
 
4461
- <xsl:call-template name="table_fn_display"/>
4477
+ <!-- <xsl:call-template name="table_fn_display" /> -->
4478
+ <xsl:copy-of select="$table_fn_block"/>
4462
4479
 
4463
4480
  <!-- for PAS display Notes after footnotes -->
4464
4481
 
@@ -4579,6 +4596,28 @@
4579
4596
  </fo:table-row>
4580
4597
  </xsl:template>
4581
4598
 
4599
+ <xsl:template name="setBorderUnderRow">
4600
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
4601
+ <xsl:choose>
4602
+ <xsl:when test="$border_under_row_ != ''">
4603
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
4604
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
4605
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
4606
+ <xsl:variable name="border_under_row">
4607
+ <xsl:call-template name="split">
4608
+ <xsl:with-param name="pText" select="$border_under_row_"/>
4609
+ </xsl:call-template>
4610
+ </xsl:variable>
4611
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
4612
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4613
+ </xsl:if>
4614
+ </xsl:when>
4615
+ <xsl:otherwise>
4616
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4617
+ </xsl:otherwise>
4618
+ </xsl:choose>
4619
+ </xsl:template>
4620
+
4582
4621
  <!-- row in table footer (tfoot) -->
4583
4622
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4584
4623
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -4940,8 +4979,16 @@
4940
4979
  <!-- figure's footnotes rendering -->
4941
4980
  <xsl:template name="fn_display_figure">
4942
4981
 
4982
+ <!-- current figure id -->
4983
+ <xsl:variable name="figure_id_">
4984
+ <xsl:value-of select="@id"/>
4985
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4986
+ </xsl:variable>
4987
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4988
+
4989
+ <!-- all footnotes relates to the current figure -->
4943
4990
  <xsl:variable name="references">
4944
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
4991
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4945
4992
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4946
4993
  <xsl:apply-templates/>
4947
4994
  </fn>
@@ -4954,91 +5001,93 @@
4954
5001
 
4955
5002
  </xsl:variable>
4956
5003
 
4957
- <!-- current hierarchy is 'figure' element -->
4958
- <xsl:variable name="following_dl_colwidths">
4959
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4960
- <xsl:variable name="simple-table">
4961
- <!-- <xsl:variable name="doc_ns">
4962
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5004
+ <fo:block>
5005
+
5006
+ <!-- current hierarchy is 'figure' element -->
5007
+ <xsl:variable name="following_dl_colwidths">
5008
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5009
+ <xsl:variable name="simple-table">
5010
+ <!-- <xsl:variable name="doc_ns">
5011
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5012
+ </xsl:variable>
5013
+ <xsl:variable name="ns">
5014
+ <xsl:choose>
5015
+ <xsl:when test="normalize-space($doc_ns) != ''">
5016
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5017
+ </xsl:when>
5018
+ <xsl:otherwise>
5019
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5020
+ </xsl:otherwise>
5021
+ </xsl:choose>
5022
+ </xsl:variable> -->
5023
+
5024
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5025
+ <tbody>
5026
+ <xsl:apply-templates mode="dl"/>
5027
+ </tbody>
5028
+ </xsl:for-each>
5029
+ </xsl:variable>
5030
+
5031
+ <xsl:call-template name="calculate-column-widths">
5032
+ <xsl:with-param name="cols-count" select="2"/>
5033
+ <xsl:with-param name="table" select="$simple-table"/>
5034
+ </xsl:call-template>
5035
+
5036
+ </xsl:if>
4963
5037
  </xsl:variable>
4964
- <xsl:variable name="ns">
5038
+
5039
+ <xsl:variable name="maxlength_dt">
5040
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5041
+ <xsl:call-template name="getMaxLength_dt"/>
5042
+ </xsl:for-each>
5043
+ </xsl:variable>
5044
+
5045
+ <fo:table width="95%" table-layout="fixed">
5046
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5047
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5048
+
5049
+ </xsl:if>
4965
5050
  <xsl:choose>
4966
- <xsl:when test="normalize-space($doc_ns) != ''">
4967
- <xsl:value-of select="normalize-space($doc_ns)"/>
5051
+ <!-- if there 'dl', then set same columns width -->
5052
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5053
+ <xsl:call-template name="setColumnWidth_dl">
5054
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5055
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5056
+ </xsl:call-template>
4968
5057
  </xsl:when>
4969
5058
  <xsl:otherwise>
4970
- <xsl:value-of select="substring-before(name(/*), '-')"/>
5059
+ <fo:table-column column-width="5%"/>
5060
+ <fo:table-column column-width="95%"/>
4971
5061
  </xsl:otherwise>
4972
5062
  </xsl:choose>
4973
- </xsl:variable> -->
4974
-
4975
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4976
- <tbody>
4977
- <xsl:apply-templates mode="dl"/>
4978
- </tbody>
4979
- </xsl:for-each>
4980
- </xsl:variable>
4981
-
4982
- <xsl:call-template name="calculate-column-widths">
4983
- <xsl:with-param name="cols-count" select="2"/>
4984
- <xsl:with-param name="table" select="$simple-table"/>
4985
- </xsl:call-template>
4986
-
4987
- </xsl:if>
4988
- </xsl:variable>
4989
-
4990
- <xsl:variable name="maxlength_dt">
4991
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4992
- <xsl:call-template name="getMaxLength_dt"/>
4993
- </xsl:for-each>
4994
- </xsl:variable>
4995
-
4996
- <fo:block>
4997
- <fo:table width="95%" table-layout="fixed">
4998
- <xsl:if test="normalize-space($key_iso) = 'true'">
4999
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5063
+ <fo:table-body>
5064
+ <xsl:for-each select="xalan:nodeset($references)//fn">
5065
+ <xsl:variable name="reference" select="@reference"/>
5066
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5067
+ <fo:table-row>
5068
+ <fo:table-cell>
5069
+ <fo:block>
5070
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5071
+ <xsl:value-of select="@reference"/>
5072
+ </fo:inline>
5073
+ </fo:block>
5074
+ </fo:table-cell>
5075
+ <fo:table-cell>
5076
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5077
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5000
5078
 
5001
- </xsl:if>
5002
- <xsl:choose>
5003
- <!-- if there 'dl', then set same columns width -->
5004
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5005
- <xsl:call-template name="setColumnWidth_dl">
5006
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5007
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5008
- </xsl:call-template>
5009
- </xsl:when>
5010
- <xsl:otherwise>
5011
- <fo:table-column column-width="15%"/>
5012
- <fo:table-column column-width="85%"/>
5013
- </xsl:otherwise>
5014
- </xsl:choose>
5015
- <fo:table-body>
5016
- <xsl:for-each select="xalan:nodeset($references)//fn">
5017
- <xsl:variable name="reference" select="@reference"/>
5018
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5019
- <fo:table-row>
5020
- <fo:table-cell>
5021
- <fo:block>
5022
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5023
- <xsl:value-of select="@reference"/>
5024
- </fo:inline>
5025
- </fo:block>
5026
- </fo:table-cell>
5027
- <fo:table-cell>
5028
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5029
- <xsl:if test="normalize-space($key_iso) = 'true'">
5079
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5030
5080
 
5031
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5081
+ </xsl:if>
5082
+ <xsl:copy-of select="./node()"/>
5083
+ </fo:block>
5084
+ </fo:table-cell>
5085
+ </fo:table-row>
5086
+ </xsl:if>
5087
+ </xsl:for-each>
5088
+ </fo:table-body>
5089
+ </fo:table>
5032
5090
 
5033
- </xsl:if>
5034
- <xsl:copy-of select="./node()"/>
5035
- </fo:block>
5036
- </fo:table-cell>
5037
- </fo:table-row>
5038
- </xsl:if>
5039
- </xsl:for-each>
5040
- </fo:table-body>
5041
- </fo:table>
5042
5091
  </fo:block>
5043
5092
  </xsl:if>
5044
5093
 
@@ -5114,12 +5163,14 @@
5114
5163
 
5115
5164
  <fo:block margin-bottom="12pt" text-align="left">
5116
5165
 
5117
- <xsl:variable name="title-where">
5166
+ <!-- <xsl:variable name="title-where">
5118
5167
  <xsl:call-template name="getLocalizedString">
5119
5168
  <xsl:with-param name="key">where</xsl:with-param>
5120
5169
  </xsl:call-template>
5121
5170
  </xsl:variable>
5122
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
5171
+ <xsl:value-of select="$title-where"/> -->
5172
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5173
+ <xsl:text> </xsl:text>
5123
5174
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5124
5175
  <xsl:text/>
5125
5176
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -5131,12 +5182,14 @@
5131
5182
 
5132
5183
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5133
5184
 
5134
- <xsl:variable name="title-where">
5185
+ <!-- <xsl:variable name="title-where">
5135
5186
  <xsl:call-template name="getLocalizedString">
5136
5187
  <xsl:with-param name="key">where</xsl:with-param>
5137
5188
  </xsl:call-template>
5138
5189
  </xsl:variable>
5139
- <xsl:value-of select="$title-where"/>:
5190
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
5191
+ <!-- preceding 'p' with word 'where' -->
5192
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5140
5193
  </fo:block>
5141
5194
  </xsl:when> <!-- END: a few components -->
5142
5195
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -5323,6 +5376,9 @@
5323
5376
 
5324
5377
  </xsl:template> <!-- END: dl -->
5325
5378
 
5379
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5380
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5381
+
5326
5382
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5327
5383
  <xsl:param name="process">false</xsl:param>
5328
5384
  <xsl:if test="$process = 'true'">
@@ -6160,8 +6216,8 @@
6160
6216
 
6161
6217
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
6162
6218
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
6163
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
6164
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
6219
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
6220
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
6165
6221
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
6166
6222
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
6167
6223
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -6172,8 +6228,19 @@
6172
6228
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
6173
6229
  <!-- add zero-width space (#x200B) after character: , -->
6174
6230
  <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
6231
+ <!-- add zero-width space (#x200B) after character: '/' -->
6232
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
6175
6233
 
6176
- <xsl:value-of select="$text7"/>
6234
+ <xsl:variable name="text9">
6235
+ <xsl:choose>
6236
+ <xsl:when test="$isGenerateTableIF = 'true'">
6237
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
6238
+ </xsl:when>
6239
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
6240
+ </xsl:choose>
6241
+ </xsl:variable>
6242
+
6243
+ <xsl:value-of select="$text9"/>
6177
6244
  </xsl:template>
6178
6245
 
6179
6246
  <xsl:template name="add-zero-spaces-link-java">
@@ -6181,8 +6248,8 @@
6181
6248
 
6182
6249
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
6183
6250
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
6184
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
6185
- <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
6251
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
6252
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
6186
6253
  <!-- remove zero-width space at the end -->
6187
6254
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
6188
6255
  </xsl:template>
@@ -6537,9 +6604,28 @@
6537
6604
  </xsl:variable>
6538
6605
  <xsl:copy-of select="$newRow"/>
6539
6606
 
6540
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6541
- <xsl:with-param name="previousRow" select="$newRow"/>
6542
- </xsl:apply-templates>
6607
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
6608
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
6609
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
6610
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
6611
+ <xsl:choose>
6612
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
6613
+ <xsl:copy-of select="following-sibling::tr"/>
6614
+ </xsl:when>
6615
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
6616
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
6617
+
6618
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6619
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
6620
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6621
+ </xsl:apply-templates>
6622
+ </xsl:when> -->
6623
+ <xsl:otherwise>
6624
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6625
+ <xsl:with-param name="previousRow" select="$newRow"/>
6626
+ </xsl:apply-templates>
6627
+ </xsl:otherwise>
6628
+ </xsl:choose>
6543
6629
  </xsl:template>
6544
6630
  <!-- End mode simple-table-rowspan -->
6545
6631
 
@@ -6702,6 +6788,27 @@
6702
6788
  </xsl:call-template>
6703
6789
  </xsl:template>
6704
6790
 
6791
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
6792
+ <xsl:variable name="link">
6793
+ <link_updated>
6794
+ <xsl:variable name="target_text">
6795
+ <xsl:choose>
6796
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
6797
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
6798
+ </xsl:when>
6799
+ <xsl:otherwise>
6800
+ <xsl:value-of select="normalize-space(@target)"/>
6801
+ </xsl:otherwise>
6802
+ </xsl:choose>
6803
+ </xsl:variable>
6804
+ <xsl:value-of select="$target_text"/>
6805
+ </link_updated>
6806
+ </xsl:variable>
6807
+ <xsl:for-each select="xalan:nodeset($link)/*">
6808
+ <xsl:apply-templates mode="td_text_with_formatting"/>
6809
+ </xsl:for-each>
6810
+ </xsl:template>
6811
+
6705
6812
  <xsl:template name="getFormattingTags">
6706
6813
  <tags>
6707
6814
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -7043,7 +7150,7 @@
7043
7150
  </xsl:variable>
7044
7151
  <fo:inline xsl:use-attribute-sets="link-style">
7045
7152
 
7046
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
7153
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
7047
7154
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7048
7155
  </xsl:if>
7049
7156
 
@@ -7406,10 +7513,10 @@
7406
7513
  <fo:block xsl:use-attribute-sets="figure-style">
7407
7514
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
7408
7515
  </fo:block>
7409
- <xsl:call-template name="fn_display_figure"/>
7410
7516
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7411
7517
  <xsl:call-template name="note"/>
7412
7518
  </xsl:for-each>
7519
+ <xsl:call-template name="fn_display_figure"/>
7413
7520
 
7414
7521
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
7415
7522
 
@@ -7472,7 +7579,13 @@
7472
7579
  </xsl:choose>
7473
7580
  </xsl:variable>
7474
7581
 
7475
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7582
+ <xsl:variable name="image_width_effective">
7583
+
7584
+ <xsl:value-of select="$width_effective"/>
7585
+
7586
+ </xsl:variable>
7587
+
7588
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7476
7589
  <xsl:if test="number($scale) &lt; 100">
7477
7590
 
7478
7591
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -8059,6 +8172,13 @@
8059
8172
  <xsl:when test="$contents_nodes/doc">
8060
8173
  <xsl:choose>
8061
8174
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
8175
+
8176
+ <xsl:if test="$contents_nodes/collection">
8177
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
8178
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
8179
+ </fo:bookmark>
8180
+ </xsl:if>
8181
+
8062
8182
  <xsl:for-each select="$contents_nodes/doc">
8063
8183
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
8064
8184
  <xsl:if test="@bundle = 'true'">
@@ -9942,6 +10062,44 @@
9942
10062
 
9943
10063
  <fo:list-block xsl:use-attribute-sets="list-style">
9944
10064
 
10065
+ <xsl:variable name="provisional_distance_between_starts_">
10066
+ <attributes xsl:use-attribute-sets="list-style">
10067
+
10068
+ </attributes>
10069
+ </xsl:variable>
10070
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
10071
+ <xsl:if test="$provisional_distance_between_starts != ''">
10072
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
10073
+ </xsl:if>
10074
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
10075
+
10076
+ <!-- increase provisional-distance-between-starts for long lists -->
10077
+ <xsl:if test="local-name() = 'ol'">
10078
+ <!-- Examples: xiii), xviii), xxviii) -->
10079
+ <xsl:variable name="item_numbers">
10080
+ <xsl:for-each select="*[local-name() = 'li']">
10081
+ <item><xsl:call-template name="getListItemFormat"/></item>
10082
+ </xsl:for-each>
10083
+ </xsl:variable>
10084
+
10085
+ <xsl:variable name="max_length">
10086
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
10087
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
10088
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
10089
+ </xsl:for-each>
10090
+ </xsl:variable>
10091
+
10092
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
10093
+ <xsl:variable name="addon" select="$max_length - 4"/>
10094
+ <xsl:if test="$addon &gt; 0">
10095
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
10096
+ </xsl:if>
10097
+ <!-- DEBUG -->
10098
+ <!-- <xsl:copy-of select="$item_numbers"/>
10099
+ <max_length><xsl:value-of select="$max_length"/></max_length>
10100
+ <addon><xsl:value-of select="$addon"/></addon> -->
10101
+ </xsl:if>
10102
+
9945
10103
  <xsl:if test="*[local-name() = 'name']">
9946
10104
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9947
10105
  </xsl:if>
@@ -10923,7 +11081,7 @@
10923
11081
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10924
11082
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10925
11083
  <!-- add &lt; and &gt; to \S -->
10926
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
11084
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
10927
11085
  <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
10928
11086
  <xsl:variable name="text3">
10929
11087
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -10945,7 +11103,8 @@
10945
11103
  <xsl:choose>
10946
11104
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
10947
11105
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10948
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
11106
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
11107
+ <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
10949
11108
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
10950
11109
  <xsl:choose>
10951
11110
  <xsl:when test="self::text()">
@@ -11548,6 +11707,23 @@
11548
11707
  </xsl:if>
11549
11708
  </xsl:template>
11550
11709
 
11710
+ <xsl:template name="setBlockAttributes">
11711
+ <xsl:param name="text_align_default">left</xsl:param>
11712
+ <xsl:call-template name="setTextAlignment">
11713
+ <xsl:with-param name="default" select="$text_align_default"/>
11714
+ </xsl:call-template>
11715
+
11716
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
11717
+ <!-- Example: keep-lines-together="true" -->
11718
+ <xsl:if test="@keep-lines-together = 'true'">
11719
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
11720
+ </xsl:if>
11721
+ <!-- Example: keep-with-next="true" -->
11722
+ <xsl:if test="@keep-with-next = 'true'">
11723
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11724
+ </xsl:if>
11725
+ </xsl:template>
11726
+
11551
11727
  <xsl:template name="number-to-words">
11552
11728
  <xsl:param name="number"/>
11553
11729
  <xsl:param name="first"/>