metanorma-m3aawg 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1222,7 +1222,6 @@
1222
1222
 
1223
1223
  <xsl:attribute-set name="table-header-cell-style">
1224
1224
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1225
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1226
1225
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1227
1226
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1228
1227
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1231,7 +1230,6 @@
1231
1230
 
1232
1231
  <xsl:attribute-set name="table-cell-style">
1233
1232
  <xsl:attribute name="display-align">center</xsl:attribute>
1234
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1235
1233
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1236
1234
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1237
1235
 
@@ -1957,7 +1955,7 @@
1957
1955
  <xsl:apply-templates select="." mode="contents"/>
1958
1956
  </xsl:for-each>
1959
1957
 
1960
- <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')]]">
1958
+ <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]">
1961
1959
  <xsl:sort select="@displayorder" data-type="number"/>
1962
1960
  <xsl:apply-templates select="." mode="contents"/>
1963
1961
  </xsl:for-each>
@@ -2410,7 +2408,7 @@
2410
2408
  <xsl:variable name="isDeleted" select="@deleted"/>
2411
2409
 
2412
2410
  <xsl:choose>
2413
- <xsl:when test="@width">
2411
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2414
2412
 
2415
2413
  <!-- centered table when table name is centered (see table-name-style) -->
2416
2414
 
@@ -2735,6 +2733,7 @@
2735
2733
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2736
2734
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2737
2735
  <!-- difference between the available space and the minimum table width -->
2736
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2738
2737
  <xsl:variable name="W" select="$page_width - @width_min"/>
2739
2738
  <W><xsl:value-of select="$W"/></W>
2740
2739
  <!-- difference between maximum and minimum width of the table -->
@@ -2898,6 +2897,10 @@
2898
2897
  </xsl:choose>
2899
2898
  </xsl:variable>
2900
2899
 
2900
+ <xsl:variable name="table_fn_block">
2901
+ <xsl:call-template name="table_fn_display"/>
2902
+ </xsl:variable>
2903
+
2901
2904
  <xsl:variable name="tableWithNotesAndFootnotes">
2902
2905
 
2903
2906
  <fo:table keep-with-previous="always">
@@ -2945,11 +2948,25 @@
2945
2948
 
2946
2949
  <xsl:apply-templates select="../*[local-name()='note']"/>
2947
2950
 
2951
+ <xsl:variable name="isDisplayRowSeparator">
2952
+
2953
+ </xsl:variable>
2954
+
2948
2955
  <!-- horizontal row separator -->
2956
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
2957
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
2958
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
2959
+
2960
+ <xsl:call-template name="setBordersTableArray"/>
2961
+ <fo:block font-size="1pt"> </fo:block>
2962
+ </fo:block-container>
2963
+ </xsl:if>
2964
+ </xsl:if>
2949
2965
 
2950
2966
  <!-- fn processing -->
2951
2967
 
2952
- <xsl:call-template name="table_fn_display"/>
2968
+ <!-- <xsl:call-template name="table_fn_display" /> -->
2969
+ <xsl:copy-of select="$table_fn_block"/>
2953
2970
 
2954
2971
  <!-- for PAS display Notes after footnotes -->
2955
2972
 
@@ -3066,6 +3083,28 @@
3066
3083
  </fo:table-row>
3067
3084
  </xsl:template>
3068
3085
 
3086
+ <xsl:template name="setBorderUnderRow">
3087
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
3088
+ <xsl:choose>
3089
+ <xsl:when test="$border_under_row_ != ''">
3090
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3091
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
3092
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
3093
+ <xsl:variable name="border_under_row">
3094
+ <xsl:call-template name="split">
3095
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3096
+ </xsl:call-template>
3097
+ </xsl:variable>
3098
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3099
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3100
+ </xsl:if>
3101
+ </xsl:when>
3102
+ <xsl:otherwise>
3103
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3104
+ </xsl:otherwise>
3105
+ </xsl:choose>
3106
+ </xsl:template>
3107
+
3069
3108
  <!-- row in table footer (tfoot) -->
3070
3109
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3071
3110
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3352,17 +3391,20 @@
3352
3391
  <xsl:for-each select="xalan:nodeset($references)//fn">
