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.
@@ -1272,7 +1272,6 @@
1272
1272
 
1273
1273
  <xsl:attribute-set name="table-header-cell-style">
1274
1274
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1275
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1276
1275
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1277
1276
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1278
1277
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1287,7 +1286,6 @@
1287
1286
 
1288
1287
  <xsl:attribute-set name="table-cell-style">
1289
1288
  <xsl:attribute name="display-align">center</xsl:attribute>
1290
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1291
1289
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1292
1290
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1293
1291
 
@@ -2062,7 +2060,7 @@
2062
2060
  <xsl:apply-templates select="." mode="contents"/>
2063
2061
  </xsl:for-each>
2064
2062
 
2065
- <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')]]">
2063
+ <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]">
2066
2064
  <xsl:sort select="@displayorder" data-type="number"/>
2067
2065
  <xsl:apply-templates select="." mode="contents"/>
2068
2066
  </xsl:for-each>
@@ -2422,6 +2420,7 @@
2422
2420
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2423
2421
 
2424
2422
  <xsl:choose>
2423
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
2425
2424
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2426
2425
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
2427
2426
  </xsl:choose>
@@ -2540,7 +2539,7 @@
2540
2539
  <xsl:variable name="isDeleted" select="@deleted"/>
2541
2540
 
2542
2541
  <xsl:choose>
2543
- <xsl:when test="@width">
2542
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2544
2543
 
2545
2544
  <!-- centered table when table name is centered (see table-name-style) -->
2546
2545
 
@@ -2862,6 +2861,7 @@
2862
2861
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2863
2862
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2864
2863
  <!-- difference between the available space and the minimum table width -->
2864
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2865
2865
  <xsl:variable name="W" select="$page_width - @width_min"/>
2866
2866
  <W><xsl:value-of select="$W"/></W>
2867
2867
  <!-- difference between maximum and minimum width of the table -->
@@ -3025,6 +3025,10 @@
3025
3025
  </xsl:choose>
3026
3026
  </xsl:variable>
3027
3027
 
3028
+ <xsl:variable name="table_fn_block">
3029
+ <xsl:call-template name="table_fn_display"/>
3030
+ </xsl:variable>
3031
+
3028
3032
  <xsl:variable name="tableWithNotesAndFootnotes">
3029
3033
 
3030
3034
  <fo:table keep-with-previous="always">
@@ -3072,11 +3076,25 @@
3072
3076
 
3073
3077
  <xsl:apply-templates select="../*[local-name()='note']"/>
3074
3078
 
3079
+ <xsl:variable name="isDisplayRowSeparator">
3080
+
3081
+ </xsl:variable>
3082
+
3075
3083
  <!-- horizontal row separator -->
3084
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3085
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3086
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3087
+
3088
+ <xsl:call-template name="setBordersTableArray"/>
3089
+ <fo:block font-size="1pt"> </fo:block>
3090
+ </fo:block-container>
3091
+ </xsl:if>
3092
+ </xsl:if>
3076
3093
 
3077
3094
  <!-- fn processing -->
3078
3095
 
3079
- <xsl:call-template name="table_fn_display"/>
3096
+ <!-- <xsl:call-template name="table_fn_display" /> -->
3097
+ <xsl:copy-of select="$table_fn_block"/>
3080
3098
 
3081
3099
  <!-- for PAS display Notes after footnotes -->
3082
3100
 
@@ -3193,6 +3211,28 @@
3193
3211
  </fo:table-row>
3194
3212
  </xsl:template>
3195
3213
 
3214
+ <xsl:template name="setBorderUnderRow">
3215
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
3216
+ <xsl:choose>
3217
+ <xsl:when test="$border_under_row_ != ''">
3218
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3219
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
3220
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
3221
+ <xsl:variable name="border_under_row">
3222
+ <xsl:call-template name="split">
3223
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3224
+ </xsl:call-template>
3225
+ </xsl:variable>
3226
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3227
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3228
+ </xsl:if>
3229
+ </xsl:when>
3230
+ <xsl:otherwise>
3231
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3232
+ </xsl:otherwise>
3233
+ </xsl:choose>
3234
+ </xsl:template>
3235
+
3196
3236
  <!-- row in table footer (tfoot) -->
