metanorma-cc 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1139,7 +1139,6 @@
1139
1139
 
1140
1140
  <xsl:attribute-set name="table-header-cell-style">
1141
1141
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1142
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1143
1142
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1144
1143
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1145
1144
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1148,7 +1147,6 @@
1148
1147
 
1149
1148
  <xsl:attribute-set name="table-cell-style">
1150
1149
  <xsl:attribute name="display-align">center</xsl:attribute>
1151
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1152
1150
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1153
1151
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1154
1152
 
@@ -1867,7 +1865,7 @@
1867
1865
  <xsl:apply-templates select="." mode="contents"/>
1868
1866
  </xsl:for-each>
1869
1867
 
1870
- <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')]]">
1868
+ <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]">
1871
1869
  <xsl:sort select="@displayorder" data-type="number"/>
1872
1870
  <xsl:apply-templates select="." mode="contents"/>
1873
1871
  </xsl:for-each>
@@ -2314,7 +2312,7 @@
2314
2312
  <xsl:variable name="isDeleted" select="@deleted"/>
2315
2313
 
2316
2314
  <xsl:choose>
2317
- <xsl:when test="@width">
2315
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2318
2316
 
2319
2317
  <!-- centered table when table name is centered (see table-name-style) -->
2320
2318
 
@@ -2639,6 +2637,7 @@
2639
2637
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2640
2638
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2641
2639
  <!-- difference between the available space and the minimum table width -->
2640
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2642
2641
  <xsl:variable name="W" select="$page_width - @width_min"/>
2643
2642
  <W><xsl:value-of select="$W"/></W>
2644
2643
  <!-- difference between maximum and minimum width of the table -->
@@ -2802,6 +2801,10 @@
2802
2801
  </xsl:choose>
2803
2802
  </xsl:variable>
2804
2803
 
2804
+ <xsl:variable name="table_fn_block">
2805
+ <xsl:call-template name="table_fn_display"/>
2806
+ </xsl:variable>
2807
+
2805
2808
  <xsl:variable name="tableWithNotesAndFootnotes">
2806
2809
 
2807
2810
  <fo:table keep-with-previous="always">
@@ -2849,11 +2852,25 @@
2849
2852
 
2850
2853
  <xsl:apply-templates select="../*[local-name()='note']"/>
2851
2854
 
2855
+ <xsl:variable name="isDisplayRowSeparator">
2856
+
2857
+ </xsl:variable>
2858
+
2852
2859
  <!-- horizontal row separator -->
2860
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
2861
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
2862
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
2863
+
2864
+ <xsl:call-template name="setBordersTableArray"/>
2865
+ <fo:block font-size="1pt"> </fo:block>
2866
+ </fo:block-container>
2867
+ </xsl:if>
2868
+ </xsl:if>
2853
2869
 
2854
2870
  <!-- fn processing -->
2855
2871
 
2856
- <xsl:call-template name="table_fn_display"/>
2872
+ <!-- <xsl:call-template name="table_fn_display" /> -->
2873
+ <xsl:copy-of select="$table_fn_block"/>
2857
2874
 
2858
2875
  <!-- for PAS display Notes after footnotes -->
2859
2876
 
@@ -2970,6 +2987,28 @@
2970
2987
  </fo:table-row>
2971
2988
  </xsl:template>
2972
2989
 
2990
+ <xsl:template name="setBorderUnderRow">
2991
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
2992
+ <xsl:choose>
2993
+ <xsl:when test="$border_under_row_ != ''">
2994
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2995
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
2996
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
2997
+ <xsl:variable name="border_under_row">
2998
+ <xsl:call-template name="split">
2999
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3000
+ </xsl:call-template>
3001
+ </xsl:variable>
3002
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3003
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3004
+ </xsl:if>
3005
+ </xsl:when>
3006
+ <xsl:otherwise>
3007
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3008
+ </xsl:otherwise>
3009
+ </xsl:choose>
3010
+ </xsl:template>
3011
+
2973
3012
  <!-- row in table footer (tfoot) -->
2974
3013
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
2975
3014
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3256,17 +3295,20 @@
3256
3295
  <xsl:for-each select="xalan:nodeset($references)//fn">
3257
3296
  <xsl:variable name="reference" select="@reference"/>