3353
3392
  <xsl:variable name="reference" select="@reference"/>
3354
3393
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3355
- <fo:block xsl:use-attribute-sets="table-fn-style">
3356
3394
 
3357
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3395
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3358
3396
 
3359
- <xsl:value-of select="@reference"/>
3397
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3398
+
3399
+ <xsl:value-of select="@reference"/>
3400
+
3401
+ </fo:inline>
3402
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3403
+ <xsl:copy-of select="./node()"/>
3404
+ </fo:inline>
3405
+
3406
+ </fo:block>
3360
3407
 
3361
- </fo:inline>
3362
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3363
- <xsl:copy-of select="./node()"/>
3364
- </fo:inline>
3365
- </fo:block>
3366
3408
  </xsl:if>
3367
3409
  </xsl:for-each>
3368
3410
  </xsl:template>
@@ -3391,8 +3433,16 @@
3391
3433
  <!-- figure's footnotes rendering -->
3392
3434
  <xsl:template name="fn_display_figure">
3393
3435
 
3436
+ <!-- current figure id -->
3437
+ <xsl:variable name="figure_id_">
3438
+ <xsl:value-of select="@id"/>
3439
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
3440
+ </xsl:variable>
3441
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
3442
+
3443
+ <!-- all footnotes relates to the current figure -->
3394
3444
  <xsl:variable name="references">
3395
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
3445
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
3396
3446
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3397
3447
  <xsl:apply-templates/>
3398
3448
  </fn>
@@ -3405,91 +3455,93 @@
3405
3455
 
3406
3456
  </xsl:variable>
3407
3457
 
3408
- <!-- current hierarchy is 'figure' element -->
3409
- <xsl:variable name="following_dl_colwidths">
3410
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3411
- <xsl:variable name="simple-table">
3412
- <!-- <xsl:variable name="doc_ns">
3413
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3458
+ <fo:block>
3459
+
3460
+ <!-- current hierarchy is 'figure' element -->
3461
+ <xsl:variable name="following_dl_colwidths">
3462
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3463
+ <xsl:variable name="simple-table">
3464
+ <!-- <xsl:variable name="doc_ns">
3465
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3466
+ </xsl:variable>
3467
+ <xsl:variable name="ns">
3468
+ <xsl:choose>
3469
+ <xsl:when test="normalize-space($doc_ns) != ''">
3470
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3471
+ </xsl:when>
3472
+ <xsl:otherwise>
3473
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3474
+ </xsl:otherwise>
3475
+ </xsl:choose>
3476
+ </xsl:variable> -->
3477
+
3478
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3479
+ <tbody>
3480
+ <xsl:apply-templates mode="dl"/>
3481
+ </tbody>
3482
+ </xsl:for-each>
3483
+ </xsl:variable>
3484
+
3485
+ <xsl:call-template name="calculate-column-widths">
3486
+ <xsl:with-param name="cols-count" select="2"/>
3487
+ <xsl:with-param name="table" select="$simple-table"/>
3488
+ </xsl:call-template>
3489
+
3490
+ </xsl:if>
3491
+ </xsl:variable>
3492
+
3493
+ <xsl:variable name="maxlength_dt">
3494
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3495
+ <xsl:call-template name="getMaxLength_dt"/>
3496
+ </xsl:for-each>
3414
3497
  </xsl:variable>
3415
- <xsl:variable name="ns">
3498
+
3499
+ <fo:table width="95%" table-layout="fixed">
3500
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3501
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3502
+
3503
+ </xsl:if>
3416
3504
  <xsl:choose>
3417
- <xsl:when test="normalize-space($doc_ns) != ''">
3418
- <xsl:value-of select="normalize-space($doc_ns)"/>
3505
+ <!-- if there 'dl', then set same columns width -->
3506
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3507
+ <xsl:call-template name="setColumnWidth_dl">
3508
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3509
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3510
+ </xsl:call-template>
3419
3511
  </xsl:when>
3420
3512
  <xsl:otherwise>
3421
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3513
+ <fo:table-column column-width="5%"/>
3514
+ <fo:table-column column-width="95%"/>
3422
3515
  </xsl:otherwise>
3423
3516
  </xsl:choose>
