metanorma-m3aawg 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20ccba6b8dcbacdb98acd212ad5b39fd551ea3eca04312e45b6ed1f0ca1ca756
4
- data.tar.gz: f60b3e61fe706e7d491669fc1d67c263c917b19249d9d406b9985e3ad8ffb1a4
3
+ metadata.gz: fb467d3752e66cbba06e6fca969a8ad9cad902b3d6894e42b5e08799d65e80bc
4
+ data.tar.gz: 1f2874f3b99cd421a73d33858c75f7a966a37a2316b32f8cd922cac18a855207
5
5
  SHA512:
6
- metadata.gz: d5d9c93276b937d88dcea515b646316aa6bb9556dd1f07cf9f37086e4d51745c3aa49dce7f075cdd89c5de75ce669adee1971ae4013870fb11175b791049fc99
7
- data.tar.gz: 14ab48069ae129ccbe77be12cfcb442c5cc2d211dc908163d502372cc48381fd5a14e18d8d8d3b21c6456b012c98e427a26df5ec6d39104ef1ad464982c6936a
6
+ metadata.gz: f57920c00fa68d7a4d05db36ace7aa5078b7ef72ad20d104f20475cbd477ab1537e926c0eb7e04cfdfe436f8a534996bbbe1e6ea2ab95bb2e9c1690325b0fcbb
7
+ data.tar.gz: f1584b33ec203cc1a010df63b1db34e409f0a2608111a9bc35d6228e5cf272d6785b1969b2574cdd50a6de9aedc5e021b0e48b15cab6871a1e0f93e103f347be
@@ -131,6 +131,10 @@ a.FootnoteRef + a.FootnoteRef:before {
131
131
  content: ", ";
132
132
  vertical-align: super; }
133
133
 
134
+ a.TableFootnoteRef + a.TableFootnoteRef:before {
135
+ content: ", ";
136
+ vertical-align: super; }
137
+
134
138
  .addition {
135
139
  color: blue; }
136
140
 
@@ -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>
@@ -2899,6 +2897,10 @@
2899
2897
  </xsl:choose>
2900
2898
  </xsl:variable>
2901
2899
 
2900
+ <xsl:variable name="table_fn_block">
2901
+ <xsl:call-template name="table_fn_display"/>
2902
+ </xsl:variable>
2903
+
2902
2904
  <xsl:variable name="tableWithNotesAndFootnotes">
2903
2905
 
2904
2906
  <fo:table keep-with-previous="always">
@@ -2946,11 +2948,25 @@
2946
2948
 
2947
2949
  <xsl:apply-templates select="../*[local-name()='note']"/>
2948
2950
 
2951
+ <xsl:variable name="isDisplayRowSeparator">
2952
+
2953
+ </xsl:variable>
2954
+
2949
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>
2950
2965
 
2951
2966
  <!-- fn processing -->
2952
2967
 
2953
- <xsl:call-template name="table_fn_display"/>
2968
+ <!-- <xsl:call-template name="table_fn_display" /> -->
2969
+ <xsl:copy-of select="$table_fn_block"/>
2954
2970
 
2955
2971
  <!-- for PAS display Notes after footnotes -->
2956
2972
 
@@ -3067,6 +3083,28 @@
3067
3083
  </fo:table-row>
3068
3084
  </xsl:template>
3069
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
+
3070
3108
  <!-- row in table footer (tfoot) -->
3071
3109
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3072
3110
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3395,8 +3433,16 @@
3395
3433
  <!-- figure's footnotes rendering -->
3396
3434
  <xsl:template name="fn_display_figure">
3397
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 -->
3398
3444
  <xsl:variable name="references">
3399
- <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]]">
3400
3446
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3401
3447
  <xsl:apply-templates/>
3402
3448
  </fn>
@@ -3409,91 +3455,93 @@
3409
3455
 
3410
3456
  </xsl:variable>
3411
3457
 
3412
- <!-- current hierarchy is 'figure' element -->
3413
- <xsl:variable name="following_dl_colwidths">
3414
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3415
- <xsl:variable name="simple-table">
3416
- <!-- <xsl:variable name="doc_ns">
3417
- <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>
3418
3491
  </xsl:variable>
3419
- <xsl:variable name="ns">
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>
3497
+ </xsl:variable>
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>
3420
3504
  <xsl:choose>
