metanorma-iso 2.3.6 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2887,11 +2887,11 @@
2887
2887
 
2888
2888
  <xsl:attribute-set name="table-header-cell-style">
2889
2889
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2890
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2891
2890
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2892
2891
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2893
2892
  <xsl:attribute name="display-align">center</xsl:attribute>
2894
2893
 
2894
+ <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2895
2895
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2896
2896
  <xsl:attribute name="border-left"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2897
2897
  <xsl:attribute name="border-right"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
@@ -2900,7 +2900,6 @@
2900
2900
 
2901
2901
  <xsl:attribute-set name="table-cell-style">
2902
2902
  <xsl:attribute name="display-align">center</xsl:attribute>
2903
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2904
2903
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2905
2904
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2906
2905
 
@@ -3652,7 +3651,7 @@
3652
3651
  <xsl:apply-templates select="." mode="contents"/>
3653
3652
  </xsl:for-each>
3654
3653
 
3655
- <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')]]">
3654
+ <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]">
3656
3655
  <xsl:sort select="@displayorder" data-type="number"/>
3657
3656
  <xsl:apply-templates select="." mode="contents"/>
3658
3657
  </xsl:for-each>
@@ -4625,6 +4624,10 @@
4625
4624
  </xsl:choose>
4626
4625
  </xsl:variable>
4627
4626
 
4627
+ <xsl:variable name="table_fn_block">
4628
+ <xsl:call-template name="table_fn_display"/>
4629
+ </xsl:variable>
4630
+
4628
4631
  <xsl:variable name="tableWithNotesAndFootnotes">
4629
4632
 
4630
4633
  <fo:table keep-with-previous="always">
@@ -4672,11 +4675,25 @@
4672
4675
 
4673
4676
  <xsl:apply-templates select="../*[local-name()='note']"/>
4674
4677
 
4678
+ <xsl:variable name="isDisplayRowSeparator">
4679
+
4680
+ </xsl:variable>
4681
+
4675
4682
  <!-- horizontal row separator -->
4683
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4684
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
4685
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4686
+
4687
+ <xsl:call-template name="setBordersTableArray"/>
4688
+ <fo:block font-size="1pt"> </fo:block>
4689
+ </fo:block-container>
4690
+ </xsl:if>
4691
+ </xsl:if>
4676
4692
 
4677
4693
  <!-- fn processing -->
4678
4694
 
4679
- <xsl:call-template name="table_fn_display"/>
4695
+ <!-- <xsl:call-template name="table_fn_display" /> -->
4696
+ <xsl:copy-of select="$table_fn_block"/>
4680
4697
 
4681
4698
  <!-- for PAS display Notes after footnotes -->
4682
4699
 
@@ -4848,6 +4865,28 @@
4848
4865
  </fo:table-row>
4849
4866
  </xsl:template>
4850
4867
 
4868
+ <xsl:template name="setBorderUnderRow">
4869
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
4870
+ <xsl:choose>
4871
+ <xsl:when test="$border_under_row_ != ''">
4872
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
4873
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
4874
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
4875
+ <xsl:variable name="border_under_row">
4876
+ <xsl:call-template name="split">
4877
+ <xsl:with-param name="pText" select="$border_under_row_"/>
4878
+ </xsl:call-template>
4879
+ </xsl:variable>
4880
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
4881
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4882
+ </xsl:if>
4883
+ </xsl:when>
4884
+ <xsl:otherwise>
4885
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4886
+ </xsl:otherwise>
4887
+ </xsl:choose>
4888
+ </xsl:template>
4889
+
4851
4890
  <!-- row in table footer (tfoot) -->
4852
4891
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4853
4892
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -5198,8 +5237,16 @@
5198
5237
  <!-- figure's footnotes rendering -->
5199
5238
  <xsl:template name="fn_display_figure">
5200
5239
 
5240
+ <!-- current figure id -->
5241
+ <xsl:variable name="figure_id_">
5242
+ <xsl:value-of select="@id"/>
5243
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
5244
+ </xsl:variable>
5245
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
5246
+
5247
+ <!-- all footnotes relates to the current figure -->
5201
5248
  <xsl:variable name="references">