3424
- </xsl:variable> -->
3425
-
3426
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3427
- <tbody>
3428
- <xsl:apply-templates mode="dl"/>
3429
- </tbody>
3430
- </xsl:for-each>
3431
- </xsl:variable>
3432
-
3433
- <xsl:call-template name="calculate-column-widths">
3434
- <xsl:with-param name="cols-count" select="2"/>
3435
- <xsl:with-param name="table" select="$simple-table"/>
3436
- </xsl:call-template>
3437
-
3438
- </xsl:if>
3439
- </xsl:variable>
3440
-
3441
- <xsl:variable name="maxlength_dt">
3442
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3443
- <xsl:call-template name="getMaxLength_dt"/>
3444
- </xsl:for-each>
3445
- </xsl:variable>
3446
-
3447
- <fo:block>
3448
- <fo:table width="95%" table-layout="fixed">
3449
- <xsl:if test="normalize-space($key_iso) = 'true'">
3450
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3517
+ <fo:table-body>
3518
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3519
+ <xsl:variable name="reference" select="@reference"/>
3520
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3521
+ <fo:table-row>
3522
+ <fo:table-cell>
3523
+ <fo:block>
3524
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3525
+ <xsl:value-of select="@reference"/>
3526
+ </fo:inline>
3527
+ </fo:block>
3528
+ </fo:table-cell>
3529
+ <fo:table-cell>
3530
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3531
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3451
3532
 
3452
- </xsl:if>
3453
- <xsl:choose>
3454
- <!-- if there 'dl', then set same columns width -->
3455
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3456
- <xsl:call-template name="setColumnWidth_dl">
3457
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3458
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3459
- </xsl:call-template>
3460
- </xsl:when>
3461
- <xsl:otherwise>
3462
- <fo:table-column column-width="15%"/>
3463
- <fo:table-column column-width="85%"/>
3464
- </xsl:otherwise>
3465
- </xsl:choose>
3466
- <fo:table-body>
3467
- <xsl:for-each select="xalan:nodeset($references)//fn">
3468
- <xsl:variable name="reference" select="@reference"/>
3469
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3470
- <fo:table-row>
3471
- <fo:table-cell>
3472
- <fo:block>
3473
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3474
- <xsl:value-of select="@reference"/>
3475
- </fo:inline>
3476
- </fo:block>
3477
- </fo:table-cell>
3478
- <fo:table-cell>
3479
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3480
- <xsl:if test="normalize-space($key_iso) = 'true'">
3533
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3481
3534
 
3482
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
3535
+ </xsl:if>
3536
+ <xsl:copy-of select="./node()"/>
3537
+ </fo:block>
3538
+ </fo:table-cell>
3539
+ </fo:table-row>
3540
+ </xsl:if>
3541
+ </xsl:for-each>
3542
+ </fo:table-body>
3543
+ </fo:table>
3483
3544
 
3484
- </xsl:if>
3485
- <xsl:copy-of select="./node()"/>
3486
- </fo:block>
3487
- </fo:table-cell>
3488
- </fo:table-row>
3489
- </xsl:if>
3490
- </xsl:for-each>
3491
- </fo:table-body>
3492
- </fo:table>
3493
3545
  </fo:block>
3494
3546
  </xsl:if>
3495
3547
 
@@ -3565,12 +3617,14 @@
3565
3617
 
3566
3618
  <fo:block margin-bottom="12pt" text-align="left">
3567
3619
 
3568
- <xsl:variable name="title-where">
3620
+ <!-- <xsl:variable name="title-where">
3569
3621
  <xsl:call-template name="getLocalizedString">
3570
3622
  <xsl:with-param name="key">where</xsl:with-param>
3571
3623
  </xsl:call-template>
3572
3624
  </xsl:variable>
3573
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3625
+ <xsl:value-of select="$title-where"/> -->
3626
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3627
+ <xsl:text> </xsl:text>
3574
3628
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3575
3629
  <xsl:text/>
3576
3630
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3580,12 +3634,14 @@
3580
3634
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3581
3635
  <fo:block margin-bottom="12pt" text-align="left">
3582
3636
 
