metanorma-csa 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1142,7 +1142,6 @@
1142
1142
 
1143
1143
  <xsl:attribute-set name="table-header-cell-style">
1144
1144
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1145
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1146
1145
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1147
1146
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1148
1147
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1151,7 +1150,6 @@
1151
1150
 
1152
1151
  <xsl:attribute-set name="table-cell-style">
1153
1152
  <xsl:attribute name="display-align">center</xsl:attribute>
1154
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1155
1153
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1156
1154
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1157
1155
 
@@ -1895,7 +1893,7 @@
1895
1893
  <xsl:apply-templates select="." mode="contents"/>
1896
1894
  </xsl:for-each>
1897
1895
 
1898
- <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')]]">
1896
+ <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]">
1899
1897
  <xsl:sort select="@displayorder" data-type="number"/>
1900
1898
  <xsl:apply-templates select="." mode="contents"/>
1901
1899
  </xsl:for-each>
@@ -2340,7 +2338,7 @@
2340
2338
  <xsl:variable name="isDeleted" select="@deleted"/>
2341
2339
 
2342
2340
  <xsl:choose>
2343
- <xsl:when test="@width">
2341
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2344
2342
 
2345
2343
  <!-- centered table when table name is centered (see table-name-style) -->
2346
2344
 
@@ -2665,6 +2663,7 @@
2665
2663
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2666
2664
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2667
2665
  <!-- difference between the available space and the minimum table width -->
2666
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2668
2667
  <xsl:variable name="W" select="$page_width - @width_min"/>
2669
2668
  <W><xsl:value-of select="$W"/></W>
2670
2669
  <!-- difference between maximum and minimum width of the table -->
@@ -2828,6 +2827,10 @@
2828
2827
  </xsl:choose>
2829
2828
  </xsl:variable>
2830
2829
 
2830
+ <xsl:variable name="table_fn_block">
2831
+ <xsl:call-template name="table_fn_display"/>
2832
+ </xsl:variable>
2833
+
2831
2834
  <xsl:variable name="tableWithNotesAndFootnotes">
2832
2835
 
2833
2836
  <fo:table keep-with-previous="always">
@@ -2875,11 +2878,25 @@
2875
2878
 
2876
2879
  <xsl:apply-templates select="../*[local-name()='note']"/>
2877
2880
 
2881
+ <xsl:variable name="isDisplayRowSeparator">
2882
+
2883
+ </xsl:variable>
2884
+
2878
2885
  <!-- horizontal row separator -->
2886
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
2887
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
2888
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
2889
+
2890
+ <xsl:call-template name="setBordersTableArray"/>
2891
+ <fo:block font-size="1pt"> </fo:block>
2892
+ </fo:block-container>
2893
+ </xsl:if>
2894
+ </xsl:if>
2879
2895
 
2880
2896
  <!-- fn processing -->
2881
2897
 
2882
- <xsl:call-template name="table_fn_display"/>
2898
+ <!-- <xsl:call-template name="table_fn_display" /> -->
2899
+ <xsl:copy-of select="$table_fn_block"/>
2883
2900
 
2884
2901
  <!-- for PAS display Notes after footnotes -->
2885
2902
 
@@ -2996,6 +3013,28 @@
2996
3013
  </fo:table-row>
2997
3014
  </xsl:template>
2998
3015
 
3016
+ <xsl:template name="setBorderUnderRow">
3017
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
3018
+ <xsl:choose>
3019
+ <xsl:when test="$border_under_row_ != ''">
3020
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3021
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
3022
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
3023
+ <xsl:variable name="border_under_row">
3024
+ <xsl:call-template name="split">
3025
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3026
+ </xsl:call-template>
3027
+ </xsl:variable>
3028
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3029
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3030
+ </xsl:if>
3031
+ </xsl:when>
3032
+ <xsl:otherwise>
3033
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3034
+ </xsl:otherwise>
3035
+ </xsl:choose>
3036
+ </xsl:template>
3037
+
2999
3038
  <!-- row in table footer (tfoot) -->
3000
3039
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3001
3040
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3282,17 +3321,20 @@
3282
3321
  <xsl:for-each select="xalan:nodeset($references)//fn">
