metanorma-iho 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12eb31ff59fda5679c4aad936fdd15576d12967a8453842c4fbf75e4c48ae18e
4
- data.tar.gz: dc8fa3b74a13882d829ab20660225e06b21537d1059df84d0e9791360ca2b311
3
+ metadata.gz: 92c16323617a6b16e621bab2d77ea28dff47d7780fcaa39abb8dbe00cd6e2024
4
+ data.tar.gz: fefa770337465aa7b2038880f289f6c890b24b636e13ef052f45b495b7e00fba
5
5
  SHA512:
6
- metadata.gz: 77d8b4f49f0cd3b15d4fb93a21192851005ddccc21bbc693dcac5835656ec7dd491b3dcd06eb48d2e769763373da56b3d0e1ac07d5d1188ec5db88f2622ba677
7
- data.tar.gz: 793feae3e390979825af2d19755b995aefc693238837a4b39182021f0e5b5d83e89acdd3302292bb69754732170575ea532971f8764b5821a40bcc1af08423d5
6
+ metadata.gz: 46219534717178e1c5285ccc34a1f848142e675a97d7b441bd809af78775f5195862c086259bcd5388580ae165f787065383000650876623e10f67bd766eea14
7
+ data.tar.gz: 7e7e93b23714967cd5064de4fb6029b6ff275c236564723ed828aaa2ea0bfc2ec79f8b90da2f03eef86fef2f6a6701f1f532e01bbe1178ffe8946b2329d56a2e
@@ -124,6 +124,10 @@ a.FootnoteRef + a.FootnoteRef:before {
124
124
  content: ", ";
125
125
  vertical-align: super; }
126
126
 
127
+ a.TableFootnoteRef + a.TableFootnoteRef:before {
128
+ content: ", ";
129
+ vertical-align: super; }
130
+
127
131
  .addition {
128
132
  color: blue; }
129
133
 
@@ -1432,7 +1432,6 @@
1432
1432
 
1433
1433
  <xsl:attribute-set name="table-header-cell-style">
1434
1434
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1435
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1436
1435
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1437
1436
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1438
1437
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1447,7 +1446,6 @@
1447
1446
 
1448
1447
  <xsl:attribute-set name="table-cell-style">
1449
1448
  <xsl:attribute name="display-align">center</xsl:attribute>
1450
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1451
1449
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1452
1450
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1453
1451
 
@@ -2205,7 +2203,7 @@
2205
2203
  <xsl:apply-templates select="." mode="contents"/>
2206
2204
  </xsl:for-each>
2207
2205
 
2208
- <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')]]">
2206
+ <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]">
2209
2207
  <xsl:sort select="@displayorder" data-type="number"/>
2210
2208
  <xsl:apply-templates select="." mode="contents"/>
2211
2209
  </xsl:for-each>
@@ -3133,6 +3131,10 @@
3133
3131
  </xsl:choose>
3134
3132
  </xsl:variable>
3135
3133
 
3134
+ <xsl:variable name="table_fn_block">
3135
+ <xsl:call-template name="table_fn_display"/>
3136
+ </xsl:variable>
3137
+
3136
3138
  <xsl:variable name="tableWithNotesAndFootnotes">
3137
3139
 
3138
3140
  <fo:table keep-with-previous="always">
@@ -3180,11 +3182,25 @@
3180
3182
 
3181
3183
  <xsl:apply-templates select="../*[local-name()='note']"/>
3182
3184
 
3185
+ <xsl:variable name="isDisplayRowSeparator">
3186
+
3187
+ </xsl:variable>
3188
+
3183
3189
  <!-- horizontal row separator -->
3190
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3191
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3192
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3193
+
3194
+ <xsl:call-template name="setBordersTableArray"/>
3195
+ <fo:block font-size="1pt"> </fo:block>
3196
+ </fo:block-container>
3197
+ </xsl:if>
3198
+ </xsl:if>
3184
3199
 
3185
3200
  <!-- fn processing -->
3186
3201
 
3187
- <xsl:call-template name="table_fn_display"/>
3202
+ <!-- <xsl:call-template name="table_fn_display" /> -->
3203
+ <xsl:copy-of select="$table_fn_block"/>
3188
3204
 
3189
3205
  <!-- for PAS display Notes after footnotes -->
3190
3206
 
@@ -3301,6 +3317,28 @@
3301
3317
  </fo:table-row>