3583
- <xsl:variable name="title-where">
3637
+ <!-- <xsl:variable name="title-where">
3584
3638
  <xsl:call-template name="getLocalizedString">
3585
3639
  <xsl:with-param name="key">where</xsl:with-param>
3586
3640
  </xsl:call-template>
3587
3641
  </xsl:variable>
3588
- <xsl:value-of select="$title-where"/>
3642
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
3643
+ <!-- preceding 'p' with word 'where' -->
3644
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3589
3645
  </fo:block>
3590
3646
  </xsl:when> <!-- END: a few components -->
3591
3647
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -3768,6 +3824,9 @@
3768
3824
 
3769
3825
  </xsl:template> <!-- END: dl -->
3770
3826
 
3827
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
3828
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
3829
+
3771
3830
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3772
3831
  <xsl:param name="process">false</xsl:param>
3773
3832
  <xsl:if test="$process = 'true'">
@@ -4303,12 +4362,12 @@
4303
4362
  <xsl:param name="value"/>
4304
4363
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4305
4364
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4306
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4307
- <xsl:attribute name="height">5mm</xsl:attribute>
4365
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4366
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4308
4367
  <xsl:attribute name="content-width">100%</xsl:attribute>
4309
4368
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4310
4369
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4311
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4370
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4312
4371
  <g>
4313
4372
  <xsl:if test="$type = 'closing' or $type = 'end'">
4314
4373
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4322,6 +4381,27 @@
4322
4381
  </xsl:if>
4323
4382
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4324
4383
  </text>
4384
+ </svg> -->
4385
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4386
+ <g>
4387
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4388
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4389
+ </xsl:if>
4390
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4391
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4392
+ </g>
4393
+ <xsl:variable name="text_x">
4394
+ <xsl:choose>
4395
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4396
+ <xsl:otherwise>22</xsl:otherwise>
4397
+ </xsl:choose>
4398
+ </xsl:variable>
4399
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4400
+ <xsl:value-of select="$kind"/>
4401
+ </text>
4402
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4403
+ <xsl:value-of select="$value"/>
4404
+ </text>
4325
4405
  </svg>
4326
4406
  </fo:instream-foreign-object>
4327
4407
  </xsl:template>
@@ -4576,18 +4656,34 @@
4576
4656
 
4577
4657
  <xsl:template name="add-zero-spaces-java">
4578
4658
  <xsl:param name="text" select="."/>
