metanorma-ogc 2.3.3 → 2.3.5

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>
@@ -3232,6 +3230,7 @@
3232
3230
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3233
3231
 
3234
3232
  <xsl:choose>
3233
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
3235
3234
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
3236
3235
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
3237
3236
  </xsl:choose>
@@ -3348,7 +3347,7 @@
3348
3347
  <xsl:variable name="isDeleted" select="@deleted"/>
3349
3348
 
3350
3349
  <xsl:choose>
3351
- <xsl:when test="@width">
3350
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
3352
3351
 
3353
3352
  <!-- centered table when table name is centered (see table-name-style) -->
3354
3353
 
@@ -3670,6 +3669,7 @@
3670
3669
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3671
3670
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
3672
3671
  <!-- difference between the available space and the minimum table width -->
3672
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
3673
3673
  <xsl:variable name="W" select="$page_width - @width_min"/>
3674
3674
  <W><xsl:value-of select="$W"/></W>
3675
3675
  <!-- difference between maximum and minimum width of the table -->
@@ -3833,6 +3833,10 @@
3833
3833
  </xsl:choose>
3834
3834
  </xsl:variable>
3835
3835
 
3836
+ <xsl:variable name="table_fn_block">
3837
+ <xsl:call-template name="table_fn_display"/>
3838
+ </xsl:variable>
3839
+
3836
3840
  <xsl:variable name="tableWithNotesAndFootnotes">
3837
3841
 
3838
3842
  <fo:table keep-with-previous="always">
@@ -3880,11 +3884,25 @@
3880
3884
 
3881
3885
  <xsl:apply-templates select="../*[local-name()='note']"/>
3882
3886
 
3887
+ <xsl:variable name="isDisplayRowSeparator">
3888
+
3889
+ </xsl:variable>
3890
+
3883
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>
3884
3901
 
3885
3902
  <!-- fn processing -->
3886
3903
 
3887
- <xsl:call-template name="table_fn_display"/>
3904
+ <!-- <xsl:call-template name="table_fn_display" /> -->
3905
+ <xsl:copy-of select="$table_fn_block"/>
3888
3906
 
3889
3907
  <!-- for PAS display Notes after footnotes -->
3890
3908
 
@@ -4001,6 +4019,28 @@
4001
4019
  </fo:table-row>
4002
4020
  </xsl:template>
4003
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
+
4004
4044
  <!-- row in table footer (tfoot) -->
4005
4045
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4006
4046
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -4301,17 +4341,20 @@
4301
4341
  <xsl:for-each select="xalan:nodeset($references)//fn">
4302
4342
  <xsl:variable name="reference" select="@reference"/>
4303
4343
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4304
- <fo:block xsl:use-attribute-sets="table-fn-style">
4305
4344
 
4306
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4345
+ <fo:block xsl:use-attribute-sets="table-fn-style">
4307
4346
 
4308
- <xsl:value-of select="@reference"/>
4347
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4348
+
4349
+ <xsl:value-of select="@reference"/>
4350
+
4351
+ </fo:inline>
4352
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4353
+ <xsl:copy-of select="./node()"/>
4354
+ </fo:inline>
4355
+
4356
+ </fo:block>
4309
4357
 
4310
- </fo:inline>
4311
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4312
- <xsl:copy-of select="./node()"/>
4313
- </fo:inline>
4314
- </fo:block>
4315
4358
  </xsl:if>
4316
4359
  </xsl:for-each>
4317
4360
  </xsl:template>
@@ -4346,8 +4389,16 @@
4346
4389
  <!-- figure's footnotes rendering -->
4347
4390
  <xsl:template name="fn_display_figure">
4348
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 -->
4349
4400
  <xsl:variable name="references">
4350
- <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]]">
4351
4402
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4352
4403
  <xsl:apply-templates/>
4353
4404
  </fn>
@@ -4360,91 +4411,93 @@
4360
4411
 
4361
4412
  </xsl:variable>
4362
4413
 