3421
- <xsl:when test="normalize-space($doc_ns) != ''">
3422
- <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>
3423
3511
  </xsl:when>
3424
3512
  <xsl:otherwise>
3425
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3513
+ <fo:table-column column-width="5%"/>
3514
+ <fo:table-column column-width="95%"/>
3426
3515
  </xsl:otherwise>
3427
3516
  </xsl:choose>
3428
- </xsl:variable> -->
3429
-
3430
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3431
- <tbody>
3432
- <xsl:apply-templates mode="dl"/>
3433
- </tbody>
3434
- </xsl:for-each>
3435
- </xsl:variable>
3436
-
3437
- <xsl:call-template name="calculate-column-widths">
3438
- <xsl:with-param name="cols-count" select="2"/>
3439
- <xsl:with-param name="table" select="$simple-table"/>
3440
- </xsl:call-template>
3441
-
3442
- </xsl:if>
3443
- </xsl:variable>
3444
-
3445
- <xsl:variable name="maxlength_dt">
3446
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3447
- <xsl:call-template name="getMaxLength_dt"/>
3448
- </xsl:for-each>
3449
- </xsl:variable>
3450
-
3451
- <fo:block>
3452
- <fo:table width="95%" table-layout="fixed">
3453
- <xsl:if test="normalize-space($key_iso) = 'true'">
3454
- <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'">
3455
3532
 
3456
- </xsl:if>
3457
- <xsl:choose>
3458
- <!-- if there 'dl', then set same columns width -->
3459
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3460
- <xsl:call-template name="setColumnWidth_dl">
3461
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3462
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3463
- </xsl:call-template>
3464
- </xsl:when>
3465
- <xsl:otherwise>
3466
- <fo:table-column column-width="15%"/>
3467
- <fo:table-column column-width="85%"/>
3468
- </xsl:otherwise>
3469
- </xsl:choose>
3470
- <fo:table-body>
3471
- <xsl:for-each select="xalan:nodeset($references)//fn">
3472
- <xsl:variable name="reference" select="@reference"/>
3473
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3474
- <fo:table-row>
3475
- <fo:table-cell>
3476
- <fo:block>
3477
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3478
- <xsl:value-of select="@reference"/>
3479
- </fo:inline>
3480
- </fo:block>
3481
- </fo:table-cell>
3482
- <fo:table-cell>
3483
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3484
- <xsl:if test="normalize-space($key_iso) = 'true'">
3533
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3485
3534
 
3486
- <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>
3487
3544
 
3488
- </xsl:if>
3489
- <xsl:copy-of select="./node()"/>
3490
- </fo:block>
3491
- </fo:table-cell>
3492
- </fo:table-row>
3493
- </xsl:if>
3494
- </xsl:for-each>
3495
- </fo:table-body>
3496
- </fo:table>
3497
3545
  </fo:block>
3498
3546
  </xsl:if>
3499
3547
 
@@ -3569,12 +3617,14 @@
3569
3617
 
3570
3618
  <fo:block margin-bottom="12pt" text-align="left">
3571
3619
 
3572
- <xsl:variable name="title-where">
3620
+ <!-- <xsl:variable name="title-where">
3573
3621
  <xsl:call-template name="getLocalizedString">
3574
3622
  <xsl:with-param name="key">where</xsl:with-param>
3575
3623
  </xsl:call-template>
3576
3624
  </xsl:variable>
3577
- <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>
3578
3628
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3579
3629
  <xsl:text/>
3580
3630
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3584,12 +3634,14 @@
3584
3634
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3585
3635
  <fo:block margin-bottom="12pt" text-align="left">
3586
3636
 
3587
- <xsl:variable name="title-where">
3637
+ <!-- <xsl:variable name="title-where">
3588
3638
  <xsl:call-template name="getLocalizedString">
3589
3639
  <xsl:with-param name="key">where</xsl:with-param>
3590
3640
  </xsl:call-template>
3591
3641
  </xsl:variable>
3592
- <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()"/>
3593
3645
  </fo:block>
3594
3646
  </xsl:when> <!-- END: a few components -->
3595
3647
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -3772,6 +3824,9 @@
3772
3824
 
3773
3825
  </xsl:template> <!-- END: dl -->