4579
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4580
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4659
+
4660
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
4661
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4662
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
4663
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
4664
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4665
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4581
4666
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4582
- <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' -->
4667
+ <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' -->
4583
4668
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4584
- <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' -->
4669
+ <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' -->
4585
4670
  <!-- add zero-width space (#x200B) before character: { -->
4586
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4671
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4587
4672
  <!-- add zero-width space (#x200B) after character: , -->
4588
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4673
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4674
+ <!-- add zero-width space (#x200B) after character: '/' -->
4675
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
4589
4676
 
4590
- <xsl:value-of select="$text5"/>
4677
+ <xsl:variable name="text9">
4678
+ <xsl:choose>
4679
+ <xsl:when test="$isGenerateTableIF = 'true'">
4680
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
4681
+ </xsl:when>
4682
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
4683
+ </xsl:choose>
4684
+ </xsl:variable>
4685
+
4686
+ <xsl:value-of select="$text9"/>
4591
4687
  </xsl:template>
4592
4688
 
4593
4689
  <xsl:template name="add-zero-spaces-link-java">
@@ -4595,8 +4691,10 @@
4595
4691
 
4596
4692
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4597
4693
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4598
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4599
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4694
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
4695
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
4696
+ <!-- remove zero-width space at the end -->
4697
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4600
4698
  </xsl:template>
4601
4699
 
4602
4700
  <!-- add zero space after dash character (for table's entries) -->
@@ -4733,7 +4831,7 @@
4733
4831
  </xsl:copy>
4734
4832
  </xsl:template>
4735
4833
 
4736
- <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">
4834
+ <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">
4737
4835
  <xsl:copy>
4738
4836
  <xsl:copy-of select="@*"/>
4739
4837
  <p>
@@ -4809,6 +4907,14 @@
4809
4907
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4810
4908
  </xsl:template>
4811
4909
 
4910
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
4911
+ <xsl:apply-templates mode="table-without-br"/>
4912
+ </xsl:template>
4913
+
4914
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
4915
+ <xsl:apply-templates mode="table-without-br"/>
4916
+ </xsl:template>
4917
+
4812
4918
  <!-- mode="table-without-br" -->
4813
4919
  <!-- ================================== -->
4814
4920
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -4941,9 +5047,28 @@
4941
5047
  </xsl:variable>
4942
5048
  <xsl:copy-of select="$newRow"/>
4943
5049
 
4944
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4945
- <xsl:with-param name="previousRow" select="$newRow"/>
4946
- </xsl:apply-templates>
5050
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
5051
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
5052
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
5053
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
5054
+ <xsl:choose>
5055
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
5056
+ <xsl:copy-of select="following-sibling::tr"/>
5057
+ </xsl:when>
5058
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
5059
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
5060
+
5061
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5062
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
5063
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5064
+ </xsl:apply-templates>
5065
+ </xsl:when> -->
5066
+ <xsl:otherwise>
5067
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5068
+ <xsl:with-param name="previousRow" select="$newRow"/>
5069
+ </xsl:apply-templates>
5070
+ </xsl:otherwise>
5071
+ </xsl:choose>
4947
5072
  </xsl:template>
4948
5073
  <!-- End mode simple-table-rowspan -->
4949
5074
 
@@ -5106,6 +5231,27 @@
5106
5231
  </xsl:call-template>
5107
5232
  </xsl:template>
5108
5233
 
5234
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5235
+ <xsl:variable name="link">
5236
+ <link_updated>
5237
+ <xsl:variable name="target_text">
5238
+ <xsl:choose>
5239
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5240
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5241
+ </xsl:when>
5242
+ <xsl:otherwise>
5243
+ <xsl:value-of select="normalize-space(@target)"/>
5244
+ </xsl:otherwise>
5245
+ </xsl:choose>
5246
+ </xsl:variable>
5247
+ <xsl:value-of select="$target_text"/>
5248
+ </link_updated>
5249
+ </xsl:variable>
5250
+ <xsl:for-each select="xalan:nodeset($link)/*">
5251
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5252
+ </xsl:for-each>
5253
+ </xsl:template>
5254
+
5109
5255
  <xsl:template name="getFormattingTags">
5110
5256
  <tags>
5111
5257
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5447,7 +5593,7 @@
5447
5593
  </xsl:variable>
5448
5594
  <fo:inline xsl:use-attribute-sets="link-style">
5449
5595
 
5450
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5596
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
5451
5597
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5452
5598
  </xsl:if>
5453
5599
 
@@ -5622,7 +5768,7 @@
5622
5768
 
5623
5769
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5624
5770
 
5625
- <fo:block-container margin-left="0mm">
5771
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5626
5772
 
5627
5773
  <fo:block>
5628
5774
 
@@ -5802,13 +5948,16 @@
5802
5948
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5803
5949
  </xsl:call-template>
5804
5950
 
5951
+ <!-- Example: Dimensions in millimeters -->
5952
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5953
+
5805
5954
  <fo:block xsl:use-attribute-sets="figure-style">
5806
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5955
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5807
5956
  </fo:block>
5808
- <xsl:call-template name="fn_display_figure"/>
5809
- <xsl:for-each select="*[local-name() = 'note']">
5957
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5810
5958
  <xsl:call-template name="note"/>
5811
5959
  </xsl:for-each>
5960
+ <xsl:call-template name="fn_display_figure"/>
5812
5961
 
5813
5962
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
5814
5963
 
@@ -5871,7 +6020,13 @@
5871
6020
  </xsl:choose>
5872
6021
  </xsl:variable>
5873
6022
 
5874
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6023
+ <xsl:variable name="image_width_effective">
6024
+
6025
+ <xsl:value-of select="$width_effective"/>
6026
+
6027
+ </xsl:variable>
6028
+
6029
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
5875
6030
  <xsl:if test="number($scale) &lt; 100">
5876
6031
 
5877
6032
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -6063,24 +6218,47 @@
6063
6218
 
6064
6219
  </xsl:when>
6065
6220
  <xsl:otherwise>
6066
- <fo:block xsl:use-attribute-sets="image-style">
6067
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6068
- <xsl:attribute name="width">100%</xsl:attribute>
6069
- <xsl:attribute name="content-height">100%</xsl:attribute>
6070
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6071
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6072
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6073
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6074
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6075
- <!-- effective height / width = 1.48, 1.4 - with title -->
6076
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6077
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6078
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6079
- </xsl:if>
6080
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6081
- <xsl:copy-of select="$svg_content"/>
6082
- </fo:instream-foreign-object>
6083
- </fo:block>
6221
+
6222
+ <xsl:variable name="element">
6223
+ <xsl:choose>
6224
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6225
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6226
+ </xsl:when>
6227
+ <xsl:otherwise>
6228
+ <fo:block xsl:use-attribute-sets="image-style">
6229
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6230
+ <xsl:attribute name="text-align">left</xsl:attribute>
6231
+ </xsl:if>
6232
+ </fo:block>
6233
+ </xsl:otherwise>
6234
+ </xsl:choose>
6235
+ </xsl:variable>
6236
+
6237
+ <xsl:for-each select="xalan:nodeset($element)/*">
6238
+ <xsl:copy>
6239
+ <xsl:copy-of select="@*"/>
6240
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6241
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6242
+ <xsl:if test="$isGenerateTableIF = 'false'">
6243
+ <xsl:attribute name="width">100%</xsl:attribute>
6244
+ </xsl:if>
6245
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6246
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6247
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6248
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6249
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6250
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6251
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6252
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6253
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6254
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6255
+ </xsl:if>
6256
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6257
+ <xsl:copy-of select="$svg_content"/>
6258
+ </fo:instream-foreign-object>
6259
+ <!-- </fo:block> -->
6260
+ </xsl:copy>
6261
+ </xsl:for-each>
6084
6262
  </xsl:otherwise>
6085
6263
  </xsl:choose>
6086
6264
  </xsl:template>
@@ -6172,6 +6350,13 @@
6172
6350
  </xsl:for-each>
6173
6351
  </xsl:template>
6174
6352
 
6353
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6354
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6355
+ <xsl:for-each select="*[local-name() = 'svg']">
6356
+ <xsl:call-template name="image_svg"/>
6357
+ </xsl:for-each>
6358
+ </xsl:template>
6359
+
6175
6360
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6176
6361
  <xsl:variable name="svg_content" select="document(@src)"/>
6177
6362
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6310,6 +6495,8 @@
6310
6495
  <xsl:value-of select="."/>
6311
6496
  </xsl:template>
6312
6497
 
6498
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6499
+
6313
6500
  <xsl:template match="node()" mode="contents">
6314
6501
  <xsl:apply-templates mode="contents"/>
6315
6502
  </xsl:template>
@@ -6426,6 +6613,13 @@
6426
6613
  <xsl:when test="$contents_nodes/doc">
6427
6614
  <xsl:choose>
6428
6615
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
6616
+
6617
+ <xsl:if test="$contents_nodes/collection">
6618
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
6619
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
6620
+ </fo:bookmark>
6621
+ </xsl:if>
6622
+
6429
6623
  <xsl:for-each select="$contents_nodes/doc">
6430
6624
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6431
6625
  <xsl:if test="@bundle = 'true'">
@@ -6617,7 +6811,15 @@
6617
6811
  <xsl:value-of select="@section"/>
6618
6812
  <xsl:text> </xsl:text>
6619
6813
  </xsl:if>
6620
- <xsl:value-of select="normalize-space(title)"/>
6814
+ <xsl:variable name="title">
6815
+ <xsl:for-each select="title/node()">
6816
+ <xsl:choose>
6817
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6818
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6819
+ </xsl:choose>
6820
+ </xsl:for-each>
6821
+ </xsl:variable>
6822
+ <xsl:value-of select="normalize-space($title)"/>
6621
6823
  </fo:bookmark-title>
6622
6824
  <xsl:apply-templates mode="bookmark"/>
6623
6825
  </fo:bookmark>
@@ -6643,6 +6845,12 @@
6643
6845
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6644
6846
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6645
6847
 
6848
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6849
+ <fo:block text-align="right" keep-with-next="always">
6850
+ <xsl:apply-templates/>
6851
+ </fo:block>
6852
+ </xsl:template>
6853
+
6646
6854
  <!-- ====== -->
6647
6855
  <!-- ====== -->
6648
6856
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6792,6 +7000,10 @@
6792
7000
  </xsl:for-each>
6793
7001
  </xsl:template>
6794
7002
 
7003
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
7004
+ <xsl:value-of select="."/>
7005
+ </xsl:template>
7006
+
6795
7007
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6796
7008
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6797
7009
  <xsl:apply-templates mode="contents_item"/>
@@ -8285,9 +8497,47 @@
8285
8497
 
8286
8498
  <fo:list-block xsl:use-attribute-sets="list-style">
8287
8499
 
8288
- <xsl:if test="local-name() = 'ol'">
8289
- <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
8500
+ <xsl:variable name="provisional_distance_between_starts_">
8501
+ <attributes xsl:use-attribute-sets="list-style">
8502
+
8503
+ <xsl:if test="local-name() = 'ol'">
8504
+ <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
8505
+ </xsl:if>
8506
+
8507
+ </attributes>
8508
+ </xsl:variable>
8509
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
8510
+ <xsl:if test="$provisional_distance_between_starts != ''">
8511
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
8512
+ </xsl:if>
8513
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
8514
+
8515
+ <!-- increase provisional-distance-between-starts for long lists -->
8516
+ <xsl:if test="local-name() = 'ol'">
8517
+ <!-- Examples: xiii), xviii), xxviii) -->
8518
+ <xsl:variable name="item_numbers">
8519
+ <xsl:for-each select="*[local-name() = 'li']">
8520
+ <item><xsl:call-template name="getListItemFormat"/></item>
8521
+ </xsl:for-each>
8522
+ </xsl:variable>
8523
+
8524
+ <xsl:variable name="max_length">
8525
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
8526
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
8527
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
8528
+ </xsl:for-each>
8529
+ </xsl:variable>
8530
+
8531
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
8532
+ <xsl:variable name="addon" select="$max_length - 4"/>
8533
+ <xsl:if test="$addon &gt; 0">
8534
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
8290
8535
  </xsl:if>
8536
+ <!-- DEBUG -->
8537
+ <!-- <xsl:copy-of select="$item_numbers"/>
8538
+ <max_length><xsl:value-of select="$max_length"/></max_length>
8539
+ <addon><xsl:value-of select="$addon"/></addon> -->
8540
+ </xsl:if>
8291
8541
 
8292
8542
  <xsl:if test="*[local-name() = 'name']">
8293
8543
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -9246,7 +9496,7 @@
9246
9496
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9247
9497
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9248
9498
  <!-- add &lt; and &gt; to \S -->
9249
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9499
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9250
9500
  <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>
9251
9501
  <xsl:variable name="text3">
9252
9502
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9268,7 +9518,8 @@
9268
9518
  <xsl:choose>
9269
9519
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9270
9520
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9271
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
9521
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
9522
+ <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>
9272
9523
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9273
9524
  <xsl:choose>
9274
9525
  <xsl:when test="self::text()">
@@ -9871,6 +10122,23 @@
9871
10122
  </xsl:if>
9872
10123
  </xsl:template>
9873
10124
 
10125
+ <xsl:template name="setBlockAttributes">
10126
+ <xsl:param name="text_align_default">left</xsl:param>
10127
+ <xsl:call-template name="setTextAlignment">
10128
+ <xsl:with-param name="default" select="$text_align_default"/>
10129
+ </xsl:call-template>
10130
+
10131
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10132
+ <!-- Example: keep-lines-together="true" -->
10133
+ <xsl:if test="@keep-lines-together = 'true'">
10134
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10135
+ </xsl:if>
10136
+ <!-- Example: keep-with-next="true" -->
10137
+ <xsl:if test="@keep-with-next = 'true'">
10138
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10139
+ </xsl:if>
10140
+ </xsl:template>
10141
+
9874
10142
  <xsl:template name="number-to-words">
9875
10143
  <xsl:param name="number"/>
9876
10144
  <xsl:param name="first"/>