3197
3237
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3198
3238
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3479,17 +3519,20 @@
3479
3519
  <xsl:for-each select="xalan:nodeset($references)//fn">
3480
3520
  <xsl:variable name="reference" select="@reference"/>
3481
3521
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3482
- <fo:block xsl:use-attribute-sets="table-fn-style">
3483
3522
 
3484
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3523
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3485
3524
 
3486
- <xsl:value-of select="@reference"/>
3525
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3526
+
3527
+ <xsl:value-of select="@reference"/>
3528
+
3529
+ </fo:inline>
3530
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3531
+ <xsl:copy-of select="./node()"/>
3532
+ </fo:inline>
3533
+
3534
+ </fo:block>
3487
3535
 
3488
- </fo:inline>
3489
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3490
- <xsl:copy-of select="./node()"/>
3491
- </fo:inline>
3492
- </fo:block>
3493
3536
  </xsl:if>
3494
3537
  </xsl:for-each>
3495
3538
  </xsl:template>
@@ -3524,8 +3567,16 @@
3524
3567
  <!-- figure's footnotes rendering -->
3525
3568
  <xsl:template name="fn_display_figure">
3526
3569
 
3570
+ <!-- current figure id -->
3571
+ <xsl:variable name="figure_id_">
3572
+ <xsl:value-of select="@id"/>
3573
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
3574
+ </xsl:variable>
3575
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
3576
+
3577
+ <!-- all footnotes relates to the current figure -->
3527
3578
  <xsl:variable name="references">
3528
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
3579
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
3529
3580
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3530
3581
  <xsl:apply-templates/>
3531
3582
  </fn>
@@ -3538,91 +3589,93 @@
3538
3589
 
3539
3590
  </xsl:variable>
3540
3591
 
3541
- <!-- current hierarchy is 'figure' element -->
3542
- <xsl:variable name="following_dl_colwidths">
3543
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3544
- <xsl:variable name="simple-table">
3545
- <!-- <xsl:variable name="doc_ns">
3546
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3592
+ <fo:block>
3593
+
3594
+ <!-- current hierarchy is 'figure' element -->
3595
+ <xsl:variable name="following_dl_colwidths">
3596
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3597
+ <xsl:variable name="simple-table">
3598
+ <!-- <xsl:variable name="doc_ns">
3599
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3600
+ </xsl:variable>
3601
+ <xsl:variable name="ns">
3602
+ <xsl:choose>
3603
+ <xsl:when test="normalize-space($doc_ns) != ''">
3604
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3605
+ </xsl:when>
3606
+ <xsl:otherwise>
3607
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3608
+ </xsl:otherwise>
3609
+ </xsl:choose>
3610
+ </xsl:variable> -->
3611
+
3612
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3613
+ <tbody>
3614
+ <xsl:apply-templates mode="dl"/>
3615
+ </tbody>
3616
+ </xsl:for-each>
3617
+ </xsl:variable>
3618
+
3619
+ <xsl:call-template name="calculate-column-widths">
3620
+ <xsl:with-param name="cols-count" select="2"/>
3621
+ <xsl:with-param name="table" select="$simple-table"/>
3622
+ </xsl:call-template>
3623
+
3624
+ </xsl:if>
3625
+ </xsl:variable>
3626
+
3627
+ <xsl:variable name="maxlength_dt">
3628
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3629
+ <xsl:call-template name="getMaxLength_dt"/>
3630
+ </xsl:for-each>
3547
3631
  </xsl:variable>
3548
- <xsl:variable name="ns">
3632
+
3633
+ <fo:table width="95%" table-layout="fixed">
3634
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3635
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3636
+
3637
+ </xsl:if>
3549
3638
  <xsl:choose>
3550
- <xsl:when test="normalize-space($doc_ns) != ''">
3551
- <xsl:value-of select="normalize-space($doc_ns)"/>
3639
+ <!-- if there 'dl', then set same columns width -->
3640
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3641
+ <xsl:call-template name="setColumnWidth_dl">
3642
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3643
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3644
+ </xsl:call-template>
3552
3645
  </xsl:when>
3553
3646
  <xsl:otherwise>