5202
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
5249
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
5203
5250
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5204
5251
  <xsl:apply-templates/>
5205
5252
  </fn>
@@ -5212,91 +5259,93 @@
5212
5259
  true
5213
5260
  </xsl:variable>
5214
5261
 
5215
- <!-- current hierarchy is 'figure' element -->
5216
- <xsl:variable name="following_dl_colwidths">
5217
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5218
- <xsl:variable name="simple-table">
5219
- <!-- <xsl:variable name="doc_ns">
5220
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5262
+ <fo:block>
5263
+
5264
+ <!-- current hierarchy is 'figure' element -->
5265
+ <xsl:variable name="following_dl_colwidths">
5266
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5267
+ <xsl:variable name="simple-table">
5268
+ <!-- <xsl:variable name="doc_ns">
5269
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5270
+ </xsl:variable>
5271
+ <xsl:variable name="ns">
5272
+ <xsl:choose>
5273
+ <xsl:when test="normalize-space($doc_ns) != ''">
5274
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5275
+ </xsl:when>
5276
+ <xsl:otherwise>
5277
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5278
+ </xsl:otherwise>
5279
+ </xsl:choose>
5280
+ </xsl:variable> -->
5281
+
5282
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5283
+ <tbody>
5284
+ <xsl:apply-templates mode="dl"/>
5285
+ </tbody>
5286
+ </xsl:for-each>
5287
+ </xsl:variable>
5288
+
5289
+ <xsl:call-template name="calculate-column-widths">
5290
+ <xsl:with-param name="cols-count" select="2"/>
5291
+ <xsl:with-param name="table" select="$simple-table"/>
5292
+ </xsl:call-template>
5293
+
5294
+ </xsl:if>
5221
5295
  </xsl:variable>
5222
- <xsl:variable name="ns">
5296
+
5297
+ <xsl:variable name="maxlength_dt">
5298
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5299
+ <xsl:call-template name="getMaxLength_dt"/>
5300
+ </xsl:for-each>
5301
+ </xsl:variable>
5302
+
5303
+ <fo:table width="95%" table-layout="fixed">
5304
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5305
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5306
+
5307
+ </xsl:if>
5223
5308
  <xsl:choose>
5224
- <xsl:when test="normalize-space($doc_ns) != ''">
5225
- <xsl:value-of select="normalize-space($doc_ns)"/>
5309
+ <!-- if there 'dl', then set same columns width -->
5310
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5311
+ <xsl:call-template name="setColumnWidth_dl">
5312
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5313
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5314
+ </xsl:call-template>
5226
5315
  </xsl:when>
5227
5316
  <xsl:otherwise>
5228
- <xsl:value-of select="substring-before(name(/*), '-')"/>
5317
+ <fo:table-column column-width="5%"/>
5318
+ <fo:table-column column-width="95%"/>
5229
5319
  </xsl:otherwise>
5230
5320
  </xsl:choose>
5231
- </xsl:variable> -->
5232
-
5233
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5234
- <tbody>
5235
- <xsl:apply-templates mode="dl"/>
5236
- </tbody>
5237
- </xsl:for-each>
5238
- </xsl:variable>
5239
-
5240
- <xsl:call-template name="calculate-column-widths">
5241
- <xsl:with-param name="cols-count" select="2"/>
5242
- <xsl:with-param name="table" select="$simple-table"/>
5243
- </xsl:call-template>
5244
-
5245
- </xsl:if>
5246
- </xsl:variable>
5247
-
5248
- <xsl:variable name="maxlength_dt">
5249
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5250
- <xsl:call-template name="getMaxLength_dt"/>
5251
- </xsl:for-each>
5252
- </xsl:variable>
5321
+ <fo:table-body>
5322
+ <xsl:for-each select="xalan:nodeset($references)//fn">
5323
+ <xsl:variable name="reference" select="@reference"/>
5324
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5325
+ <fo:table-row>
5326
+ <fo:table-cell>
5327
+ <fo:block>
5328
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5329
+ <xsl:value-of select="@reference"/>
5330
+ </fo:inline>
5331
+ </fo:block>
5332
+ </fo:table-cell>
5333
+ <fo:table-cell>
5334
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5335
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5253
5336
 