3302
3318
  </xsl:template>
3303
3319
 
3320
+ <xsl:template name="setBorderUnderRow">
3321
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
3322
+ <xsl:choose>
3323
+ <xsl:when test="$border_under_row_ != ''">
3324
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3325
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
3326
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
3327
+ <xsl:variable name="border_under_row">
3328
+ <xsl:call-template name="split">
3329
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3330
+ </xsl:call-template>
3331
+ </xsl:variable>
3332
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3333
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3334
+ </xsl:if>
3335
+ </xsl:when>
3336
+ <xsl:otherwise>
3337
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3338
+ </xsl:otherwise>
3339
+ </xsl:choose>
3340
+ </xsl:template>
3341
+
3304
3342
  <!-- row in table footer (tfoot) -->
3305
3343
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3306
3344
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3629,8 +3667,16 @@
3629
3667
  <!-- figure's footnotes rendering -->
3630
3668
  <xsl:template name="fn_display_figure">
3631
3669
 
3670
+ <!-- current figure id -->
3671
+ <xsl:variable name="figure_id_">
3672
+ <xsl:value-of select="@id"/>
3673
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
3674
+ </xsl:variable>
3675
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
3676
+
3677
+ <!-- all footnotes relates to the current figure -->
3632
3678
  <xsl:variable name="references">
3633
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
3679
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
3634
3680
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3635
3681
  <xsl:apply-templates/>
3636
3682
  </fn>
@@ -3643,91 +3689,93 @@
3643
3689
 
3644
3690
  </xsl:variable>
3645
3691
 
3646
- <!-- current hierarchy is 'figure' element -->
3647
- <xsl:variable name="following_dl_colwidths">
3648
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3649
- <xsl:variable name="simple-table">
3650
- <!-- <xsl:variable name="doc_ns">
3651
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3692
+ <fo:block>
3693
+
3694
+ <!-- current hierarchy is 'figure' element -->
3695
+ <xsl:variable name="following_dl_colwidths">
3696
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3697
+ <xsl:variable name="simple-table">
3698
+ <!-- <xsl:variable name="doc_ns">
3699
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3700
+ </xsl:variable>
3701
+ <xsl:variable name="ns">
3702
+ <xsl:choose>
3703
+ <xsl:when test="normalize-space($doc_ns) != ''">
3704
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3705
+ </xsl:when>
3706
+ <xsl:otherwise>
3707
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3708
+ </xsl:otherwise>
3709
+ </xsl:choose>
3710
+ </xsl:variable> -->
3711
+
3712
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3713
+ <tbody>
3714
+ <xsl:apply-templates mode="dl"/>
3715
+ </tbody>
3716
+ </xsl:for-each>
3717
+ </xsl:variable>
3718
+
3719
+ <xsl:call-template name="calculate-column-widths">
3720
+ <xsl:with-param name="cols-count" select="2"/>
3721
+ <xsl:with-param name="table" select="$simple-table"/>
3722
+ </xsl:call-template>
3723
+
3724
+ </xsl:if>
3725
+ </xsl:variable>
3726
+
3727
+ <xsl:variable name="maxlength_dt">
3728
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3729
+ <xsl:call-template name="getMaxLength_dt"/>
3730
+ </xsl:for-each>
3652
3731
  </xsl:variable>
3653
- <xsl:variable name="ns">
3732
+
3733
+ <fo:table width="95%" table-layout="fixed">
3734
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3735
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3736
+
3737
+ </xsl:if>
3654
3738
  <xsl:choose>
3655
- <xsl:when test="normalize-space($doc_ns) != ''">
3656
- <xsl:value-of select="normalize-space($doc_ns)"/>
3739
+ <!-- if there 'dl', then set same columns width -->
3740
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3741
+ <xsl:call-template name="setColumnWidth_dl">
3742
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3743
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3744
+ </xsl:call-template>
3657
3745
  </xsl:when>
3658
3746
  <xsl:otherwise>
3659
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3747
+ <fo:table-column column-width="5%"/>
3748
+ <fo:table-column column-width="95%"/>
3660
3749
  </xsl:otherwise>
3661
3750
  </xsl:choose>