3554
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3647
+ <fo:table-column column-width="5%"/>
3648
+ <fo:table-column column-width="95%"/>
3555
3649
  </xsl:otherwise>
3556
3650
  </xsl:choose>
3557
- </xsl:variable> -->
3558
-
3559
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3560
- <tbody>
3561
- <xsl:apply-templates mode="dl"/>
3562
- </tbody>
3563
- </xsl:for-each>
3564
- </xsl:variable>
3565
-
3566
- <xsl:call-template name="calculate-column-widths">
3567
- <xsl:with-param name="cols-count" select="2"/>
3568
- <xsl:with-param name="table" select="$simple-table"/>
3569
- </xsl:call-template>
3570
-
3571
- </xsl:if>
3572
- </xsl:variable>
3573
-
3574
- <xsl:variable name="maxlength_dt">
3575
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3576
- <xsl:call-template name="getMaxLength_dt"/>
3577
- </xsl:for-each>
3578
- </xsl:variable>
3651
+ <fo:table-body>
3652
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3653
+ <xsl:variable name="reference" select="@reference"/>
3654
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3655
+ <fo:table-row>
3656
+ <fo:table-cell>
3657
+ <fo:block>
3658
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3659
+ <xsl:value-of select="@reference"/>
3660
+ </fo:inline>
3661
+ </fo:block>
3662
+ </fo:table-cell>
3663
+ <fo:table-cell>
3664
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3665
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3579
3666
 
3580
- <fo:block>
3581
- <fo:table width="95%" table-layout="fixed">
3582
- <xsl:if test="normalize-space($key_iso) = 'true'">
3583
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3667
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3584
3668
 
3585
- </xsl:if>
3586
- <xsl:choose>
3587
- <!-- if there 'dl', then set same columns width -->
3588
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3589
- <xsl:call-template name="setColumnWidth_dl">
3590
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3591
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3592
- </xsl:call-template>
3593
- </xsl:when>
3594
- <xsl:otherwise>
3595
- <fo:table-column column-width="15%"/>
3596
- <fo:table-column column-width="85%"/>
3597
- </xsl:otherwise>
3598
- </xsl:choose>
3599
- <fo:table-body>
3600
- <xsl:for-each select="xalan:nodeset($references)//fn">
3601
- <xsl:variable name="reference" select="@reference"/>
3602
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3603
- <fo:table-row>
3604
- <fo:table-cell>
3605
- <fo:block>
3606
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3607
- <xsl:value-of select="@reference"/>
3608
- </fo:inline>
3609
- </fo:block>
3610
- </fo:table-cell>
3611
- <fo:table-cell>
3612
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3613
- <xsl:if test="normalize-space($key_iso) = 'true'">
3614
-
3615
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
3669
+ </xsl:if>
3670
+ <xsl:copy-of select="./node()"/>
3671
+ </fo:block>
3672
+ </fo:table-cell>
3673
+ </fo:table-row>
3674
+ </xsl:if>
3675
+ </xsl:for-each>
3676
+ </fo:table-body>
3677
+ </fo:table>
3616
3678
 
3617
- </xsl:if>
3618
- <xsl:copy-of select="./node()"/>
3619
- </fo:block>
3620
- </fo:table-cell>
3621
- </fo:table-row>
3622
- </xsl:if>
3623
- </xsl:for-each>
3624
- </fo:table-body>
3625
- </fo:table>
3626
3679
  </fo:block>
3627
3680
  </xsl:if>
3628
3681
 
@@ -3703,12 +3756,14 @@
3703
3756
 
3704
3757
  <fo:block margin-bottom="12pt" text-align="left">
3705
3758
 
3706
- <xsl:variable name="title-where">
3759
+ <!-- <xsl:variable name="title-where">
3707
3760
  <xsl:call-template name="getLocalizedString">
3708
3761
  <xsl:with-param name="key">where</xsl:with-param>
3709
3762
  </xsl:call-template>
3710
3763
  </xsl:variable>
3711
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3764
+ <xsl:value-of select="$title-where"/> -->
3765
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3766
+ <xsl:text> </xsl:text>
3712
3767
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3713
3768
  <xsl:text/>