3258
3297
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3259
- <fo:block xsl:use-attribute-sets="table-fn-style">
3260
3298
 
3261
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3299
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3262
3300
 
3263
- <xsl:value-of select="@reference"/>
3301
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3302
+
3303
+ <xsl:value-of select="@reference"/>
3304
+
3305
+ </fo:inline>
3306
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3307
+ <xsl:copy-of select="./node()"/>
3308
+ </fo:inline>
3309
+
3310
+ </fo:block>
3264
3311
 
3265
- </fo:inline>
3266
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3267
- <xsl:copy-of select="./node()"/>
3268
- </fo:inline>
3269
- </fo:block>
3270
3312
  </xsl:if>
3271
3313
  </xsl:for-each>
3272
3314
  </xsl:template>
@@ -3295,8 +3337,16 @@
3295
3337
  <!-- figure's footnotes rendering -->
3296
3338
  <xsl:template name="fn_display_figure">
3297
3339
 
3340
+ <!-- current figure id -->
3341
+ <xsl:variable name="figure_id_">
3342
+ <xsl:value-of select="@id"/>
3343
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
3344
+ </xsl:variable>
3345
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
3346
+
3347
+ <!-- all footnotes relates to the current figure -->
3298
3348
  <xsl:variable name="references">
3299
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
3349
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
3300
3350
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3301
3351
  <xsl:apply-templates/>
3302
3352
  </fn>
@@ -3309,91 +3359,93 @@
3309
3359
 
3310
3360
  </xsl:variable>
3311
3361
 
3312
- <!-- current hierarchy is 'figure' element -->
3313
- <xsl:variable name="following_dl_colwidths">
3314
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3315
- <xsl:variable name="simple-table">
3316
- <!-- <xsl:variable name="doc_ns">
3317
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3362
+ <fo:block>
3363
+
3364
+ <!-- current hierarchy is 'figure' element -->
3365
+ <xsl:variable name="following_dl_colwidths">
3366
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3367
+ <xsl:variable name="simple-table">
3368
+ <!-- <xsl:variable name="doc_ns">
3369
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3370
+ </xsl:variable>
3371
+ <xsl:variable name="ns">
3372
+ <xsl:choose>
3373
+ <xsl:when test="normalize-space($doc_ns) != ''">
3374
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3375
+ </xsl:when>
3376
+ <xsl:otherwise>
3377
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3378
+ </xsl:otherwise>
3379
+ </xsl:choose>
3380
+ </xsl:variable> -->
3381
+
3382
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3383
+ <tbody>
3384
+ <xsl:apply-templates mode="dl"/>
3385
+ </tbody>
3386
+ </xsl:for-each>
3387
+ </xsl:variable>
3388
+
3389
+ <xsl:call-template name="calculate-column-widths">
3390
+ <xsl:with-param name="cols-count" select="2"/>
3391
+ <xsl:with-param name="table" select="$simple-table"/>
3392
+ </xsl:call-template>
3393
+
3394
+ </xsl:if>
3395
+ </xsl:variable>
3396
+
3397
+ <xsl:variable name="maxlength_dt">
3398
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3399
+ <xsl:call-template name="getMaxLength_dt"/>
3400
+ </xsl:for-each>
3318
3401
  </xsl:variable>
3319
- <xsl:variable name="ns">
3402
+
3403
+ <fo:table width="95%" table-layout="fixed">
3404
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3405
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3406
+
3407
+ </xsl:if>
3320
3408
  <xsl:choose>
3321
- <xsl:when test="normalize-space($doc_ns) != ''">
3322
- <xsl:value-of select="normalize-space($doc_ns)"/>
3409
+ <!-- if there 'dl', then set same columns width -->
3410
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3411
+ <xsl:call-template name="setColumnWidth_dl">
3412
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3413
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3414
+ </xsl:call-template>
3323
3415
  </xsl:when>
3324
3416
  <xsl:otherwise>
3325
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3417
+ <fo:table-column column-width="5%"/>
3418
+ <fo:table-column column-width="95%"/>
3326
3419
  </xsl:otherwise>
3327
3420
  </xsl:choose>