3283
3322
  <xsl:variable name="reference" select="@reference"/>
3284
3323
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3285
- <fo:block xsl:use-attribute-sets="table-fn-style">
3286
3324
 
3287
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3325
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3288
3326
 
3289
- <xsl:value-of select="@reference"/>
3327
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3328
+
3329
+ <xsl:value-of select="@reference"/>
3330
+
3331
+ </fo:inline>
3332
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3333
+ <xsl:copy-of select="./node()"/>
3334
+ </fo:inline>
3335
+
3336
+ </fo:block>
3290
3337
 
3291
- </fo:inline>
3292
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3293
- <xsl:copy-of select="./node()"/>
3294
- </fo:inline>
3295
- </fo:block>
3296
3338
  </xsl:if>
3297
3339
  </xsl:for-each>
3298
3340
  </xsl:template>
@@ -3321,8 +3363,16 @@
3321
3363
  <!-- figure's footnotes rendering -->
3322
3364
  <xsl:template name="fn_display_figure">
3323
3365
 
3366
+ <!-- current figure id -->
3367
+ <xsl:variable name="figure_id_">
3368
+ <xsl:value-of select="@id"/>
3369
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
3370
+ </xsl:variable>
3371
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
3372
+
3373
+ <!-- all footnotes relates to the current figure -->
3324
3374
  <xsl:variable name="references">
3325
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
3375
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
3326
3376
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3327
3377
  <xsl:apply-templates/>
3328
3378
  </fn>
@@ -3335,91 +3385,93 @@
3335
3385
 
3336
3386
  </xsl:variable>
3337
3387
 
3338
- <!-- current hierarchy is 'figure' element -->
3339
- <xsl:variable name="following_dl_colwidths">
3340
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3341
- <xsl:variable name="simple-table">
3342
- <!-- <xsl:variable name="doc_ns">
3343
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3388
+ <fo:block>
3389
+
3390
+ <!-- current hierarchy is 'figure' element -->
3391
+ <xsl:variable name="following_dl_colwidths">
3392
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3393
+ <xsl:variable name="simple-table">
3394
+ <!-- <xsl:variable name="doc_ns">
3395
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3396
+ </xsl:variable>
3397
+ <xsl:variable name="ns">
3398
+ <xsl:choose>
3399
+ <xsl:when test="normalize-space($doc_ns) != ''">
3400
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3401
+ </xsl:when>
3402
+ <xsl:otherwise>
3403
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3404
+ </xsl:otherwise>
3405
+ </xsl:choose>
3406
+ </xsl:variable> -->
3407
+
3408
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3409
+ <tbody>
3410
+ <xsl:apply-templates mode="dl"/>
3411
+ </tbody>
3412
+ </xsl:for-each>
3413
+ </xsl:variable>
3414
+
3415
+ <xsl:call-template name="calculate-column-widths">
3416
+ <xsl:with-param name="cols-count" select="2"/>
3417
+ <xsl:with-param name="table" select="$simple-table"/>
3418
+ </xsl:call-template>
3419
+
3420
+ </xsl:if>
3344
3421
  </xsl:variable>
3345
- <xsl:variable name="ns">
3422
+
3423
+ <xsl:variable name="maxlength_dt">
3424
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3425
+ <xsl:call-template name="getMaxLength_dt"/>
3426
+ </xsl:for-each>
3427
+ </xsl:variable>
3428
+
3429
+ <fo:table width="95%" table-layout="fixed">
3430
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3431
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3432
+
3433
+ </xsl:if>
3346
3434
  <xsl:choose>
3347
- <xsl:when test="normalize-space($doc_ns) != ''">
3348
- <xsl:value-of select="normalize-space($doc_ns)"/>
3435
+ <!-- if there 'dl', then set same columns width -->
3436
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3437
+ <xsl:call-template name="setColumnWidth_dl">
3438
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3439
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3440
+ </xsl:call-template>
3349
3441
  </xsl:when>
3350
3442
  <xsl:otherwise>
3351
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3443
+ <fo:table-column column-width="5%"/>
3444
+ <fo:table-column column-width="95%"/>
3352
3445
  </xsl:otherwise>
3353
3446
  </xsl:choose>