5254
- <fo:block>
5255
- <fo:table width="95%" table-layout="fixed">
5256
- <xsl:if test="normalize-space($key_iso) = 'true'">
5257
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5337
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5258
5338
 
5259
- </xsl:if>
5260
- <xsl:choose>
5261
- <!-- if there 'dl', then set same columns width -->
5262
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5263
- <xsl:call-template name="setColumnWidth_dl">
5264
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5265
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5266
- </xsl:call-template>
5267
- </xsl:when>
5268
- <xsl:otherwise>
5269
- <fo:table-column column-width="15%"/>
5270
- <fo:table-column column-width="85%"/>
5271
- </xsl:otherwise>
5272
- </xsl:choose>
5273
- <fo:table-body>
5274
- <xsl:for-each select="xalan:nodeset($references)//fn">
5275
- <xsl:variable name="reference" select="@reference"/>
5276
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5277
- <fo:table-row>
5278
- <fo:table-cell>
5279
- <fo:block>
5280
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5281
- <xsl:value-of select="@reference"/>
5282
- </fo:inline>
5283
- </fo:block>
5284
- </fo:table-cell>
5285
- <fo:table-cell>
5286
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5287
- <xsl:if test="normalize-space($key_iso) = 'true'">
5288
-
5289
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5339
+ </xsl:if>
5340
+ <xsl:copy-of select="./node()"/>
5341
+ </fo:block>
5342
+ </fo:table-cell>
5343
+ </fo:table-row>
5344
+ </xsl:if>
5345
+ </xsl:for-each>
5346
+ </fo:table-body>
5347
+ </fo:table>
5290
5348
 
5291
- </xsl:if>
5292
- <xsl:copy-of select="./node()"/>
5293
- </fo:block>
5294
- </fo:table-cell>
5295
- </fo:table-row>
5296
- </xsl:if>
5297
- </xsl:for-each>
5298
- </fo:table-body>
5299
- </fo:table>
5300
5349
  </fo:block>
5301
5350
  </xsl:if>
5302
5351
 
@@ -5381,12 +5430,14 @@
5381
5430
 
5382
5431
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
5383
5432
 
5384
- <xsl:variable name="title-where">
5433
+ <!-- <xsl:variable name="title-where">
5385
5434
  <xsl:call-template name="getLocalizedString">
5386
5435
  <xsl:with-param name="key">where</xsl:with-param>
5387
5436
  </xsl:call-template>
5388
5437
  </xsl:variable>
5389
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
5438
+ <xsl:value-of select="$title-where"/> -->
5439
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5440
+ <xsl:text> </xsl:text>
5390
5441
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5391
5442
  <xsl:text/>
5392
5443
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -5398,12 +5449,14 @@
5398
5449
 
5399
5450
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5400
5451
 
5401
- <xsl:variable name="title-where">
5452
+ <!-- <xsl:variable name="title-where">
5402
5453
  <xsl:call-template name="getLocalizedString">
5403
5454
  <xsl:with-param name="key">where</xsl:with-param>
5404
5455
  </xsl:call-template>
5405
5456
  </xsl:variable>
5406
- <xsl:value-of select="$title-where"/>
5457
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
5458
+ <!-- preceding 'p' with word 'where' -->
5459
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5407
5460
  </fo:block>
5408
5461
  </xsl:when> <!-- END: a few components -->
5409
5462
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -5598,6 +5651,9 @@
5598
5651
 
5599
5652
  </xsl:template> <!-- END: dl -->
5600
5653
 
5654
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5655
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5656
+
5601
5657
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5602
5658
  <xsl:param name="process">false</xsl:param>
5603
5659
  <xsl:if test="$process = 'true'">
@@ -6496,8 +6552,8 @@
6496
6552
 