4363
- <!-- current hierarchy is 'figure' element -->
4364
- <xsl:variable name="following_dl_colwidths">
4365
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4366
- <xsl:variable name="simple-table">
4367
- <!-- <xsl:variable name="doc_ns">
4368
- <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>
4369
4447
  </xsl:variable>
4370
- <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>
4371
4460
  <xsl:choose>
4372
- <xsl:when test="normalize-space($doc_ns) != ''">
4373
- <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>
4374
4467
  </xsl:when>
4375
4468
  <xsl:otherwise>
4376
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4469
+ <fo:table-column column-width="5%"/>
4470
+ <fo:table-column column-width="95%"/>
4377
4471
  </xsl:otherwise>
4378
4472
  </xsl:choose>
4379
- </xsl:variable> -->
4380
-
4381
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4382
- <tbody>
4383
- <xsl:apply-templates mode="dl"/>
4384
- </tbody>
4385
- </xsl:for-each>
4386
- </xsl:variable>
4387
-
4388
- <xsl:call-template name="calculate-column-widths">
4389
- <xsl:with-param name="cols-count" select="2"/>
4390
- <xsl:with-param name="table" select="$simple-table"/>
4391
- </xsl:call-template>
4392
-
4393
- </xsl:if>
4394
- </xsl:variable>
4395
-
4396
- <xsl:variable name="maxlength_dt">
4397
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4398
- <xsl:call-template name="getMaxLength_dt"/>
4399
- </xsl:for-each>
4400
- </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'">
4401
4488
 
4402
- <fo:block>
4403
- <fo:table width="95%" table-layout="fixed">
4404
- <xsl:if test="normalize-space($key_iso) = 'true'">
4405
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4489
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4406
4490
 
4407
- </xsl:if>
4408
- <xsl:choose>
4409
- <!-- if there 'dl', then set same columns width -->
4410
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4411
- <xsl:call-template name="setColumnWidth_dl">
4412
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4413
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4414
- </xsl:call-template>
4415
- </xsl:when>
4416
- <xsl:otherwise>
4417
- <fo:table-column column-width="15%"/>
4418
- <fo:table-column column-width="85%"/>
4419
- </xsl:otherwise>
4420
- </xsl:choose>
4421
- <fo:table-body>
4422
- <xsl:for-each select="xalan:nodeset($references)//fn">
4423
- <xsl:variable name="reference" select="@reference"/>
4424
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4425
- <fo:table-row>
4426
- <fo:table-cell>
4427
- <fo:block>
4428
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4429
- <xsl:value-of select="@reference"/>
4430
- </fo:inline>
4431
- </fo:block>
4432
- </fo:table-cell>
4433
- <fo:table-cell>
4434
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4435
- <xsl:if test="normalize-space($key_iso) = 'true'">
4436
-
4437
- <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>
4438
4500
 
4439
- </xsl:if>
4440
- <xsl:copy-of select="./node()"/>
4441
- </fo:block>
4442
- </fo:table-cell>
4443
- </fo:table-row>
4444
- </xsl:if>
4445
- </xsl:for-each>
4446
- </fo:table-body>
4447
- </fo:table>
4448
4501
  </fo:block>
4449
4502
  </xsl:if>
4450
4503
 
@@ -4525,12 +4578,14 @@
4525
4578
 
4526
4579
  <fo:block margin-bottom="12pt" text-align="left">
4527
4580
 
4528
- <xsl:variable name="title-where">
4581
+ <!-- <xsl:variable name="title-where">
4529
4582
  <xsl:call-template name="getLocalizedString">
4530
4583
  <xsl:with-param name="key">where</xsl:with-param>
4531
4584
  </xsl:call-template>
4532
4585
  </xsl:variable>
4533
- <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>
4534
4589
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4535
4590
  <xsl:text/>
4536
4591
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -4540,12 +4595,14 @@
4540
4595
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4541
4596
  <fo:block margin-bottom="12pt" text-align="left">
4542
4597
 
4543
- <xsl:variable name="title-where">
4598
+ <!-- <xsl:variable name="title-where">
4544
4599
  <xsl:call-template name="getLocalizedString">
4545
4600
  <xsl:with-param name="key">where</xsl:with-param>