3354
- </xsl:variable> -->
3355
-
3356
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3357
- <tbody>
3358
- <xsl:apply-templates mode="dl"/>
3359
- </tbody>
3360
- </xsl:for-each>
3361
- </xsl:variable>
3362
-
3363
- <xsl:call-template name="calculate-column-widths">
3364
- <xsl:with-param name="cols-count" select="2"/>
3365
- <xsl:with-param name="table" select="$simple-table"/>
3366
- </xsl:call-template>
3367
-
3368
- </xsl:if>
3369
- </xsl:variable>
3370
-
3371
- <xsl:variable name="maxlength_dt">
3372
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3373
- <xsl:call-template name="getMaxLength_dt"/>
3374
- </xsl:for-each>
3375
- </xsl:variable>
3447
+ <fo:table-body>
3448
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3449
+ <xsl:variable name="reference" select="@reference"/>
3450
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3451
+ <fo:table-row>
3452
+ <fo:table-cell>
3453
+ <fo:block>
3454
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3455
+ <xsl:value-of select="@reference"/>
3456
+ </fo:inline>
3457
+ </fo:block>
3458
+ </fo:table-cell>
3459
+ <fo:table-cell>
3460
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3461
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3376
3462
 
3377
- <fo:block>
3378
- <fo:table width="95%" table-layout="fixed">
3379
- <xsl:if test="normalize-space($key_iso) = 'true'">
3380
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3463
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3381
3464
 
3382
- </xsl:if>
3383
- <xsl:choose>
3384
- <!-- if there 'dl', then set same columns width -->
3385
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3386
- <xsl:call-template name="setColumnWidth_dl">
3387
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3388
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3389
- </xsl:call-template>
3390
- </xsl:when>
3391
- <xsl:otherwise>
3392
- <fo:table-column column-width="15%"/>
3393
- <fo:table-column column-width="85%"/>
3394
- </xsl:otherwise>
3395
- </xsl:choose>
3396
- <fo:table-body>
3397
- <xsl:for-each select="xalan:nodeset($references)//fn">
3398
- <xsl:variable name="reference" select="@reference"/>
3399
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3400
- <fo:table-row>
3401
- <fo:table-cell>
3402
- <fo:block>
3403
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3404
- <xsl:value-of select="@reference"/>
3405
- </fo:inline>
3406
- </fo:block>
3407
- </fo:table-cell>
3408
- <fo:table-cell>
3409
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3410
- <xsl:if test="normalize-space($key_iso) = 'true'">
3411
-
3412
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
3465
+ </xsl:if>
3466
+ <xsl:copy-of select="./node()"/>
3467
+ </fo:block>
3468
+ </fo:table-cell>
3469
+ </fo:table-row>
3470
+ </xsl:if>
3471
+ </xsl:for-each>
3472
+ </fo:table-body>
3473
+ </fo:table>
3413
3474
 
3414
- </xsl:if>
3415
- <xsl:copy-of select="./node()"/>
3416
- </fo:block>
3417
- </fo:table-cell>
3418
- </fo:table-row>
3419
- </xsl:if>
3420
- </xsl:for-each>
3421
- </fo:table-body>
3422
- </fo:table>
3423
3475
  </fo:block>
3424
3476
  </xsl:if>
3425
3477
 
@@ -3495,12 +3547,14 @@
3495
3547
 
3496
3548
  <fo:block margin-bottom="12pt" text-align="left">
3497
3549
 
3498
- <xsl:variable name="title-where">
3550
+ <!-- <xsl:variable name="title-where">
3499
3551
  <xsl:call-template name="getLocalizedString">
3500
3552
  <xsl:with-param name="key">where</xsl:with-param>
3501
3553
  </xsl:call-template>
3502
3554
  </xsl:variable>
3503
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3555
+ <xsl:value-of select="$title-where"/> -->
3556
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3557
+ <xsl:text> </xsl:text>
3504
3558
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3505
3559
  <xsl:text/>
3506
3560
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3510,12 +3564,14 @@
3510
3564
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3511
3565
  <fo:block margin-bottom="12pt" text-align="left">
3512
3566
 