6497
6553
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
6498
6554
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
6499
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
6500
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
6555
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
6556
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
6501
6557
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
6502
6558
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
6503
6559
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -6508,8 +6564,19 @@
6508
6564
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
6509
6565
  <!-- add zero-width space (#x200B) after character: , -->
6510
6566
  <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
6567
+ <!-- add zero-width space (#x200B) after character: '/' -->
6568
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
6511
6569
 
6512
- <xsl:value-of select="$text7"/>
6570
+ <xsl:variable name="text9">
6571
+ <xsl:choose>
6572
+ <xsl:when test="$isGenerateTableIF = 'true'">
6573
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
6574
+ </xsl:when>
6575
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
6576
+ </xsl:choose>
6577
+ </xsl:variable>
6578
+
6579
+ <xsl:value-of select="$text9"/>
6513
6580
  </xsl:template>
6514
6581
 
6515
6582
  <xsl:template name="add-zero-spaces-link-java">
@@ -6517,8 +6584,8 @@
6517
6584
 
6518
6585
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
6519
6586
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
6520
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
6521
- <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
6587
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
6588
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
6522
6589
  <!-- remove zero-width space at the end -->
6523
6590
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
6524
6591
  </xsl:template>
@@ -6873,9 +6940,28 @@
6873
6940
  </xsl:variable>
6874
6941
  <xsl:copy-of select="$newRow"/>
6875
6942
 
6876
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6877
- <xsl:with-param name="previousRow" select="$newRow"/>
6878
- </xsl:apply-templates>
6943
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
6944
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
6945
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
6946
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
6947
+ <xsl:choose>
6948
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
6949
+ <xsl:copy-of select="following-sibling::tr"/>
6950
+ </xsl:when>
6951
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
6952
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
6953
+
6954
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6955
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
6956
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6957
+ </xsl:apply-templates>
6958
+ </xsl:when> -->
6959
+ <xsl:otherwise>
6960
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6961
+ <xsl:with-param name="previousRow" select="$newRow"/>
6962
+ </xsl:apply-templates>
6963
+ </xsl:otherwise>
6964
+ </xsl:choose>
6879
6965
  </xsl:template>
6880
6966
  <!-- End mode simple-table-rowspan -->
6881
6967
 
@@ -7038,6 +7124,27 @@
7038
7124
  </xsl:call-template>
7039
7125
  </xsl:template>
7040
7126
 
7127
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
7128
+ <xsl:variable name="link">
7129
+ <link_updated>
7130
+ <xsl:variable name="target_text">
7131
+ <xsl:choose>
7132
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
7133
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
7134
+ </xsl:when>
7135
+ <xsl:otherwise>
7136
+ <xsl:value-of select="normalize-space(@target)"/>
7137
+ </xsl:otherwise>
7138
+ </xsl:choose>
7139
+ </xsl:variable>
7140
+ <xsl:value-of select="$target_text"/>
7141
+ </link_updated>
7142
+ </xsl:variable>
7143
+ <xsl:for-each select="xalan:nodeset($link)/*">
7144
+ <xsl:apply-templates mode="td_text_with_formatting"/>
7145
+ </xsl:for-each>
7146
+ </xsl:template>
7147
+
7041
7148
  <xsl:template name="getFormattingTags">
7042
7149
  <tags>
7043
7150
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -7386,7 +7493,7 @@
7386
7493
  </xsl:variable>
7387
7494
  <fo:inline xsl:use-attribute-sets="link-style">
7388
7495
 
7389
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
7496
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
7390
7497
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7391
7498
  </xsl:if>
7392
7499
 
@@ -7753,10 +7860,10 @@
7753
7860
  <fo:block xsl:use-attribute-sets="figure-style">
7754
7861
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
7755
7862
  </fo:block>
7756
- <xsl:call-template name="fn_display_figure"/>
7757
7863
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7758
7864
  <xsl:call-template name="note"/>
7759
7865
  </xsl:for-each>
7866
+ <xsl:call-template name="fn_display_figure"/>
7760
7867
 
7761
7868
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
7762
7869
 
@@ -7819,7 +7926,13 @@
7819
7926
  </xsl:choose>
7820
7927
  </xsl:variable>
7821
7928
 
7822
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7929
+ <xsl:variable name="image_width_effective">
7930
+
7931
+ <xsl:value-of select="$width_effective"/>
7932
+
7933
+ </xsl:variable>
7934
+
7935
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7823
7936
  <xsl:if test="number($scale) &lt; 100">
7824
7937
 
7825
7938
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -8406,6 +8519,13 @@
8406
8519
  <xsl:when test="$contents_nodes/doc">
8407
8520
  <xsl:choose>
8408
8521
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
8522
+
8523
+ <xsl:if test="$contents_nodes/collection">
8524
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
8525
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
8526
+ </fo:bookmark>
8527
+ </xsl:if>
8528
+
8409
8529
  <xsl:for-each select="$contents_nodes/doc">
8410
8530
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
8411
8531
  <xsl:if test="@bundle = 'true'">
@@ -10288,6 +10408,44 @@
10288
10408
 
10289
10409
  <fo:list-block xsl:use-attribute-sets="list-style">
10290
10410
 
10411
+ <xsl:variable name="provisional_distance_between_starts_">
10412
+ <attributes xsl:use-attribute-sets="list-style">
10413
+
10414
+ </attributes>
10415
+ </xsl:variable>
10416
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
10417
+ <xsl:if test="$provisional_distance_between_starts != ''">
10418
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
10419
+ </xsl:if>
10420
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
10421
+
10422
+ <!-- increase provisional-distance-between-starts for long lists -->
10423
+ <xsl:if test="local-name() = 'ol'">
10424
+ <!-- Examples: xiii), xviii), xxviii) -->
10425
+ <xsl:variable name="item_numbers">
10426
+ <xsl:for-each select="*[local-name() = 'li']">
10427
+ <item><xsl:call-template name="getListItemFormat"/></item>
10428
+ </xsl:for-each>
10429
+ </xsl:variable>
10430
+
10431
+ <xsl:variable name="max_length">
10432
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
10433
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
10434
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
10435
+ </xsl:for-each>
10436
+ </xsl:variable>
10437
+
10438
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
10439
+ <xsl:variable name="addon" select="$max_length - 4"/>
10440
+ <xsl:if test="$addon &gt; 0">
10441
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
10442
+ </xsl:if>
10443
+ <!-- DEBUG -->
10444
+ <!-- <xsl:copy-of select="$item_numbers"/>
10445
+ <max_length><xsl:value-of select="$max_length"/></max_length>
10446
+ <addon><xsl:value-of select="$addon"/></addon> -->
10447
+ </xsl:if>
10448
+
10291
10449
  <xsl:if test="not(ancestor::*[local-name() = 'ul' or local-name() = 'ol'])">