3328
- </xsl:variable> -->
3329
-
3330
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3331
- <tbody>
3332
- <xsl:apply-templates mode="dl"/>
3333
- </tbody>
3334
- </xsl:for-each>
3335
- </xsl:variable>
3336
-
3337
- <xsl:call-template name="calculate-column-widths">
3338
- <xsl:with-param name="cols-count" select="2"/>
3339
- <xsl:with-param name="table" select="$simple-table"/>
3340
- </xsl:call-template>
3341
-
3342
- </xsl:if>
3343
- </xsl:variable>
3344
-
3345
- <xsl:variable name="maxlength_dt">
3346
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3347
- <xsl:call-template name="getMaxLength_dt"/>
3348
- </xsl:for-each>
3349
- </xsl:variable>
3421
+ <fo:table-body>
3422
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3423
+ <xsl:variable name="reference" select="@reference"/>
3424
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3425
+ <fo:table-row>
3426
+ <fo:table-cell>
3427
+ <fo:block>
3428
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3429
+ <xsl:value-of select="@reference"/>
3430
+ </fo:inline>
3431
+ </fo:block>
3432
+ </fo:table-cell>
3433
+ <fo:table-cell>
3434
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3435
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3350
3436
 
3351
- <fo:block>
3352
- <fo:table width="95%" table-layout="fixed">
3353
- <xsl:if test="normalize-space($key_iso) = 'true'">
3354
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3437
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3355
3438
 
3356
- </xsl:if>
3357
- <xsl:choose>
3358
- <!-- if there 'dl', then set same columns width -->
3359
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3360
- <xsl:call-template name="setColumnWidth_dl">
3361
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3362
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3363
- </xsl:call-template>
3364
- </xsl:when>
3365
- <xsl:otherwise>
3366
- <fo:table-column column-width="15%"/>
3367
- <fo:table-column column-width="85%"/>
3368
- </xsl:otherwise>
3369
- </xsl:choose>
3370
- <fo:table-body>
3371
- <xsl:for-each select="xalan:nodeset($references)//fn">
3372
- <xsl:variable name="reference" select="@reference"/>
3373
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3374
- <fo:table-row>
3375
- <fo:table-cell>
3376
- <fo:block>
3377
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3378
- <xsl:value-of select="@reference"/>
3379
- </fo:inline>
3380
- </fo:block>
3381
- </fo:table-cell>
3382
- <fo:table-cell>
3383
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3384
- <xsl:if test="normalize-space($key_iso) = 'true'">
3385
-
3386
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
3439
+ </xsl:if>
3440
+ <xsl:copy-of select="./node()"/>
3441
+ </fo:block>
3442
+ </fo:table-cell>
3443
+ </fo:table-row>
3444
+ </xsl:if>
3445
+ </xsl:for-each>
3446
+ </fo:table-body>
3447
+ </fo:table>
3387
3448
 
3388
- </xsl:if>
3389
- <xsl:copy-of select="./node()"/>
3390
- </fo:block>
3391
- </fo:table-cell>
3392
- </fo:table-row>
3393
- </xsl:if>
3394
- </xsl:for-each>
3395
- </fo:table-body>
3396
- </fo:table>
3397
3449
  </fo:block>
3398
3450
  </xsl:if>
3399
3451
 
@@ -3469,12 +3521,14 @@
3469
3521
 
3470
3522
  <fo:block margin-bottom="12pt" text-align="left">
3471
3523
 
3472
- <xsl:variable name="title-where">
3524
+ <!-- <xsl:variable name="title-where">
3473
3525
  <xsl:call-template name="getLocalizedString">
3474
3526
  <xsl:with-param name="key">where</xsl:with-param>
3475
3527
  </xsl:call-template>
3476
3528
  </xsl:variable>
3477
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3529
+ <xsl:value-of select="$title-where"/> -->
3530
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3531
+ <xsl:text> </xsl:text>
3478
3532
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3479
3533
  <xsl:text/>
3480
3534
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3484,12 +3538,14 @@
3484
3538
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3485
3539
  <fo:block margin-bottom="12pt" text-align="left">
3486
3540
 
3487
- <xsl:variable name="title-where">
3541
+ <!-- <xsl:variable name="title-where">
3488
3542
  <xsl:call-template name="getLocalizedString">
3489
3543
  <xsl:with-param name="key">where</xsl:with-param>