3513
- <xsl:variable name="title-where">
3567
+ <!-- <xsl:variable name="title-where">
3514
3568
  <xsl:call-template name="getLocalizedString">
3515
3569
  <xsl:with-param name="key">where</xsl:with-param>
3516
3570
  </xsl:call-template>
3517
3571
  </xsl:variable>
3518
- <xsl:value-of select="$title-where"/>
3572
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
3573
+ <!-- preceding 'p' with word 'where' -->
3574
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3519
3575
  </fo:block>
3520
3576
  </xsl:when> <!-- END: a few components -->
3521
3577
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -3698,6 +3754,9 @@
3698
3754
 
3699
3755
  </xsl:template> <!-- END: dl -->
3700
3756
 
3757
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
3758
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
3759
+
3701
3760
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3702
3761
  <xsl:param name="process">false</xsl:param>
3703
3762
  <xsl:if test="$process = 'true'">
@@ -4230,12 +4289,12 @@
4230
4289
  <xsl:param name="value"/>
4231
4290
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4232
4291
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4233
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4234
- <xsl:attribute name="height">5mm</xsl:attribute>
4292
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4293
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4235
4294
  <xsl:attribute name="content-width">100%</xsl:attribute>
4236
4295
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4237
4296
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4238
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4297
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4239
4298
  <g>
4240
4299
  <xsl:if test="$type = 'closing' or $type = 'end'">
4241
4300
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4249,6 +4308,27 @@
4249
4308
  </xsl:if>
4250
4309
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4251
4310
  </text>
4311
+ </svg> -->
4312
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4313
+ <g>
4314
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4315
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4316
+ </xsl:if>
4317
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4318
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4319
+ </g>
4320
+ <xsl:variable name="text_x">
4321
+ <xsl:choose>
4322
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4323
+ <xsl:otherwise>22</xsl:otherwise>
4324
+ </xsl:choose>
4325
+ </xsl:variable>
4326
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4327
+ <xsl:value-of select="$kind"/>
4328
+ </text>
4329
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4330
+ <xsl:value-of select="$value"/>
4331
+ </text>
4252
4332
  </svg>
4253
4333
  </fo:instream-foreign-object>
4254
4334
  </xsl:template>
@@ -4503,18 +4583,34 @@
4503
4583
 
4504
4584
  <xsl:template name="add-zero-spaces-java">
4505
4585
  <xsl:param name="text" select="."/>