3662
- </xsl:variable> -->
3663
-
3664
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3665
- <tbody>
3666
- <xsl:apply-templates mode="dl"/>
3667
- </tbody>
3668
- </xsl:for-each>
3669
- </xsl:variable>
3670
-
3671
- <xsl:call-template name="calculate-column-widths">
3672
- <xsl:with-param name="cols-count" select="2"/>
3673
- <xsl:with-param name="table" select="$simple-table"/>
3674
- </xsl:call-template>
3675
-
3676
- </xsl:if>
3677
- </xsl:variable>
3678
-
3679
- <xsl:variable name="maxlength_dt">
3680
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3681
- <xsl:call-template name="getMaxLength_dt"/>
3682
- </xsl:for-each>
3683
- </xsl:variable>
3684
-
3685
- <fo:block>
3686
- <fo:table width="95%" table-layout="fixed">
3687
- <xsl:if test="normalize-space($key_iso) = 'true'">
3688
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3751
+ <fo:table-body>
3752
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3753
+ <xsl:variable name="reference" select="@reference"/>
3754
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3755
+ <fo:table-row>
3756
+ <fo:table-cell>
3757
+ <fo:block>
3758
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3759
+ <xsl:value-of select="@reference"/>
3760
+ </fo:inline>
3761
+ </fo:block>
3762
+ </fo:table-cell>
3763
+ <fo:table-cell>
3764
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3765
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3689
3766
 
3690
- </xsl:if>
3691
- <xsl:choose>
3692
- <!-- if there 'dl', then set same columns width -->
3693
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3694
- <xsl:call-template name="setColumnWidth_dl">
3695
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3696
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3697
- </xsl:call-template>
3698
- </xsl:when>
3699
- <xsl:otherwise>
3700
- <fo:table-column column-width="15%"/>
3701
- <fo:table-column column-width="85%"/>
3702
- </xsl:otherwise>
3703
- </xsl:choose>
3704
- <fo:table-body>
3705
- <xsl:for-each select="xalan:nodeset($references)//fn">
3706
- <xsl:variable name="reference" select="@reference"/>
3707
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3708
- <fo:table-row>
3709
- <fo:table-cell>
3710
- <fo:block>
3711
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3712
- <xsl:value-of select="@reference"/>
3713
- </fo:inline>
3714
- </fo:block>
3715
- </fo:table-cell>
3716
- <fo:table-cell>
3717
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3718
- <xsl:if test="normalize-space($key_iso) = 'true'">
3767
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3719
3768
 
3720
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
3769
+ </xsl:if>
3770
+ <xsl:copy-of select="./node()"/>
3771
+ </fo:block>
3772
+ </fo:table-cell>
3773
+ </fo:table-row>
3774
+ </xsl:if>
3775
+ </xsl:for-each>
3776
+ </fo:table-body>
3777
+ </fo:table>
3721
3778
 
3722
- </xsl:if>
3723
- <xsl:copy-of select="./node()"/>
3724
- </fo:block>
3725
- </fo:table-cell>
3726
- </fo:table-row>
3727
- </xsl:if>
3728
- </xsl:for-each>
3729
- </fo:table-body>
3730
- </fo:table>
3731
3779
  </fo:block>
3732
3780
  </xsl:if>
3733
3781
 
@@ -3803,12 +3851,14 @@
3803
3851
 
3804
3852
  <fo:block margin-bottom="12pt" text-align="left">
3805
3853
 
3806
- <xsl:variable name="title-where">
3854
+ <!-- <xsl:variable name="title-where">
3807
3855
  <xsl:call-template name="getLocalizedString">
3808
3856
  <xsl:with-param name="key">where</xsl:with-param>
3809
3857
  </xsl:call-template>
3810
3858
  </xsl:variable>
3811
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3859
+ <xsl:value-of select="$title-where"/> -->
3860
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3861
+ <xsl:text> </xsl:text>
3812
3862
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3813
3863
  <xsl:text/>
3814
3864
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3818,12 +3868,14 @@
3818
3868
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3819
3869
  <fo:block margin-bottom="12pt" text-align="left">
3820
3870
 
3821
- <xsl:variable name="title-where">
3871
+ <!-- <xsl:variable name="title-where">
3822
3872
  <xsl:call-template name="getLocalizedString">
3823
3873
  <xsl:with-param name="key">where</xsl:with-param>
3824
3874
  </xsl:call-template>
3825
3875
  </xsl:variable>
3826
- <xsl:value-of select="$title-where"/>
3876
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
3877
+ <!-- preceding 'p' with word 'where' -->
3878
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3827
3879
  </fo:block>