3490
3544
  </xsl:call-template>
3491
3545
  </xsl:variable>
3492
- <xsl:value-of select="$title-where"/>
3546
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
3547
+ <!-- preceding 'p' with word 'where' -->
3548
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3493
3549
  </fo:block>
3494
3550
  </xsl:when> <!-- END: a few components -->
3495
3551
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -3672,6 +3728,9 @@
3672
3728
 
3673
3729
  </xsl:template> <!-- END: dl -->
3674
3730
 
3731
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
3732
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
3733
+
3675
3734
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3676
3735
  <xsl:param name="process">false</xsl:param>
3677
3736
  <xsl:if test="$process = 'true'">
@@ -4205,12 +4264,12 @@
4205
4264
  <xsl:param name="value"/>
4206
4265
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4207
4266
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4208
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4209
- <xsl:attribute name="height">5mm</xsl:attribute>
4267
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4268
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4210
4269
  <xsl:attribute name="content-width">100%</xsl:attribute>
4211
4270
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4212
4271
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4213
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4272
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4214
4273
  <g>
4215
4274
  <xsl:if test="$type = 'closing' or $type = 'end'">
4216
4275
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4224,6 +4283,27 @@
4224
4283
  </xsl:if>
4225
4284
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4226
4285
  </text>
4286
+ </svg> -->
4287
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4288
+ <g>
4289
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4290
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4291
+ </xsl:if>
4292
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4293
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4294
+ </g>
4295
+ <xsl:variable name="text_x">
4296
+ <xsl:choose>
4297
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4298
+ <xsl:otherwise>22</xsl:otherwise>
4299
+ </xsl:choose>
4300
+ </xsl:variable>
4301
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4302
+ <xsl:value-of select="$kind"/>
4303
+ </text>
4304
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4305
+ <xsl:value-of select="$value"/>
4306
+ </text>
4227
4307
  </svg>
4228
4308
  </fo:instream-foreign-object>
4229
4309
  </xsl:template>
@@ -4478,18 +4558,34 @@
4478
4558
 
4479
4559
  <xsl:template name="add-zero-spaces-java">
4480
4560
  <xsl:param name="text" select="."/>