4506
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4507
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4586
+
4587
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
4588
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4589
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
4590
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
4591
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4592
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4508
4593
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4509
- <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' -->
4594
+ <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' -->
4510
4595
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4511
- <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' -->
4596
+ <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' -->
4512
4597
  <!-- add zero-width space (#x200B) before character: { -->
4513
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4598
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4514
4599
  <!-- add zero-width space (#x200B) after character: , -->
4515
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4600
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4601
+ <!-- add zero-width space (#x200B) after character: '/' -->
4602
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
4516
4603
 
4517
- <xsl:value-of select="$text5"/>
4604
+ <xsl:variable name="text9">
4605
+ <xsl:choose>
4606
+ <xsl:when test="$isGenerateTableIF = 'true'">
4607
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
4608
+ </xsl:when>
4609
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
4610
+ </xsl:choose>
4611
+ </xsl:variable>
4612
+
4613
+ <xsl:value-of select="$text9"/>
4518
4614
  </xsl:template>
4519
4615
 
4520
4616
  <xsl:template name="add-zero-spaces-link-java">
@@ -4522,8 +4618,10 @@
4522
4618
 
4523
4619
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4524
4620
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4525
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4526
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4621
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
4622
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
4623
+ <!-- remove zero-width space at the end -->
4624
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4527
4625
  </xsl:template>
4528
4626
 
4529
4627
  <!-- add zero space after dash character (for table's entries) -->
@@ -4660,7 +4758,7 @@
4660
4758
  </xsl:copy>
4661
4759
  </xsl:template>
4662
4760
 
4663
- <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">
4761
+ <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">
4664
4762
  <xsl:copy>
4665
4763
  <xsl:copy-of select="@*"/>
4666
4764
  <p>
@@ -4736,6 +4834,14 @@
4736
4834
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4737
4835
  </xsl:template>
4738
4836
 
4837
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
4838
+ <xsl:apply-templates mode="table-without-br"/>
4839
+ </xsl:template>
4840
+
4841
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
4842
+ <xsl:apply-templates mode="table-without-br"/>
4843
+ </xsl:template>
4844
+
4739
4845
  <!-- mode="table-without-br" -->
4740
4846
  <!-- ================================== -->
4741
4847
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -4868,9 +4974,28 @@
4868
4974
  </xsl:variable>
4869
4975
  <xsl:copy-of select="$newRow"/>
4870
4976
 
4871
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4872
- <xsl:with-param name="previousRow" select="$newRow"/>
4873
- </xsl:apply-templates>
4977
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
4978
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
4979
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
4980
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
4981
+ <xsl:choose>
4982
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
4983
+ <xsl:copy-of select="following-sibling::tr"/>
4984
+ </xsl:when>
4985
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
4986
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
4987
+
4988
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
4989
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
4990
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
4991
+ </xsl:apply-templates>
4992
+ </xsl:when> -->
4993
+ <xsl:otherwise>
4994
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4995
+ <xsl:with-param name="previousRow" select="$newRow"/>
4996
+ </xsl:apply-templates>
4997
+ </xsl:otherwise>
4998
+ </xsl:choose>
4874
4999
  </xsl:template>
4875
5000
  <!-- End mode simple-table-rowspan -->
4876
5001
 
@@ -5033,6 +5158,27 @@
5033
5158
  </xsl:call-template>
5034
5159
  </xsl:template>
5035
5160
 
5161
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5162
+ <xsl:variable name="link">
5163
+ <link_updated>
5164
+ <xsl:variable name="target_text">
5165
+ <xsl:choose>
5166
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5167
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5168
+ </xsl:when>
5169
+ <xsl:otherwise>
5170
+ <xsl:value-of select="normalize-space(@target)"/>
5171
+ </xsl:otherwise>
5172
+ </xsl:choose>
5173
+ </xsl:variable>
5174
+ <xsl:value-of select="$target_text"/>
5175
+ </link_updated>
5176
+ </xsl:variable>
5177
+ <xsl:for-each select="xalan:nodeset($link)/*">
5178
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5179
+ </xsl:for-each>
5180
+ </xsl:template>
5181
+
5036
5182
  <xsl:template name="getFormattingTags">
5037
5183
  <tags>
5038
5184
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5374,7 +5520,7 @@
5374
5520
  </xsl:variable>
5375
5521
  <fo:inline xsl:use-attribute-sets="link-style">
5376
5522
 
5377
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5523
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
5378
5524
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5379
5525
  </xsl:if>
5380
5526
 
@@ -5549,7 +5695,7 @@
5549
5695
 
5550
5696
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5551
5697
 
5552
- <fo:block-container margin-left="0mm">
5698
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5553
5699
 
5554
5700
  <xsl:if test="ancestor::csa:ul or ancestor::csa:ol and not(ancestor::csa:note[1]/following-sibling::*)">
5555
5701
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -5727,13 +5873,16 @@
5727
5873
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5728
5874
  </xsl:call-template>
5729
5875
 
5876
+ <!-- Example: Dimensions in millimeters -->
5877
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5878
+
5730
5879
  <fo:block xsl:use-attribute-sets="figure-style">
5731
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5880
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5732
5881
  </fo:block>
5733
- <xsl:call-template name="fn_display_figure"/>
5734
- <xsl:for-each select="*[local-name() = 'note']">
5882
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5735
5883
  <xsl:call-template name="note"/>
5736
5884
  </xsl:for-each>
5885
+ <xsl:call-template name="fn_display_figure"/>
5737
5886
 
5738
5887
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
5739
5888
 
@@ -5796,7 +5945,13 @@
5796
5945
  </xsl:choose>
5797
5946
  </xsl:variable>
5798
5947
 
5799
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5948
+ <xsl:variable name="image_width_effective">
5949
+
5950
+ <xsl:value-of select="$width_effective"/>
5951
+
5952
+ </xsl:variable>
5953
+
5954
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
5800
5955
  <xsl:if test="number($scale) &lt; 100">
5801
5956
 
5802
5957
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -5988,24 +6143,47 @@
5988
6143
 
5989
6144
  </xsl:when>
5990
6145
  <xsl:otherwise>
5991
- <fo:block xsl:use-attribute-sets="image-style">
5992
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5993
- <xsl:attribute name="width">100%</xsl:attribute>
5994
- <xsl:attribute name="content-height">100%</xsl:attribute>
5995
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5996
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
5997
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
5998
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5999
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6000
- <!-- effective height / width = 1.48, 1.4 - with title -->
6001
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6002
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6003
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6004
- </xsl:if>
6005
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6006
- <xsl:copy-of select="$svg_content"/>
6007
- </fo:instream-foreign-object>
6008
- </fo:block>
6146
+
6147
+ <xsl:variable name="element">
6148
+ <xsl:choose>
6149
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6150
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6151
+ </xsl:when>
6152
+ <xsl:otherwise>
6153
+ <fo:block xsl:use-attribute-sets="image-style">
6154
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6155
+ <xsl:attribute name="text-align">left</xsl:attribute>
6156
+ </xsl:if>
6157
+ </fo:block>
6158
+ </xsl:otherwise>
6159
+ </xsl:choose>
6160
+ </xsl:variable>
6161
+
6162
+ <xsl:for-each select="xalan:nodeset($element)/*">
6163
+ <xsl:copy>
6164
+ <xsl:copy-of select="@*"/>
6165
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6166
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6167
+ <xsl:if test="$isGenerateTableIF = 'false'">
6168
+ <xsl:attribute name="width">100%</xsl:attribute>
6169
+ </xsl:if>
6170
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6171
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6172
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6173
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6174
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6175
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6176
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6177
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6178
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6179
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6180
+ </xsl:if>
6181
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6182
+ <xsl:copy-of select="$svg_content"/>
6183
+ </fo:instream-foreign-object>
6184
+ <!-- </fo:block> -->
6185
+ </xsl:copy>
6186
+ </xsl:for-each>
6009
6187
  </xsl:otherwise>
6010
6188
  </xsl:choose>
6011
6189
  </xsl:template>
@@ -6097,6 +6275,13 @@
6097
6275
  </xsl:for-each>
6098
6276
  </xsl:template>
6099
6277
 
6278
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6279
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6280
+ <xsl:for-each select="*[local-name() = 'svg']">
6281
+ <xsl:call-template name="image_svg"/>
6282
+ </xsl:for-each>
6283
+ </xsl:template>
6284
+
6100
6285
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6101
6286
  <xsl:variable name="svg_content" select="document(@src)"/>
6102
6287
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6235,6 +6420,8 @@
6235
6420
  <xsl:value-of select="."/>
6236
6421
  </xsl:template>
6237
6422
 
6423
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6424
+
6238
6425
  <xsl:template match="node()" mode="contents">
6239
6426
  <xsl:apply-templates mode="contents"/>
6240
6427
  </xsl:template>
@@ -6351,6 +6538,13 @@
6351
6538
  <xsl:when test="$contents_nodes/doc">
6352
6539
  <xsl:choose>
6353
6540
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
6541
+
6542
+ <xsl:if test="$contents_nodes/collection">
6543
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
6544
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
6545
+ </fo:bookmark>
6546
+ </xsl:if>
6547
+
6354
6548
  <xsl:for-each select="$contents_nodes/doc">
6355
6549
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6356
6550
  <xsl:if test="@bundle = 'true'">
@@ -6542,7 +6736,15 @@
6542
6736
  <xsl:value-of select="@section"/>
6543
6737
  <xsl:text> </xsl:text>
6544
6738
  </xsl:if>
6545
- <xsl:value-of select="normalize-space(title)"/>
6739
+ <xsl:variable name="title">
6740
+ <xsl:for-each select="title/node()">
6741
+ <xsl:choose>
6742
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6743
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6744
+ </xsl:choose>
6745
+ </xsl:for-each>
6746
+ </xsl:variable>
6747
+ <xsl:value-of select="normalize-space($title)"/>
6546
6748
  </fo:bookmark-title>
6547
6749
  <xsl:apply-templates mode="bookmark"/>
6548
6750
  </fo:bookmark>
@@ -6568,6 +6770,12 @@
6568
6770
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6569
6771
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6570
6772
 
6773
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6774
+ <fo:block text-align="right" keep-with-next="always">
6775
+ <xsl:apply-templates/>
6776
+ </fo:block>
6777
+ </xsl:template>
6778
+
6571
6779
  <!-- ====== -->
6572
6780
  <!-- ====== -->
6573
6781
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6717,6 +6925,10 @@
6717
6925
  </xsl:for-each>
6718
6926
  </xsl:template>
6719
6927
 
6928
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
6929
+ <xsl:value-of select="."/>
6930
+ </xsl:template>
6931
+
6720
6932
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6721
6933
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6722
6934
  <xsl:apply-templates mode="contents_item"/>
@@ -8209,6 +8421,44 @@
8209
8421
 
8210
8422
  <fo:list-block xsl:use-attribute-sets="list-style">
8211
8423
 
8424
+ <xsl:variable name="provisional_distance_between_starts_">
8425
+ <attributes xsl:use-attribute-sets="list-style">
8426
+
8427
+ </attributes>
8428
+ </xsl:variable>
8429
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
8430
+ <xsl:if test="$provisional_distance_between_starts != ''">
8431
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
8432
+ </xsl:if>
8433
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
8434
+
8435
+ <!-- increase provisional-distance-between-starts for long lists -->
8436
+ <xsl:if test="local-name() = 'ol'">
8437
+ <!-- Examples: xiii), xviii), xxviii) -->
8438
+ <xsl:variable name="item_numbers">
8439
+ <xsl:for-each select="*[local-name() = 'li']">
8440
+ <item><xsl:call-template name="getListItemFormat"/></item>
8441
+ </xsl:for-each>
8442
+ </xsl:variable>
8443
+
8444
+ <xsl:variable name="max_length">
8445
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
8446
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
8447
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
8448
+ </xsl:for-each>
8449
+ </xsl:variable>
8450
+
8451
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
8452
+ <xsl:variable name="addon" select="$max_length - 4"/>
8453
+ <xsl:if test="$addon &gt; 0">
8454
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
8455
+ </xsl:if>
8456
+ <!-- DEBUG -->
8457
+ <!-- <xsl:copy-of select="$item_numbers"/>
8458
+ <max_length><xsl:value-of select="$max_length"/></max_length>
8459
+ <addon><xsl:value-of select="$addon"/></addon> -->
8460
+ </xsl:if>
8461
+
8212
8462
  <xsl:if test="*[local-name() = 'name']">
8213
8463
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8214
8464
  </xsl:if>
@@ -9140,7 +9390,7 @@
9140
9390
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9141
9391
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9142
9392
  <!-- add &lt; and &gt; to \S -->
9143
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9393
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9144
9394
  <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>
9145
9395
  <xsl:variable name="text3">
9146
9396
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9162,7 +9412,8 @@
9162
9412
  <xsl:choose>
9163
9413
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9164
9414
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9165
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
9415
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
9416
+ <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>
9166
9417
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9167
9418
  <xsl:choose>
9168
9419
  <xsl:when test="self::text()">
@@ -9765,6 +10016,23 @@
9765
10016
  </xsl:if>
9766
10017
  </xsl:template>
9767
10018
 
10019
+ <xsl:template name="setBlockAttributes">
10020
+ <xsl:param name="text_align_default">left</xsl:param>
10021
+ <xsl:call-template name="setTextAlignment">
10022
+ <xsl:with-param name="default" select="$text_align_default"/>
10023
+ </xsl:call-template>
10024
+
10025
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10026
+ <!-- Example: keep-lines-together="true" -->
10027
+ <xsl:if test="@keep-lines-together = 'true'">
10028
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10029
+ </xsl:if>
10030
+ <!-- Example: keep-with-next="true" -->
10031
+ <xsl:if test="@keep-with-next = 'true'">
10032
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10033
+ </xsl:if>
10034
+ </xsl:template>
10035
+
9768
10036
  <xsl:template name="number-to-words">
9769
10037
  <xsl:param name="number"/>
9770
10038
  <xsl:param name="first"/>