metanorma-ogc 2.3.4 → 2.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -2101,7 +2101,6 @@
2101
2101
 
2102
2102
  <xsl:attribute-set name="table-header-cell-style">
2103
2103
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2104
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2105
2104
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2106
2105
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2107
2106
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -2114,7 +2113,6 @@
2114
2113
 
2115
2114
  <xsl:attribute-set name="table-cell-style">
2116
2115
  <xsl:attribute name="display-align">center</xsl:attribute>
2117
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2118
2116
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2119
2117
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2120
2118
 
@@ -2887,7 +2885,7 @@
2887
2885
  <xsl:apply-templates select="." mode="contents"/>
2888
2886
  </xsl:for-each>
2889
2887
 
2890
- <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')]]">
2888
+ <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]">
2891
2889
  <xsl:sort select="@displayorder" data-type="number"/>
2892
2890
  <xsl:apply-templates select="." mode="contents"/>
2893
2891
  </xsl:for-each>
@@ -3835,6 +3833,10 @@
3835
3833
  </xsl:choose>
3836
3834
  </xsl:variable>
3837
3835
 
3836
+ <xsl:variable name="table_fn_block">
3837
+ <xsl:call-template name="table_fn_display"/>
3838
+ </xsl:variable>
3839
+
3838
3840
  <xsl:variable name="tableWithNotesAndFootnotes">
3839
3841
 
3840
3842
  <fo:table keep-with-previous="always">
@@ -3882,11 +3884,25 @@
3882
3884
 
3883
3885
  <xsl:apply-templates select="../*[local-name()='note']"/>
3884
3886
 
3887
+ <xsl:variable name="isDisplayRowSeparator">
3888
+
3889
+ </xsl:variable>
3890
+
3885
3891
  <!-- horizontal row separator -->
3892
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3893
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3894
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3895
+
3896
+ <xsl:call-template name="setBordersTableArray"/>
3897
+ <fo:block font-size="1pt"> </fo:block>
3898
+ </fo:block-container>
3899
+ </xsl:if>
3900
+ </xsl:if>
3886
3901
 
3887
3902
  <!-- fn processing -->
3888
3903
 
3889
- <xsl:call-template name="table_fn_display"/>
3904
+ <!-- <xsl:call-template name="table_fn_display" /> -->
3905
+ <xsl:copy-of select="$table_fn_block"/>
3890
3906
 
3891
3907
  <!-- for PAS display Notes after footnotes -->
3892
3908
 
@@ -4003,6 +4019,28 @@
4003
4019
  </fo:table-row>
4004
4020
  </xsl:template>
4005
4021
 
4022
+ <xsl:template name="setBorderUnderRow">
4023
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
4024
+ <xsl:choose>
4025
+ <xsl:when test="$border_under_row_ != ''">
4026
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
4027
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
4028
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
4029
+ <xsl:variable name="border_under_row">
4030
+ <xsl:call-template name="split">
4031
+ <xsl:with-param name="pText" select="$border_under_row_"/>
4032
+ </xsl:call-template>
4033
+ </xsl:variable>
4034
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
4035
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4036
+ </xsl:if>
4037
+ </xsl:when>
4038
+ <xsl:otherwise>
4039
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4040
+ </xsl:otherwise>
4041
+ </xsl:choose>
4042
+ </xsl:template>
4043
+
4006
4044
  <!-- row in table footer (tfoot) -->
4007
4045
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4008
4046
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -4351,8 +4389,16 @@
4351
4389
  <!-- figure's footnotes rendering -->
4352
4390
  <xsl:template name="fn_display_figure">
4353
4391
 
4392
+ <!-- current figure id -->
4393
+ <xsl:variable name="figure_id_">
4394
+ <xsl:value-of select="@id"/>
4395
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4396
+ </xsl:variable>
4397
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4398
+
4399
+ <!-- all footnotes relates to the current figure -->
4354
4400
  <xsl:variable name="references">
4355
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
4401
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4356
4402
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4357
4403
  <xsl:apply-templates/>
4358
4404
  </fn>