3714
3769
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3718,12 +3773,14 @@
3718
3773
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3719
3774
  <fo:block margin-bottom="12pt" text-align="left">
3720
3775
 
3721
- <xsl:variable name="title-where">
3776
+ <!-- <xsl:variable name="title-where">
3722
3777
  <xsl:call-template name="getLocalizedString">
3723
3778
  <xsl:with-param name="key">where</xsl:with-param>
3724
3779
  </xsl:call-template>
3725
3780
  </xsl:variable>
3726
- <xsl:value-of select="$title-where"/>
3781
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
3782
+ <!-- preceding 'p' with word 'where' -->
3783
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3727
3784
  </fo:block>
3728
3785
  </xsl:when> <!-- END: a few components -->
3729
3786
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -3906,6 +3963,9 @@
3906
3963
 
3907
3964
  </xsl:template> <!-- END: dl -->
3908
3965
 
3966
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
3967
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
3968
+
3909
3969
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3910
3970
  <xsl:param name="process">false</xsl:param>
3911
3971
  <xsl:if test="$process = 'true'">
@@ -4441,12 +4501,12 @@
4441
4501
  <xsl:param name="value"/>
4442
4502
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4443
4503
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4444
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4445
- <xsl:attribute name="height">5mm</xsl:attribute>
4504
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4505
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4446
4506
  <xsl:attribute name="content-width">100%</xsl:attribute>
4447
4507
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4448
4508
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4449
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4509
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4450
4510
  <g>
4451
4511
  <xsl:if test="$type = 'closing' or $type = 'end'">
4452
4512
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4460,6 +4520,27 @@
4460
4520
  </xsl:if>
4461
4521
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4462
4522
  </text>
4523
+ </svg> -->
4524
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4525
+ <g>
4526
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4527
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4528
+ </xsl:if>
4529
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4530
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4531
+ </g>
4532
+ <xsl:variable name="text_x">
4533
+ <xsl:choose>
4534
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4535
+ <xsl:otherwise>22</xsl:otherwise>
4536
+ </xsl:choose>
4537
+ </xsl:variable>
4538
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4539
+ <xsl:value-of select="$kind"/>
4540
+ </text>
4541
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4542
+ <xsl:value-of select="$value"/>
4543
+ </text>
4463
4544
  </svg>
4464
4545
  </fo:instream-foreign-object>
4465
4546
  </xsl:template>
@@ -4714,18 +4795,34 @@
4714
4795
 
4715
4796
  <xsl:template name="add-zero-spaces-java">
4716
4797
  <xsl:param name="text" select="."/>