3828
3880
  </xsl:when> <!-- END: a few components -->
3829
3881
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -4012,6 +4064,9 @@
4012
4064
 
4013
4065
  </xsl:template> <!-- END: dl -->
4014
4066
 
4067
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4068
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4069
+
4015
4070
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4016
4071
  <xsl:param name="process">false</xsl:param>
4017
4072
  <xsl:if test="$process = 'true'">
@@ -4911,8 +4966,8 @@
4911
4966
 
4912
4967
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
4913
4968
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4914
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
4915
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
4969
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
4970
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
4916
4971
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4917
4972
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4918
4973
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -4923,8 +4978,19 @@
4923
4978
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4924
4979
  <!-- add zero-width space (#x200B) after character: , -->
4925
4980
  <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4981
+ <!-- add zero-width space (#x200B) after character: '/' -->
4982
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
4926
4983
 
4927
- <xsl:value-of select="$text7"/>
4984
+ <xsl:variable name="text9">
4985
+ <xsl:choose>
4986
+ <xsl:when test="$isGenerateTableIF = 'true'">
4987
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
4988
+ </xsl:when>
4989
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
4990
+ </xsl:choose>
4991
+ </xsl:variable>
4992
+
4993
+ <xsl:value-of select="$text9"/>
4928
4994
  </xsl:template>
4929
4995
 
4930
4996
  <xsl:template name="add-zero-spaces-link-java">
@@ -4932,8 +4998,8 @@
4932
4998
 
4933
4999
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4934
5000
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4935
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4936
- <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
5001
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
5002
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
4937
5003
  <!-- remove zero-width space at the end -->
4938
5004
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4939
5005
  </xsl:template>
@@ -5288,9 +5354,28 @@
5288
5354
  </xsl:variable>
5289
5355
  <xsl:copy-of select="$newRow"/>
5290
5356
 
5291
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5292
- <xsl:with-param name="previousRow" select="$newRow"/>
5293
- </xsl:apply-templates>
5357
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
5358
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
5359
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
5360
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
5361
+ <xsl:choose>
5362
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
5363
+ <xsl:copy-of select="following-sibling::tr"/>
5364
+ </xsl:when>
5365
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
5366
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
5367
+
5368
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5369
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
5370
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5371
+ </xsl:apply-templates>
5372
+ </xsl:when> -->
5373
+ <xsl:otherwise>
5374
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5375
+ <xsl:with-param name="previousRow" select="$newRow"/>
5376
+ </xsl:apply-templates>
5377
+ </xsl:otherwise>
5378
+ </xsl:choose>
5294
5379
  </xsl:template>
5295
5380
  <!-- End mode simple-table-rowspan -->
5296
5381
 
@@ -5453,6 +5538,27 @@
5453
5538
  </xsl:call-template>
5454
5539
  </xsl:template>
5455
5540
 
5541
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5542
+ <xsl:variable name="link">
5543
+ <link_updated>
5544
+ <xsl:variable name="target_text">
5545
+ <xsl:choose>
5546
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5547
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5548
+ </xsl:when>
5549
+ <xsl:otherwise>
5550
+ <xsl:value-of select="normalize-space(@target)"/>
5551
+ </xsl:otherwise>
5552
+ </xsl:choose>
5553
+ </xsl:variable>
5554
+ <xsl:value-of select="$target_text"/>
5555
+ </link_updated>
5556
+ </xsl:variable>
5557
+ <xsl:for-each select="xalan:nodeset($link)/*">
5558
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5559
+ </xsl:for-each>
5560
+ </xsl:template>
5561
+
5456
5562
  <xsl:template name="getFormattingTags">
5457
5563
  <tags>
5458
5564
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5794,7 +5900,7 @@
5794
5900
  </xsl:variable>
5795
5901
  <fo:inline xsl:use-attribute-sets="link-style">
5796
5902
 
5797
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5903
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
5798
5904
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5799
5905
  </xsl:if>
5800
5906
 
@@ -6151,10 +6257,10 @@
6151
6257
  <fo:block xsl:use-attribute-sets="figure-style">
6152
6258
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
6153
6259
  </fo:block>
6154
- <xsl:call-template name="fn_display_figure"/>
6155
6260
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
6156
6261
  <xsl:call-template name="note"/>
6157
6262
  </xsl:for-each>
6263
+ <xsl:call-template name="fn_display_figure"/>
6158
6264
 
6159
6265
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
6160
6266
 
@@ -6217,7 +6323,13 @@
6217
6323
  </xsl:choose>
6218
6324
  </xsl:variable>
6219
6325
 
6220
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6326
+ <xsl:variable name="image_width_effective">
6327
+
6328
+ <xsl:value-of select="$width_effective"/>
6329
+
6330
+ </xsl:variable>
6331
+
6332
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6221
6333
  <xsl:if test="number($scale) &lt; 100">
6222
6334
 
6223
6335
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -6804,6 +6916,13 @@
6804
6916
  <xsl:when test="$contents_nodes/doc">
6805
6917
  <xsl:choose>
6806
6918
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
6919
+
6920
+ <xsl:if test="$contents_nodes/collection">
6921
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
6922
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
6923
+ </fo:bookmark>
6924
+ </xsl:if>
6925
+
6807
6926
  <xsl:for-each select="$contents_nodes/doc">
6808
6927
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6809
6928
  <xsl:if test="@bundle = 'true'">
@@ -8677,6 +8796,44 @@
8677
8796
 
8678
8797
  <fo:list-block xsl:use-attribute-sets="list-style">
8679
8798
 
8799
+ <xsl:variable name="provisional_distance_between_starts_">
8800
+ <attributes xsl:use-attribute-sets="list-style">
8801
+
8802
+ </attributes>
8803
+ </xsl:variable>
8804
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
8805
+ <xsl:if test="$provisional_distance_between_starts != ''">
8806
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
8807
+ </xsl:if>
8808
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
8809
+
8810
+ <!-- increase provisional-distance-between-starts for long lists -->
8811
+ <xsl:if test="local-name() = 'ol'">
8812
+ <!-- Examples: xiii), xviii), xxviii) -->
8813
+ <xsl:variable name="item_numbers">
8814
+ <xsl:for-each select="*[local-name() = 'li']">
8815
+ <item><xsl:call-template name="getListItemFormat"/></item>
8816
+ </xsl:for-each>
8817
+ </xsl:variable>
8818
+
8819
+ <xsl:variable name="max_length">
8820
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
8821
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
8822
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
8823
+ </xsl:for-each>
8824
+ </xsl:variable>
8825
+
8826
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
8827
+ <xsl:variable name="addon" select="$max_length - 4"/>
8828
+ <xsl:if test="$addon &gt; 0">
8829
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
8830
+ </xsl:if>
8831
+ <!-- DEBUG -->
8832
+ <!-- <xsl:copy-of select="$item_numbers"/>
8833
+ <max_length><xsl:value-of select="$max_length"/></max_length>
8834
+ <addon><xsl:value-of select="$addon"/></addon> -->
8835
+ </xsl:if>
8836
+
8680
8837
  <xsl:if test="*[local-name() = 'name']">