@@ -4365,91 +4411,93 @@
4365
4411
 
4366
4412
  </xsl:variable>
4367
4413
 
4368
- <!-- current hierarchy is 'figure' element -->
4369
- <xsl:variable name="following_dl_colwidths">
4370
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4371
- <xsl:variable name="simple-table">
4372
- <!-- <xsl:variable name="doc_ns">
4373
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4414
+ <fo:block>
4415
+
4416
+ <!-- current hierarchy is 'figure' element -->
4417
+ <xsl:variable name="following_dl_colwidths">
4418
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4419
+ <xsl:variable name="simple-table">
4420
+ <!-- <xsl:variable name="doc_ns">
4421
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4422
+ </xsl:variable>
4423
+ <xsl:variable name="ns">
4424
+ <xsl:choose>
4425
+ <xsl:when test="normalize-space($doc_ns) != ''">
4426
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4427
+ </xsl:when>
4428
+ <xsl:otherwise>
4429
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4430
+ </xsl:otherwise>
4431
+ </xsl:choose>
4432
+ </xsl:variable> -->
4433
+
4434
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4435
+ <tbody>
4436
+ <xsl:apply-templates mode="dl"/>
4437
+ </tbody>
4438
+ </xsl:for-each>
4439
+ </xsl:variable>
4440
+
4441
+ <xsl:call-template name="calculate-column-widths">
4442
+ <xsl:with-param name="cols-count" select="2"/>
4443
+ <xsl:with-param name="table" select="$simple-table"/>
4444
+ </xsl:call-template>
4445
+
4446
+ </xsl:if>
4374
4447
  </xsl:variable>
4375
- <xsl:variable name="ns">
4448
+
4449
+ <xsl:variable name="maxlength_dt">
4450
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4451
+ <xsl:call-template name="getMaxLength_dt"/>
4452
+ </xsl:for-each>
4453
+ </xsl:variable>
4454
+
4455
+ <fo:table width="95%" table-layout="fixed">
4456
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4457
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4458
+
4459
+ </xsl:if>
4376
4460
  <xsl:choose>
4377
- <xsl:when test="normalize-space($doc_ns) != ''">
4378
- <xsl:value-of select="normalize-space($doc_ns)"/>
4461
+ <!-- if there 'dl', then set same columns width -->
4462
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4463
+ <xsl:call-template name="setColumnWidth_dl">
4464
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4465
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4466
+ </xsl:call-template>
4379
4467
  </xsl:when>
4380
4468
  <xsl:otherwise>
4381
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4469
+ <fo:table-column column-width="5%"/>
4470
+ <fo:table-column column-width="95%"/>
4382
4471
  </xsl:otherwise>
4383
4472
  </xsl:choose>
4384
- </xsl:variable> -->
4385
-
4386
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4387
- <tbody>
4388
- <xsl:apply-templates mode="dl"/>
4389
- </tbody>
4390
- </xsl:for-each>
4391
- </xsl:variable>
4392
-
4393
- <xsl:call-template name="calculate-column-widths">
4394
- <xsl:with-param name="cols-count" select="2"/>
4395
- <xsl:with-param name="table" select="$simple-table"/>
4396
- </xsl:call-template>
4397
-
4398
- </xsl:if>
4399
- </xsl:variable>
4400
-
4401
- <xsl:variable name="maxlength_dt">
4402
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4403
- <xsl:call-template name="getMaxLength_dt"/>
4404
- </xsl:for-each>
4405
- </xsl:variable>
4473
+ <fo:table-body>
4474
+ <xsl:for-each select="xalan:nodeset($references)//fn">
4475
+ <xsl:variable name="reference" select="@reference"/>
4476
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4477
+ <fo:table-row>
4478
+ <fo:table-cell>
4479
+ <fo:block>
4480
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4481
+ <xsl:value-of select="@reference"/>
4482
+ </fo:inline>
4483
+ </fo:block>
4484
+ </fo:table-cell>
4485
+ <fo:table-cell>
4486
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4487
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4406
4488
 