4717
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4718
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4798
+
4799
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
4800
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4801
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
4802
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
4803
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4804
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4719
4805
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4720
- <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' -->
4806
+ <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' -->
4721
4807
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4722
- <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' -->
4808
+ <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' -->
4723
4809
  <!-- add zero-width space (#x200B) before character: { -->
4724
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4810
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4725
4811
  <!-- add zero-width space (#x200B) after character: , -->
4726
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4812
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4813
+ <!-- add zero-width space (#x200B) after character: '/' -->
4814
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
4727
4815
 
4728
- <xsl:value-of select="$text5"/>
4816
+ <xsl:variable name="text9">
4817
+ <xsl:choose>
4818
+ <xsl:when test="$isGenerateTableIF = 'true'">
4819
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
4820
+ </xsl:when>
4821
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
4822
+ </xsl:choose>
4823
+ </xsl:variable>
4824
+
4825
+ <xsl:value-of select="$text9"/>
4729
4826
  </xsl:template>
4730
4827
 
4731
4828
  <xsl:template name="add-zero-spaces-link-java">
@@ -4733,8 +4830,10 @@
4733
4830
 
4734
4831
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4735
4832
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4736
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4737
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4833
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
4834
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
4835
+ <!-- remove zero-width space at the end -->
4836
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4738
4837
  </xsl:template>
4739
4838
 
4740
4839
  <!-- add zero space after dash character (for table's entries) -->
@@ -4871,7 +4970,7 @@
4871
4970
  </xsl:copy>
4872
4971
  </xsl:template>
4873
4972
 
4874
- <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">
4973
+ <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">
4875
4974
  <xsl:copy>
4876
4975
  <xsl:copy-of select="@*"/>
4877
4976
  <p>
@@ -4947,6 +5046,14 @@
4947
5046
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4948
5047
  </xsl:template>
4949
5048
 
5049
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
5050
+ <xsl:apply-templates mode="table-without-br"/>
5051
+ </xsl:template>
5052
+
5053
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
5054
+ <xsl:apply-templates mode="table-without-br"/>
5055
+ </xsl:template>
5056
+
4950
5057
  <!-- mode="table-without-br" -->
4951
5058
  <!-- ================================== -->
4952
5059
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5079,9 +5186,28 @@
5079
5186
  </xsl:variable>
5080
5187
  <xsl:copy-of select="$newRow"/>
5081
5188
 
5082
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5083
- <xsl:with-param name="previousRow" select="$newRow"/>
5084
- </xsl:apply-templates>
5189
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
5190
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
5191
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
5192
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
5193
+ <xsl:choose>
5194
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
5195
+ <xsl:copy-of select="following-sibling::tr"/>
5196
+ </xsl:when>
5197
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
5198
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
5199
+
5200
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5201
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
5202
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5203
+ </xsl:apply-templates>
5204
+ </xsl:when> -->
5205
+ <xsl:otherwise>
5206
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5207
+ <xsl:with-param name="previousRow" select="$newRow"/>
5208
+ </xsl:apply-templates>
5209
+ </xsl:otherwise>
5210
+ </xsl:choose>
5085
5211
  </xsl:template>
5086
5212
  <!-- End mode simple-table-rowspan -->
5087
5213
 
@@ -5244,6 +5370,27 @@
5244
5370
  </xsl:call-template>
5245
5371
  </xsl:template>
5246
5372
 
5373
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5374
+ <xsl:variable name="link">
5375
+ <link_updated>
5376
+ <xsl:variable name="target_text">
5377
+ <xsl:choose>
5378
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5379
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5380
+ </xsl:when>
5381
+ <xsl:otherwise>
5382
+ <xsl:value-of select="normalize-space(@target)"/>
5383
+ </xsl:otherwise>
5384
+ </xsl:choose>
5385
+ </xsl:variable>
5386
+ <xsl:value-of select="$target_text"/>
5387
+ </link_updated>
5388
+ </xsl:variable>
5389
+ <xsl:for-each select="xalan:nodeset($link)/*">
5390
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5391
+ </xsl:for-each>
5392
+ </xsl:template>
5393
+
5247
5394
  <xsl:template name="getFormattingTags">
5248
5395
  <tags>
5249
5396
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5585,7 +5732,7 @@
5585
5732
  </xsl:variable>
5586
5733
  <fo:inline xsl:use-attribute-sets="link-style">
5587
5734
 
5588
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5735
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
5589
5736
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5590
5737
  </xsl:if>
5591
5738
 
@@ -5764,7 +5911,7 @@
5764
5911
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
5765
5912
  </xsl:if>
5766
5913
 
5767
- <fo:block-container margin-left="0mm">
5914
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5768
5915
 
5769
5916
  <fo:block>
5770
5917
 
@@ -5940,13 +6087,16 @@
5940
6087
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5941
6088
  </xsl:call-template>
5942
6089
 
6090
+ <!-- Example: Dimensions in millimeters -->
6091
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
6092
+
5943
6093
  <fo:block xsl:use-attribute-sets="figure-style">
5944
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6094
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5945
6095
  </fo:block>
5946
- <xsl:call-template name="fn_display_figure"/>
5947
- <xsl:for-each select="*[local-name() = 'note']">
6096
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5948
6097
  <xsl:call-template name="note"/>
5949
6098
  </xsl:for-each>
6099
+ <xsl:call-template name="fn_display_figure"/>
5950
6100
 
5951
6101
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
5952
6102
 
@@ -6009,7 +6159,13 @@
6009
6159
  </xsl:choose>
6010
6160
  </xsl:variable>
6011
6161
 
6012
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6162
+ <xsl:variable name="image_width_effective">
6163
+
6164
+ <xsl:value-of select="$width_effective"/>
6165
+
6166
+ </xsl:variable>
6167
+
6168
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6013
6169
  <xsl:if test="number($scale) &lt; 100">
6014
6170
 
6015
6171
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -6201,24 +6357,47 @@
6201
6357
 
6202
6358
  </xsl:when>
6203
6359
  <xsl:otherwise>
6204
- <fo:block xsl:use-attribute-sets="image-style">
6205
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6206
- <xsl:attribute name="width">100%</xsl:attribute>
6207
- <xsl:attribute name="content-height">100%</xsl:attribute>
6208
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6209
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6210
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6211
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6212
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6213
- <!-- effective height / width = 1.48, 1.4 - with title -->
6214
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6215
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6216
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6217
- </xsl:if>
6218
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6219
- <xsl:copy-of select="$svg_content"/>
6220
- </fo:instream-foreign-object>
6221
- </fo:block>
6360
+
6361
+ <xsl:variable name="element">
6362
+ <xsl:choose>
6363
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6364
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6365
+ </xsl:when>
6366
+ <xsl:otherwise>
6367
+ <fo:block xsl:use-attribute-sets="image-style">
6368
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6369
+ <xsl:attribute name="text-align">left</xsl:attribute>
6370
+ </xsl:if>
6371
+ </fo:block>
6372
+ </xsl:otherwise>
6373
+ </xsl:choose>
6374
+ </xsl:variable>
6375
+
6376
+ <xsl:for-each select="xalan:nodeset($element)/*">
6377
+ <xsl:copy>
6378
+ <xsl:copy-of select="@*"/>
6379
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6380
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6381
+ <xsl:if test="$isGenerateTableIF = 'false'">
6382
+ <xsl:attribute name="width">100%</xsl:attribute>
6383
+ </xsl:if>
6384
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6385
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6386
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6387
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6388
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6389
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6390
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6391
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6392
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6393
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6394
+ </xsl:if>
6395
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6396
+ <xsl:copy-of select="$svg_content"/>
6397
+ </fo:instream-foreign-object>
6398
+ <!-- </fo:block> -->
6399
+ </xsl:copy>
6400
+ </xsl:for-each>
6222
6401
  </xsl:otherwise>
6223
6402
  </xsl:choose>
6224
6403
  </xsl:template>
@@ -6310,6 +6489,13 @@
6310
6489
  </xsl:for-each>
6311
6490
  </xsl:template>
6312
6491
 
6492
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6493
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6494
+ <xsl:for-each select="*[local-name() = 'svg']">
6495
+ <xsl:call-template name="image_svg"/>
6496
+ </xsl:for-each>
6497
+ </xsl:template>
6498
+
6313
6499
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6314
6500
  <xsl:variable name="svg_content" select="document(@src)"/>
6315
6501
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6448,6 +6634,8 @@
6448
6634
  <xsl:value-of select="."/>
6449
6635
  </xsl:template>
6450
6636
 
6637
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6638
+
6451
6639
  <xsl:template match="node()" mode="contents">
6452
6640
  <xsl:apply-templates mode="contents"/>
6453
6641
  </xsl:template>
@@ -6564,6 +6752,13 @@
6564
6752
  <xsl:when test="$contents_nodes/doc">
6565
6753
  <xsl:choose>
6566
6754
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
6755
+
6756
+ <xsl:if test="$contents_nodes/collection">
6757
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
6758
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
6759
+ </fo:bookmark>
6760
+ </xsl:if>
6761
+
6567
6762
  <xsl:for-each select="$contents_nodes/doc">
6568
6763
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6569
6764
  <xsl:if test="@bundle = 'true'">
@@ -6750,7 +6945,15 @@
6750
6945
  <xsl:value-of select="@section"/>
6751
6946
  <xsl:text> </xsl:text>
6752
6947
  </xsl:if>
6753
- <xsl:value-of select="normalize-space(title)"/>
6948
+ <xsl:variable name="title">
6949
+ <xsl:for-each select="title/node()">
6950
+ <xsl:choose>
6951
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6952
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6953
+ </xsl:choose>
6954
+ </xsl:for-each>
6955
+ </xsl:variable>
6956
+ <xsl:value-of select="normalize-space($title)"/>
6754
6957
  </fo:bookmark-title>
6755
6958
  <xsl:apply-templates mode="bookmark"/>
6756
6959
  </fo:bookmark>
@@ -6776,6 +6979,12 @@
6776
6979
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6777
6980
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6778
6981
 
6982
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6983
+ <fo:block text-align="right" keep-with-next="always">
6984
+ <xsl:apply-templates/>
6985
+ </fo:block>
6986
+ </xsl:template>
6987
+
6779
6988
  <!-- ====== -->
6780
6989
  <!-- ====== -->
6781
6990
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6925,6 +7134,10 @@
6925
7134
  </xsl:for-each>
6926
7135
  </xsl:template>
6927
7136
 
7137
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
7138
+ <xsl:value-of select="."/>
7139
+ </xsl:template>
7140
+
6928
7141
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6929
7142
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6930
7143
  <xsl:apply-templates mode="contents_item"/>
@@ -8451,6 +8664,44 @@
8451
8664
 
8452
8665
  <fo:list-block xsl:use-attribute-sets="list-style">
8453
8666
 
8667
+ <xsl:variable name="provisional_distance_between_starts_">
8668
+ <attributes xsl:use-attribute-sets="list-style">
8669
+
8670
+ </attributes>
8671
+ </xsl:variable>
8672
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
8673
+ <xsl:if test="$provisional_distance_between_starts != ''">
8674
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
8675
+ </xsl:if>
8676
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
8677
+
8678
+ <!-- increase provisional-distance-between-starts for long lists -->
8679
+ <xsl:if test="local-name() = 'ol'">
8680
+ <!-- Examples: xiii), xviii), xxviii) -->
8681
+ <xsl:variable name="item_numbers">
8682
+ <xsl:for-each select="*[local-name() = 'li']">
8683
+ <item><xsl:call-template name="getListItemFormat"/></item>
8684
+ </xsl:for-each>
8685
+ </xsl:variable>
8686
+
8687
+ <xsl:variable name="max_length">
8688
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
8689
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
8690
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
8691
+ </xsl:for-each>
8692
+ </xsl:variable>
8693
+
8694
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
8695
+ <xsl:variable name="addon" select="$max_length - 4"/>
8696
+ <xsl:if test="$addon &gt; 0">
8697
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
8698
+ </xsl:if>
8699
+ <!-- DEBUG -->
8700
+ <!-- <xsl:copy-of select="$item_numbers"/>
8701
+ <max_length><xsl:value-of select="$max_length"/></max_length>
8702
+ <addon><xsl:value-of select="$addon"/></addon> -->
8703
+ </xsl:if>
8704
+
8454
8705
  <xsl:if test="*[local-name() = 'name']">
8455
8706
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8456
8707
  </xsl:if>
@@ -9404,7 +9655,7 @@
9404
9655
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9405
9656
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9406
9657
  <!-- add &lt; and &gt; to \S -->
9407
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9658
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9408
9659
  <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>
9409
9660
  <xsl:variable name="text3">
9410
9661
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9426,7 +9677,8 @@
9426
9677
  <xsl:choose>
9427
9678
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9428
9679
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9429
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
9680
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
9681
+ <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>
9430
9682
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9431
9683
  <xsl:choose>
9432
9684
  <xsl:when test="self::text()">
@@ -10029,6 +10281,23 @@
10029
10281
  </xsl:if>
10030
10282
  </xsl:template>
10031
10283
 
10284
+ <xsl:template name="setBlockAttributes">
10285
+ <xsl:param name="text_align_default">left</xsl:param>
10286
+ <xsl:call-template name="setTextAlignment">
10287
+ <xsl:with-param name="default" select="$text_align_default"/>
10288
+ </xsl:call-template>
10289
+
10290
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10291
+ <!-- Example: keep-lines-together="true" -->
10292
+ <xsl:if test="@keep-lines-together = 'true'">
10293
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10294
+ </xsl:if>
10295
+ <!-- Example: keep-with-next="true" -->
10296
+ <xsl:if test="@keep-with-next = 'true'">
10297
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10298
+ </xsl:if>
10299
+ </xsl:template>
10300
+
10032
10301
  <xsl:template name="number-to-words">
10033
10302
  <xsl:param name="number"/>
10034
10303
  <xsl:param name="first"/>