4546
4601
  </xsl:call-template>
4547
4602
  </xsl:variable>
4548
- <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()"/>
4549
4606
  </fo:block>
4550
4607
  </xsl:when> <!-- END: a few components -->
4551
4608
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -4728,6 +4785,9 @@
4728
4785
 
4729
4786
  </xsl:template> <!-- END: dl -->
4730
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
+
4731
4791
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4732
4792
  <xsl:param name="process">false</xsl:param>
4733
4793
  <xsl:if test="$process = 'true'">
@@ -5263,12 +5323,12 @@
5263
5323
  <xsl:param name="value"/>
5264
5324
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
5265
5325
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
5266
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
5267
- <xsl:attribute name="height">5mm</xsl:attribute>
5326
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
5327
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
5268
5328
  <xsl:attribute name="content-width">100%</xsl:attribute>
5269
5329
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5270
5330
  <xsl:attribute name="scaling">uniform</xsl:attribute>
5271
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5331
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5272
5332
  <g>
5273
5333
  <xsl:if test="$type = 'closing' or $type = 'end'">
5274
5334
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -5282,6 +5342,27 @@
5282
5342
  </xsl:if>
5283
5343
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
5284
5344
  </text>
5345
+ </svg> -->
5346
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5347
+ <g>
5348
+ <xsl:if test="$type = 'closing' or $type = 'end'">
5349
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
5350
+ </xsl:if>
5351
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
5352
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
5353
+ </g>
5354
+ <xsl:variable name="text_x">
5355
+ <xsl:choose>
5356
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
5357
+ <xsl:otherwise>22</xsl:otherwise>
5358
+ </xsl:choose>
5359
+ </xsl:variable>
5360
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
5361
+ <xsl:value-of select="$kind"/>
5362
+ </text>
5363
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
5364
+ <xsl:value-of select="$value"/>
5365
+ </text>
5285
5366
  </svg>
5286
5367
  </fo:instream-foreign-object>
5287
5368
  </xsl:template>
@@ -5536,18 +5617,34 @@
5536
5617
 
5537
5618
  <xsl:template name="add-zero-spaces-java">
5538
5619
  <xsl:param name="text" select="."/>