10292
10450
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
10293
10451
  </xsl:if>
@@ -11356,7 +11514,7 @@
11356
11514
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
11357
11515
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
11358
11516
  <!-- add &lt; and &gt; to \S -->
11359
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
11517
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
11360
11518
  <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>
11361
11519
  <xsl:variable name="text3">
11362
11520
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -11378,7 +11536,8 @@
11378
11536
  <xsl:choose>
11379
11537
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
11380
11538
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
11381
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
11539
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
11540
+ <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>
11382
11541
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
11383
11542
  <xsl:choose>
11384
11543
  <xsl:when test="self::text()">
@@ -11981,6 +12140,23 @@
11981
12140
  </xsl:if>
11982
12141
  </xsl:template>
11983
12142
 
12143
+ <xsl:template name="setBlockAttributes">
12144
+ <xsl:param name="text_align_default">left</xsl:param>
12145
+ <xsl:call-template name="setTextAlignment">
12146
+ <xsl:with-param name="default" select="$text_align_default"/>
12147
+ </xsl:call-template>
12148
+
12149
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
12150
+ <!-- Example: keep-lines-together="true" -->
12151
+ <xsl:if test="@keep-lines-together = 'true'">
12152
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
12153
+ </xsl:if>
12154
+ <!-- Example: keep-with-next="true" -->
12155
+ <xsl:if test="@keep-with-next = 'true'">
12156
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
12157
+ </xsl:if>
12158
+ </xsl:template>
12159
+
11984
12160
  <xsl:template name="number-to-words">
11985
12161
  <xsl:param name="number"/>
11986
12162
  <xsl:param name="first"/>