8681
8838
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8682
8839
  </xsl:if>
@@ -9633,7 +9790,7 @@
9633
9790
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9634
9791
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9635
9792
  <!-- add &lt; and &gt; to \S -->
9636
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9793
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9637
9794
  <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>
9638
9795
  <xsl:variable name="text3">
9639
9796
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9655,7 +9812,8 @@
9655
9812
  <xsl:choose>
9656
9813
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9657
9814
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9658
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
9815
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
9816
+ <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>
9659
9817
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9660
9818
  <xsl:choose>
9661
9819
  <xsl:when test="self::text()">
@@ -10258,6 +10416,23 @@
10258
10416
  </xsl:if>
10259
10417
  </xsl:template>
10260
10418
 
10419
+ <xsl:template name="setBlockAttributes">
10420
+ <xsl:param name="text_align_default">left</xsl:param>
10421
+ <xsl:call-template name="setTextAlignment">
10422
+ <xsl:with-param name="default" select="$text_align_default"/>
10423
+ </xsl:call-template>
10424
+
10425
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10426
+ <!-- Example: keep-lines-together="true" -->
10427
+ <xsl:if test="@keep-lines-together = 'true'">
10428
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10429
+ </xsl:if>
10430
+ <!-- Example: keep-with-next="true" -->
10431
+ <xsl:if test="@keep-with-next = 'true'">
10432
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10433
+ </xsl:if>
10434
+ </xsl:template>
10435
+
10261
10436
  <xsl:template name="number-to-words">
10262
10437
  <xsl:param name="number"/>
10263
10438
  <xsl:param name="first"/>