4407
- <fo:block>
4408
- <fo:table width="95%" table-layout="fixed">
4409
- <xsl:if test="normalize-space($key_iso) = 'true'">
4410
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4489
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4411
4490
 
4412
- </xsl:if>
4413
- <xsl:choose>
4414
- <!-- if there 'dl', then set same columns width -->
4415
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4416
- <xsl:call-template name="setColumnWidth_dl">
4417
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4418
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4419
- </xsl:call-template>
4420
- </xsl:when>
4421
- <xsl:otherwise>
4422
- <fo:table-column column-width="15%"/>
4423
- <fo:table-column column-width="85%"/>
4424
- </xsl:otherwise>
4425
- </xsl:choose>
4426
- <fo:table-body>
4427
- <xsl:for-each select="xalan:nodeset($references)//fn">
4428
- <xsl:variable name="reference" select="@reference"/>
4429
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4430
- <fo:table-row>
4431
- <fo:table-cell>
4432
- <fo:block>
4433
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4434
- <xsl:value-of select="@reference"/>
4435
- </fo:inline>
4436
- </fo:block>
4437
- </fo:table-cell>
4438
- <fo:table-cell>
4439
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4440
- <xsl:if test="normalize-space($key_iso) = 'true'">
4441
-
4442
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4491
+ </xsl:if>
4492
+ <xsl:copy-of select="./node()"/>
4493
+ </fo:block>
4494
+ </fo:table-cell>
4495
+ </fo:table-row>
4496
+ </xsl:if>
4497
+ </xsl:for-each>
4498
+ </fo:table-body>
4499
+ </fo:table>
4443
4500
 
4444
- </xsl:if>
4445
- <xsl:copy-of select="./node()"/>
4446
- </fo:block>
4447
- </fo:table-cell>
4448
- </fo:table-row>
4449
- </xsl:if>
4450
- </xsl:for-each>
4451
- </fo:table-body>
4452
- </fo:table>
4453
4501
  </fo:block>
4454
4502
  </xsl:if>
4455
4503
 
@@ -4530,12 +4578,14 @@
4530
4578
 
4531
4579
  <fo:block margin-bottom="12pt" text-align="left">
4532
4580
 
4533
- <xsl:variable name="title-where">
4581
+ <!-- <xsl:variable name="title-where">
4534
4582
  <xsl:call-template name="getLocalizedString">
4535
4583
  <xsl:with-param name="key">where</xsl:with-param>
4536
4584
  </xsl:call-template>
4537
4585
  </xsl:variable>
4538
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4586
+ <xsl:value-of select="$title-where"/> -->
4587
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4588
+ <xsl:text> </xsl:text>
4539
4589
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4540
4590
  <xsl:text/>
4541
4591
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -4545,12 +4595,14 @@
4545
4595
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4546
4596
  <fo:block margin-bottom="12pt" text-align="left">
4547
4597
 
4548
- <xsl:variable name="title-where">
4598
+ <!-- <xsl:variable name="title-where">
4549
4599
  <xsl:call-template name="getLocalizedString">
4550
4600
  <xsl:with-param name="key">where</xsl:with-param>
4551
4601
  </xsl:call-template>
4552
4602
  </xsl:variable>
4553
- <xsl:value-of select="$title-where"/>
4603
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
4604
+ <!-- preceding 'p' with word 'where' -->
4605
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4554
4606
  </fo:block>
4555
4607
  </xsl:when> <!-- END: a few components -->
4556
4608
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -4733,6 +4785,9 @@
4733
4785
 
4734
4786
  </xsl:template> <!-- END: dl -->
4735
4787
 
4788
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4789
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4790
+
4736
4791
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4737
4792
  <xsl:param name="process">false</xsl:param>
4738
4793
  <xsl:if test="$process = 'true'">
@@ -5565,8 +5620,8 @@
5565
5620
 