5539
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
5540
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
5620
+
5621
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
5622
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
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​')"/>
5625
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
5626
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
5541
5627
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
5542
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
5628
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
5543
5629
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
5544
- <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
5630
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
5545
5631
  <!-- add zero-width space (#x200B) before character: { -->
5546
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5632
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5547
5633
  <!-- add zero-width space (#x200B) after character: , -->
5548
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
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>
5549
5646
 
5550
- <xsl:value-of select="$text5"/>
5647
+ <xsl:value-of select="$text9"/>
5551
5648
  </xsl:template>
5552
5649
 
5553
5650
  <xsl:template name="add-zero-spaces-link-java">
@@ -5555,8 +5652,10 @@
5555
5652
 
5556
5653
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
5557
5654
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
5558
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5559
- <xsl:value-of 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​')"/>
5657
+ <!-- remove zero-width space at the end -->
5658
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
5560
5659
  </xsl:template>
5561
5660
 
5562
5661
  <!-- add zero space after dash character (for table's entries) -->
@@ -5693,7 +5792,7 @@
5693
5792
  </xsl:copy>
5694
5793
  </xsl:template>
5695
5794
 
5696
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
5795
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
5697
5796
  <xsl:copy>
5698
5797
  <xsl:copy-of select="@*"/>
5699
5798
  <p>
@@ -5769,6 +5868,14 @@
5769
5868
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
5770
5869
  </xsl:template>
5771
5870
 
5871
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
5872
+ <xsl:apply-templates mode="table-without-br"/>
5873
+ </xsl:template>
5874
+
5875
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
5876
+ <xsl:apply-templates mode="table-without-br"/>
5877
+ </xsl:template>
5878
+
5772
5879
  <!-- mode="table-without-br" -->
5773
5880
  <!-- ================================== -->
5774
5881
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5901,9 +6008,28 @@
5901
6008
  </xsl:variable>
5902
6009
  <xsl:copy-of select="$newRow"/>
5903
6010
 
5904
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5905
- <xsl:with-param name="previousRow" select="$newRow"/>
5906
- </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>
5907
6033
  </xsl:template>
5908
6034
  <!-- End mode simple-table-rowspan -->
5909
6035
 
@@ -6066,6 +6192,27 @@
6066
6192
  </xsl:call-template>
6067
6193
  </xsl:template>
6068
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
+
6069
6216
  <xsl:template name="getFormattingTags">
6070
6217
  <tags>
6071
6218
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -6407,7 +6554,7 @@
6407
6554
  </xsl:variable>
6408
6555
  <fo:inline xsl:use-attribute-sets="link-style">
6409
6556
 
6410
- <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'])">
6411
6558
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6412
6559
  </xsl:if>
6413
6560
 
@@ -6586,7 +6733,7 @@
6586
6733
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
6587
6734
  </xsl:if>
6588
6735
 
6589
- <fo:block-container margin-left="0mm">
6736
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6590
6737
 
6591
6738
  <fo:block>
6592
6739
 
@@ -6764,13 +6911,16 @@
6764
6911
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
6765
6912
  </xsl:call-template>
6766
6913
 
6914
+ <!-- Example: Dimensions in millimeters -->
6915
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
6916
+
6767
6917
  <fo:block xsl:use-attribute-sets="figure-style">
6768
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6918
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
6769
6919
  </fo:block>
6770
- <xsl:call-template name="fn_display_figure"/>
6771
- <xsl:for-each select="*[local-name() = 'note']">
6920
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
6772
6921
  <xsl:call-template name="note"/>
6773
6922
  </xsl:for-each>
6923
+ <xsl:call-template name="fn_display_figure"/>
6774
6924
 
6775
6925
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
6776
6926
 
@@ -6833,7 +6983,13 @@
6833
6983
  </xsl:choose>
6834
6984
  </xsl:variable>
6835
6985
 
6836
- <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)"/>
6837
6993
  <xsl:if test="number($scale) &lt; 100">
6838
6994
 
6839
6995
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -7025,24 +7181,47 @@
7025
7181
 
7026
7182
  </xsl:when>
7027
7183
  <xsl:otherwise>
7028
- <fo:block xsl:use-attribute-sets="image-style">
7029
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7030
- <xsl:attribute name="width">100%</xsl:attribute>
7031
- <xsl:attribute name="content-height">100%</xsl:attribute>
7032
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7033
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7034
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7035
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7036
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7037
- <!-- effective height / width = 1.48, 1.4 - with title -->
7038
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7039
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7040
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7041
- </xsl:if>
7042
- <xsl:attribute name="scaling">uniform</xsl:attribute>
7043
- <xsl:copy-of select="$svg_content"/>
7044
- </fo:instream-foreign-object>
7045
- </fo:block>
7184
+
7185
+ <xsl:variable name="element">
7186
+ <xsl:choose>
7187
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
7188
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7189
+ </xsl:when>
7190
+ <xsl:otherwise>
7191
+ <fo:block xsl:use-attribute-sets="image-style">
7192
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
7193
+ <xsl:attribute name="text-align">left</xsl:attribute>
7194
+ </xsl:if>
7195
+ </fo:block>
7196
+ </xsl:otherwise>
7197
+ </xsl:choose>
7198
+ </xsl:variable>
7199
+
7200
+ <xsl:for-each select="xalan:nodeset($element)/*">
7201
+ <xsl:copy>
7202
+ <xsl:copy-of select="@*"/>
7203
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
7204
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7205
+ <xsl:if test="$isGenerateTableIF = 'false'">
7206
+ <xsl:attribute name="width">100%</xsl:attribute>
7207
+ </xsl:if>
7208
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7209
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7210
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7211
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7212
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7213
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7214
+ <!-- effective height / width = 1.48, 1.4 - with title -->
7215
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7216
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7217
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7218
+ </xsl:if>
7219
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7220
+ <xsl:copy-of select="$svg_content"/>
7221
+ </fo:instream-foreign-object>
7222
+ <!-- </fo:block> -->
7223
+ </xsl:copy>
7224
+ </xsl:for-each>
7046
7225
  </xsl:otherwise>
7047
7226
  </xsl:choose>
7048
7227
  </xsl:template>
@@ -7134,6 +7313,13 @@
7134
7313
  </xsl:for-each>
7135
7314
  </xsl:template>
7136
7315
 
7316
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
7317
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7318
+ <xsl:for-each select="*[local-name() = 'svg']">
7319
+ <xsl:call-template name="image_svg"/>
7320
+ </xsl:for-each>
7321
+ </xsl:template>
7322
+
7137
7323
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7138
7324
  <xsl:variable name="svg_content" select="document(@src)"/>
7139
7325
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7272,6 +7458,8 @@
7272
7458
  <xsl:value-of select="."/>
7273
7459
  </xsl:template>
7274
7460
 
7461
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
7462
+
7275
7463
  <xsl:template match="node()" mode="contents">
7276
7464
  <xsl:apply-templates mode="contents"/>
7277
7465
  </xsl:template>
@@ -7388,6 +7576,13 @@
7388
7576
  <xsl:when test="$contents_nodes/doc">
7389
7577
  <xsl:choose>
7390
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
+
7391
7586
  <xsl:for-each select="$contents_nodes/doc">
7392
7587
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7393
7588
  <xsl:if test="@bundle = 'true'">
@@ -7597,7 +7792,15 @@
7597
7792
  <xsl:value-of select="@section"/>
7598
7793
  <xsl:text> </xsl:text>
7599
7794
  </xsl:if>
7600
- <xsl:value-of select="normalize-space(title)"/>
7795
+ <xsl:variable name="title">
7796
+ <xsl:for-each select="title/node()">
7797
+ <xsl:choose>
7798
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
7799
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7800
+ </xsl:choose>
7801
+ </xsl:for-each>
7802
+ </xsl:variable>
7803
+ <xsl:value-of select="normalize-space($title)"/>
7601
7804
  </fo:bookmark-title>
7602
7805
  <xsl:apply-templates mode="bookmark"/>
7603
7806
  </fo:bookmark>
@@ -7623,6 +7826,12 @@
7623
7826
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
7624
7827
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
7625
7828
 
7829
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
7830
+ <fo:block text-align="right" keep-with-next="always">
7831
+ <xsl:apply-templates/>
7832
+ </fo:block>
7833
+ </xsl:template>
7834
+
7626
7835
  <!-- ====== -->
7627
7836
  <!-- ====== -->
7628
7837
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -7772,6 +7981,10 @@
7772
7981
  </xsl:for-each>
7773
7982
  </xsl:template>
7774
7983
 
7984
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
7985
+ <xsl:value-of select="."/>
7986
+ </xsl:template>
7987
+
7775
7988
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
7776
7989
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
7777
7990
  <xsl:apply-templates mode="contents_item"/>
@@ -9298,6 +9511,44 @@
9298
9511
 
9299
9512
  <fo:list-block xsl:use-attribute-sets="list-style">
9300
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
+
9301
9552
  <xsl:if test="*[local-name() = 'name']">
9302
9553
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9303
9554
  </xsl:if>
@@ -10259,7 +10510,7 @@
10259
10510
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10260
10511
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10261
10512
  <!-- add &lt; and &gt; to \S -->
10262
- <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>
10263
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>
10264
10515
  <xsl:variable name="text3">
10265
10516
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -10281,7 +10532,8 @@
10281
10532
  <xsl:choose>
10282
10533
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
10283
10534
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10284
- <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>
10285
10537
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
10286
10538
  <xsl:choose>
10287
10539
  <xsl:when test="self::text()">
@@ -10884,6 +11136,23 @@
10884
11136
  </xsl:if>
10885
11137
  </xsl:template>
10886
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
+
10887
11156
  <xsl:template name="number-to-words">
10888
11157
  <xsl:param name="number"/>
10889
11158
  <xsl:param name="first"/>