4481
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4482
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4561
+
4562
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
4563
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4564
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
4565
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
4566
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4567
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4483
4568
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4484
- <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' -->
4569
+ <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' -->
4485
4570
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4486
- <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' -->
4571
+ <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' -->
4487
4572
  <!-- add zero-width space (#x200B) before character: { -->
4488
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4573
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4489
4574
  <!-- add zero-width space (#x200B) after character: , -->
4490
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4575
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4576
+ <!-- add zero-width space (#x200B) after character: '/' -->
4577
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
4491
4578
 
4492
- <xsl:value-of select="$text5"/>
4579
+ <xsl:variable name="text9">
4580
+ <xsl:choose>
4581
+ <xsl:when test="$isGenerateTableIF = 'true'">
4582
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
4583
+ </xsl:when>
4584
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
4585
+ </xsl:choose>
4586
+ </xsl:variable>
4587
+
4588
+ <xsl:value-of select="$text9"/>
4493
4589
  </xsl:template>
4494
4590
 
4495
4591
  <xsl:template name="add-zero-spaces-link-java">
@@ -4497,8 +4593,10 @@
4497
4593
 
4498
4594
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4499
4595
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4500
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4501
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4596
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
4597
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
4598
+ <!-- remove zero-width space at the end -->
4599
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4502
4600
  </xsl:template>
4503
4601
 
4504
4602
  <!-- add zero space after dash character (for table's entries) -->
@@ -4635,7 +4733,7 @@
4635
4733
  </xsl:copy>
4636
4734
  </xsl:template>
4637
4735
 
4638
- <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">
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']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
4639
4737
  <xsl:copy>
4640
4738
  <xsl:copy-of select="@*"/>
4641
4739
  <p>
@@ -4711,6 +4809,14 @@
4711
4809
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4712
4810
  </xsl:template>
4713
4811
 
4812
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
4813
+ <xsl:apply-templates mode="table-without-br"/>
4814
+ </xsl:template>
4815
+
4816
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
4817
+ <xsl:apply-templates mode="table-without-br"/>
4818
+ </xsl:template>
4819
+
4714
4820
  <!-- mode="table-without-br" -->
4715
4821
  <!-- ================================== -->
4716
4822
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -4843,9 +4949,28 @@
4843
4949
  </xsl:variable>
4844
4950
  <xsl:copy-of select="$newRow"/>
4845
4951
 
4846
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4847
- <xsl:with-param name="previousRow" select="$newRow"/>
4848
- </xsl:apply-templates>
4952
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
4953
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
4954
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
4955
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
4956
+ <xsl:choose>
4957
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
4958
+ <xsl:copy-of select="following-sibling::tr"/>
4959
+ </xsl:when>
4960
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
4961
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
4962
+
4963
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
4964
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
4965
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
4966
+ </xsl:apply-templates>
4967
+ </xsl:when> -->
4968
+ <xsl:otherwise>
4969
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4970
+ <xsl:with-param name="previousRow" select="$newRow"/>
4971
+ </xsl:apply-templates>
4972
+ </xsl:otherwise>
4973
+ </xsl:choose>
4849
4974
  </xsl:template>
4850
4975
  <!-- End mode simple-table-rowspan -->
4851
4976
 
@@ -5008,6 +5133,27 @@
5008
5133
  </xsl:call-template>
5009
5134
  </xsl:template>
5010
5135
 
5136
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5137
+ <xsl:variable name="link">
5138
+ <link_updated>
5139
+ <xsl:variable name="target_text">
5140
+ <xsl:choose>
5141
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5142
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5143
+ </xsl:when>
5144
+ <xsl:otherwise>
5145
+ <xsl:value-of select="normalize-space(@target)"/>
5146
+ </xsl:otherwise>
5147
+ </xsl:choose>
5148
+ </xsl:variable>
5149
+ <xsl:value-of select="$target_text"/>
5150
+ </link_updated>
5151
+ </xsl:variable>
5152
+ <xsl:for-each select="xalan:nodeset($link)/*">
5153
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5154
+ </xsl:for-each>
5155
+ </xsl:template>
5156
+
5011
5157
  <xsl:template name="getFormattingTags">
5012
5158
  <tags>
5013
5159
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5349,7 +5495,7 @@
5349
5495
  </xsl:variable>
5350
5496
  <fo:inline xsl:use-attribute-sets="link-style">
5351
5497
 
5352
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5498
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
5353
5499
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5354
5500
  </xsl:if>
5355
5501
 
@@ -5524,7 +5670,7 @@
5524
5670
 
5525
5671
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5526
5672
 
5527
- <fo:block-container margin-left="0mm">
5673
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5528
5674
 
5529
5675
  <fo:block>
5530
5676
 
@@ -5698,13 +5844,16 @@
5698
5844
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5699
5845
  </xsl:call-template>
5700
5846
 
5847
+ <!-- Example: Dimensions in millimeters -->
5848
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5849
+
5701
5850
  <fo:block xsl:use-attribute-sets="figure-style">
5702
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5851
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5703
5852
  </fo:block>
5704
- <xsl:call-template name="fn_display_figure"/>
5705
- <xsl:for-each select="*[local-name() = 'note']">
5853
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5706
5854
  <xsl:call-template name="note"/>
5707
5855
  </xsl:for-each>
5856
+ <xsl:call-template name="fn_display_figure"/>
5708
5857
 
5709
5858
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
5710
5859
 
@@ -5767,7 +5916,13 @@
5767
5916
  </xsl:choose>
5768
5917
  </xsl:variable>
5769
5918
 
5770
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5919
+ <xsl:variable name="image_width_effective">
5920
+
5921
+ <xsl:value-of select="$width_effective"/>
5922
+
5923
+ </xsl:variable>
5924
+
5925
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
5771
5926
  <xsl:if test="number($scale) &lt; 100">
5772
5927
 
5773
5928
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -5959,24 +6114,47 @@
5959
6114
 
5960
6115
  </xsl:when>
5961
6116
  <xsl:otherwise>
5962
- <fo:block xsl:use-attribute-sets="image-style">
5963
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5964
- <xsl:attribute name="width">100%</xsl:attribute>
5965
- <xsl:attribute name="content-height">100%</xsl:attribute>
5966
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5967
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
5968
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
5969
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5970
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5971
- <!-- effective height / width = 1.48, 1.4 - with title -->
5972
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
5973
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
5974
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5975
- </xsl:if>
5976
- <xsl:attribute name="scaling">uniform</xsl:attribute>
5977
- <xsl:copy-of select="$svg_content"/>
5978
- </fo:instream-foreign-object>
5979
- </fo:block>
6117
+
6118
+ <xsl:variable name="element">
6119
+ <xsl:choose>
6120
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6121
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6122
+ </xsl:when>
6123
+ <xsl:otherwise>
6124
+ <fo:block xsl:use-attribute-sets="image-style">
6125
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6126
+ <xsl:attribute name="text-align">left</xsl:attribute>
6127
+ </xsl:if>
6128
+ </fo:block>
6129
+ </xsl:otherwise>
6130
+ </xsl:choose>
6131
+ </xsl:variable>
6132
+
6133
+ <xsl:for-each select="xalan:nodeset($element)/*">
6134
+ <xsl:copy>
6135
+ <xsl:copy-of select="@*"/>
6136
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6137
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6138
+ <xsl:if test="$isGenerateTableIF = 'false'">
6139
+ <xsl:attribute name="width">100%</xsl:attribute>
6140
+ </xsl:if>
6141
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6142
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6143
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6144
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6145
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6146
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6147
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6148
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6149
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6150
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6151
+ </xsl:if>
6152
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6153
+ <xsl:copy-of select="$svg_content"/>
6154
+ </fo:instream-foreign-object>
6155
+ <!-- </fo:block> -->
6156
+ </xsl:copy>
6157
+ </xsl:for-each>
5980
6158
  </xsl:otherwise>
5981
6159
  </xsl:choose>
5982
6160
  </xsl:template>
@@ -6068,6 +6246,13 @@
6068
6246
  </xsl:for-each>
6069
6247
  </xsl:template>
6070
6248
 
6249
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6250
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6251
+ <xsl:for-each select="*[local-name() = 'svg']">
6252
+ <xsl:call-template name="image_svg"/>
6253
+ </xsl:for-each>
6254
+ </xsl:template>
6255
+
6071
6256
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6072
6257
  <xsl:variable name="svg_content" select="document(@src)"/>
6073
6258
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6206,6 +6391,8 @@
6206
6391
  <xsl:value-of select="."/>
6207
6392
  </xsl:template>
6208
6393
 
6394
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6395
+
6209
6396
  <xsl:template match="node()" mode="contents">
6210
6397
  <xsl:apply-templates mode="contents"/>
6211
6398
  </xsl:template>
@@ -6322,6 +6509,13 @@
6322
6509
  <xsl:when test="$contents_nodes/doc">
6323
6510
  <xsl:choose>
6324
6511
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
6512
+
6513
+ <xsl:if test="$contents_nodes/collection">
6514
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
6515
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
6516
+ </fo:bookmark>
6517
+ </xsl:if>
6518
+
6325
6519
  <xsl:for-each select="$contents_nodes/doc">
6326
6520
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6327
6521
  <xsl:if test="@bundle = 'true'">
@@ -6513,7 +6707,15 @@
6513
6707
  <xsl:value-of select="@section"/>
6514
6708
  <xsl:text> </xsl:text>
6515
6709
  </xsl:if>
6516
- <xsl:value-of select="normalize-space(title)"/>
6710
+ <xsl:variable name="title">
6711
+ <xsl:for-each select="title/node()">
6712
+ <xsl:choose>
6713
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6714
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6715
+ </xsl:choose>
6716
+ </xsl:for-each>
6717
+ </xsl:variable>
6718
+ <xsl:value-of select="normalize-space($title)"/>
6517
6719
  </fo:bookmark-title>
6518
6720
  <xsl:apply-templates mode="bookmark"/>
6519
6721
  </fo:bookmark>
@@ -6539,6 +6741,12 @@
6539
6741
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6540
6742
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6541
6743
 
6744
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6745
+ <fo:block text-align="right" keep-with-next="always">
6746
+ <xsl:apply-templates/>
6747
+ </fo:block>
6748
+ </xsl:template>
6749
+
6542
6750
  <!-- ====== -->
6543
6751
  <!-- ====== -->
6544
6752
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6688,6 +6896,10 @@
6688
6896
  </xsl:for-each>
6689
6897
  </xsl:template>
6690
6898
 
6899
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
6900
+ <xsl:value-of select="."/>
6901
+ </xsl:template>
6902
+
6691
6903
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6692
6904
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6693
6905
  <xsl:apply-templates mode="contents_item"/>
@@ -8186,6 +8398,44 @@
8186
8398
 
8187
8399
  <fo:list-block xsl:use-attribute-sets="list-style">
8188
8400
 
8401
+ <xsl:variable name="provisional_distance_between_starts_">
8402
+ <attributes xsl:use-attribute-sets="list-style">
8403
+
8404
+ </attributes>
8405
+ </xsl:variable>
8406
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
8407
+ <xsl:if test="$provisional_distance_between_starts != ''">
8408
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
8409
+ </xsl:if>
8410
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
8411
+
8412
+ <!-- increase provisional-distance-between-starts for long lists -->
8413
+ <xsl:if test="local-name() = 'ol'">
8414
+ <!-- Examples: xiii), xviii), xxviii) -->
8415
+ <xsl:variable name="item_numbers">
8416
+ <xsl:for-each select="*[local-name() = 'li']">
8417
+ <item><xsl:call-template name="getListItemFormat"/></item>
8418
+ </xsl:for-each>
8419
+ </xsl:variable>
8420
+
8421
+ <xsl:variable name="max_length">
8422
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
8423
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
8424
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
8425
+ </xsl:for-each>
8426
+ </xsl:variable>
8427
+
8428
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
8429
+ <xsl:variable name="addon" select="$max_length - 4"/>
8430
+ <xsl:if test="$addon &gt; 0">
8431
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
8432
+ </xsl:if>
8433
+ <!-- DEBUG -->
8434
+ <!-- <xsl:copy-of select="$item_numbers"/>
8435
+ <max_length><xsl:value-of select="$max_length"/></max_length>
8436
+ <addon><xsl:value-of select="$addon"/></addon> -->
8437
+ </xsl:if>
8438
+
8189
8439
  <xsl:if test="ancestor::csd:ol">
8190
8440
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8191
8441
  </xsl:if>
@@ -8916,7 +9166,6 @@
8916
9166
  <xsl:if test="@type = 'editorial'">
8917
9167
  <xsl:attribute name="color">green</xsl:attribute>
8918
9168
  <xsl:attribute name="font-weight">normal</xsl:attribute>
8919
-
8920
9169
  <!-- <xsl:variable name="note-style">
8921
9170
  <style xsl:use-attribute-sets="note-style"></style>
8922
9171
  </xsl:variable>
@@ -9148,7 +9397,7 @@
9148
9397
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9149
9398
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9150
9399
  <!-- add &lt; and &gt; to \S -->
9151
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9400
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9152
9401
  <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>
9153
9402
  <xsl:variable name="text3">
9154
9403
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9170,7 +9419,8 @@
9170
9419
  <xsl:choose>
9171
9420
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9172
9421
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9173
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
9422
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
9423
+ <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>
9174
9424
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9175
9425
  <xsl:choose>
9176
9426
  <xsl:when test="self::text()">
@@ -9773,6 +10023,23 @@
9773
10023
  </xsl:if>
9774
10024
  </xsl:template>
9775
10025
 
10026
+ <xsl:template name="setBlockAttributes">
10027
+ <xsl:param name="text_align_default">left</xsl:param>
10028
+ <xsl:call-template name="setTextAlignment">
10029
+ <xsl:with-param name="default" select="$text_align_default"/>
10030
+ </xsl:call-template>
10031
+
10032
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10033
+ <!-- Example: keep-lines-together="true" -->
10034
+ <xsl:if test="@keep-lines-together = 'true'">
10035
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10036
+ </xsl:if>
10037
+ <!-- Example: keep-with-next="true" -->
10038
+ <xsl:if test="@keep-with-next = 'true'">
10039
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10040
+ </xsl:if>
10041
+ </xsl:template>
10042
+
9776
10043
  <xsl:template name="number-to-words">
9777
10044
  <xsl:param name="number"/>
9778
10045
  <xsl:param name="first"/>