5566
5621
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
5567
5622
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
5568
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
5569
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
5623
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
5624
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
5570
5625
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
5571
5626
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
5572
5627
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -5577,8 +5632,19 @@
5577
5632
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5578
5633
  <!-- add zero-width space (#x200B) after character: , -->
5579
5634
  <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5635
+ <!-- add zero-width space (#x200B) after character: '/' -->
5636
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
5637
+
5638
+ <xsl:variable name="text9">
5639
+ <xsl:choose>
5640
+ <xsl:when test="$isGenerateTableIF = 'true'">
5641
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
5642
+ </xsl:when>
5643
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
5644
+ </xsl:choose>
5645
+ </xsl:variable>
5580
5646
 
5581
- <xsl:value-of select="$text7"/>
5647
+ <xsl:value-of select="$text9"/>
5582
5648
  </xsl:template>
5583
5649
 
5584
5650
  <xsl:template name="add-zero-spaces-link-java">
@@ -5586,8 +5652,8 @@
5586
5652
 
5587
5653
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
5588
5654
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
5589
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5590
- <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
5655
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
5656
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
5591
5657
  <!-- remove zero-width space at the end -->
5592
5658
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
5593
5659
  </xsl:template>
@@ -5942,9 +6008,28 @@
5942
6008
  </xsl:variable>
5943
6009
  <xsl:copy-of select="$newRow"/>
5944
6010
 
5945
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5946
- <xsl:with-param name="previousRow" select="$newRow"/>
5947
- </xsl:apply-templates>
6011
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
6012
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
6013
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
6014
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
6015
+ <xsl:choose>
6016
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
6017
+ <xsl:copy-of select="following-sibling::tr"/>
6018
+ </xsl:when>
6019
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
6020
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
6021
+
6022
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6023
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
6024
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6025
+ </xsl:apply-templates>
6026
+ </xsl:when> -->
6027
+ <xsl:otherwise>
6028
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6029
+ <xsl:with-param name="previousRow" select="$newRow"/>
6030
+ </xsl:apply-templates>
6031
+ </xsl:otherwise>
6032
+ </xsl:choose>
5948
6033
  </xsl:template>
5949
6034
  <!-- End mode simple-table-rowspan -->
5950
6035
 
@@ -6107,6 +6192,27 @@
6107
6192
  </xsl:call-template>
6108
6193
  </xsl:template>
6109
6194
 
6195
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
6196
+ <xsl:variable name="link">
6197
+ <link_updated>
6198
+ <xsl:variable name="target_text">
6199
+ <xsl:choose>
6200
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
6201
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
6202
+ </xsl:when>
6203
+ <xsl:otherwise>
6204
+ <xsl:value-of select="normalize-space(@target)"/>
6205
+ </xsl:otherwise>
6206
+ </xsl:choose>
6207
+ </xsl:variable>
6208
+ <xsl:value-of select="$target_text"/>
6209
+ </link_updated>
6210
+ </xsl:variable>
6211
+ <xsl:for-each select="xalan:nodeset($link)/*">
6212
+ <xsl:apply-templates mode="td_text_with_formatting"/>
6213
+ </xsl:for-each>
6214
+ </xsl:template>
6215
+
6110
6216
  <xsl:template name="getFormattingTags">
6111
6217
  <tags>
6112
6218
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -6448,7 +6554,7 @@
6448
6554
  </xsl:variable>
6449
6555
  <fo:inline xsl:use-attribute-sets="link-style">
6450
6556
 
6451
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
6557
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
6452
6558
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6453
6559
  </xsl:if>
6454
6560
 
@@ -6811,10 +6917,10 @@
6811
6917
  <fo:block xsl:use-attribute-sets="figure-style">
6812
6918
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
6813
6919
  </fo:block>
6814
- <xsl:call-template name="fn_display_figure"/>
6815
6920
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
6816
6921
  <xsl:call-template name="note"/>
6817
6922
  </xsl:for-each>
6923
+ <xsl:call-template name="fn_display_figure"/>
6818
6924
 
6819
6925
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
6820
6926
 
@@ -6877,7 +6983,13 @@
6877
6983
  </xsl:choose>
6878
6984
  </xsl:variable>
6879
6985
 
6880
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6986
+ <xsl:variable name="image_width_effective">
6987
+
6988
+ <xsl:value-of select="$width_effective"/>
6989
+
6990
+ </xsl:variable>
6991
+
6992
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6881
6993
  <xsl:if test="number($scale) &lt; 100">
6882
6994
 
6883
6995
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -7464,6 +7576,13 @@
7464
7576
  <xsl:when test="$contents_nodes/doc">
7465
7577
  <xsl:choose>
7466
7578
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
7579
+
7580
+ <xsl:if test="$contents_nodes/collection">
7581
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
7582
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
7583
+ </fo:bookmark>
7584
+ </xsl:if>
7585
+
7467
7586
  <xsl:for-each select="$contents_nodes/doc">
7468
7587
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7469
7588
  <xsl:if test="@bundle = 'true'">
@@ -9392,6 +9511,44 @@
9392
9511
 
9393
9512
  <fo:list-block xsl:use-attribute-sets="list-style">
9394
9513
 
9514
+ <xsl:variable name="provisional_distance_between_starts_">
9515
+ <attributes xsl:use-attribute-sets="list-style">
9516
+
9517
+ </attributes>
9518
+ </xsl:variable>
9519
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
9520
+ <xsl:if test="$provisional_distance_between_starts != ''">
9521
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
9522
+ </xsl:if>
9523
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
9524
+
9525
+ <!-- increase provisional-distance-between-starts for long lists -->
9526
+ <xsl:if test="local-name() = 'ol'">
9527
+ <!-- Examples: xiii), xviii), xxviii) -->
9528
+ <xsl:variable name="item_numbers">
9529
+ <xsl:for-each select="*[local-name() = 'li']">
9530
+ <item><xsl:call-template name="getListItemFormat"/></item>
9531
+ </xsl:for-each>
9532
+ </xsl:variable>
9533
+
9534
+ <xsl:variable name="max_length">
9535
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
9536
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
9537
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
9538
+ </xsl:for-each>
9539
+ </xsl:variable>
9540
+
9541
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
9542
+ <xsl:variable name="addon" select="$max_length - 4"/>
9543
+ <xsl:if test="$addon &gt; 0">
9544
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
9545
+ </xsl:if>
9546
+ <!-- DEBUG -->
9547
+ <!-- <xsl:copy-of select="$item_numbers"/>
9548
+ <max_length><xsl:value-of select="$max_length"/></max_length>
9549
+ <addon><xsl:value-of select="$addon"/></addon> -->
9550
+ </xsl:if>
9551
+
9395
9552
  <xsl:if test="*[local-name() = 'name']">