3774
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
+
3775
3830
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3776
3831
  <xsl:param name="process">false</xsl:param>
3777
3832
  <xsl:if test="$process = 'true'">
@@ -4604,8 +4659,8 @@
4604
4659
 
4605
4660
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
4606
4661
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4607
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
4608
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
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​')"/>
4609
4664
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4610
4665
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4611
4666
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -4616,8 +4671,19 @@
4616
4671
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4617
4672
  <!-- add zero-width space (#x200B) after character: , -->
4618
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 '/' -->
4676
+
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>
4619
4685
 
4620
- <xsl:value-of select="$text7"/>
4686
+ <xsl:value-of select="$text9"/>
4621
4687
  </xsl:template>
4622
4688
 
4623
4689
  <xsl:template name="add-zero-spaces-link-java">
@@ -4625,8 +4691,8 @@
4625
4691
 
4626
4692
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4627
4693
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4628
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4629
- <xsl:variable name="url" 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​')"/>
4630
4696
  <!-- remove zero-width space at the end -->
4631
4697
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4632
4698
  </xsl:template>
@@ -4981,9 +5047,28 @@
4981
5047
  </xsl:variable>
4982
5048
  <xsl:copy-of select="$newRow"/>
4983
5049
 
4984
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4985
- <xsl:with-param name="previousRow" select="$newRow"/>
4986
- </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>
4987
5072
  </xsl:template>
4988
5073
  <!-- End mode simple-table-rowspan -->
4989
5074
 
@@ -5146,6 +5231,27 @@
5146
5231
  </xsl:call-template>
5147
5232
  </xsl:template>
5148
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
+
5149
5255
  <xsl:template name="getFormattingTags">
5150
5256
  <tags>
5151
5257
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5487,7 +5593,7 @@
5487
5593
  </xsl:variable>
5488
5594
  <fo:inline xsl:use-attribute-sets="link-style">
5489
5595
 
5490
- <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'])">
5491
5597
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5492
5598
  </xsl:if>
5493
5599
 
@@ -5848,10 +5954,10 @@
5848
5954
  <fo:block xsl:use-attribute-sets="figure-style">
5849
5955
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5850
5956
  </fo:block>
5851
- <xsl:call-template name="fn_display_figure"/>
5852
5957
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5853
5958
  <xsl:call-template name="note"/>
5854
5959
  </xsl:for-each>
5960
+ <xsl:call-template name="fn_display_figure"/>
5855
5961
 
5856
5962
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
5857
5963
 
@@ -5914,7 +6020,13 @@
5914
6020
  </xsl:choose>
5915
6021
  </xsl:variable>
5916
6022
 
5917
- <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)"/>
5918
6030
  <xsl:if test="number($scale) &lt; 100">
5919
6031
 
5920
6032
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -6501,6 +6613,13 @@
6501
6613
  <xsl:when test="$contents_nodes/doc">
6502
6614
  <xsl:choose>
6503
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
+
6504
6623
  <xsl:for-each select="$contents_nodes/doc">
6505
6624
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6506
6625
  <xsl:if test="@bundle = 'true'">
@@ -8378,9 +8497,47 @@
8378
8497
 
8379
8498
  <fo:list-block xsl:use-attribute-sets="list-style">
8380
8499
 
8381
- <xsl:if test="local-name() = 'ol'">
8382
- <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>
8383
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>
8384
8541
 
8385
8542
  <xsl:if test="*[local-name() = 'name']">
8386
8543
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -9339,7 +9496,7 @@
9339
9496
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9340
9497
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9341
9498
  <!-- add &lt; and &gt; to \S -->
9342
- <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>
9343
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>
9344
9501
  <xsl:variable name="text3">
9345
9502
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9361,7 +9518,8 @@
9361
9518
  <xsl:choose>
9362
9519
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9363
9520
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9364
- <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>
9365
9523
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9366
9524
  <xsl:choose>
9367
9525
  <xsl:when test="self::text()">
@@ -9964,6 +10122,23 @@
9964
10122
  </xsl:if>
9965
10123
  </xsl:template>
9966
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
+
9967
10142
  <xsl:template name="number-to-words">
9968
10143
  <xsl:param name="number"/>
9969
10144
  <xsl:param name="first"/>