9396
9553
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9397
9554
  </xsl:if>
@@ -10353,7 +10510,7 @@
10353
10510
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10354
10511
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10355
10512
  <!-- add &lt; and &gt; to \S -->
10356
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
10513
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
10357
10514
  <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>
10358
10515
  <xsl:variable name="text3">
10359
10516
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -10375,7 +10532,8 @@
10375
10532
  <xsl:choose>
10376
10533
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
10377
10534
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10378
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
10535
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
10536
+ <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>
10379
10537
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
10380
10538
  <xsl:choose>
10381
10539
  <xsl:when test="self::text()">
@@ -10978,6 +11136,23 @@
10978
11136
  </xsl:if>
10979
11137
  </xsl:template>
10980
11138
 
11139
+ <xsl:template name="setBlockAttributes">
11140
+ <xsl:param name="text_align_default">left</xsl:param>
11141
+ <xsl:call-template name="setTextAlignment">
11142
+ <xsl:with-param name="default" select="$text_align_default"/>
11143
+ </xsl:call-template>
11144
+
11145
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
11146
+ <!-- Example: keep-lines-together="true" -->
11147
+ <xsl:if test="@keep-lines-together = 'true'">
11148
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
11149
+ </xsl:if>
11150
+ <!-- Example: keep-with-next="true" -->
11151
+ <xsl:if test="@keep-with-next = 'true'">
11152
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11153
+ </xsl:if>
11154
+ </xsl:template>
11155
+
10981
11156
  <xsl:template name="number-to-words">
10982
11157
  <xsl:param name="number"/>
10983
11158
  <xsl:param name="first"/>