metanorma-ogc 2.3.4 → 2.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1272,7 +1272,6 @@
1272
1272
 
1273
1273
  <xsl:attribute-set name="table-header-cell-style">
1274
1274
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1275
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1276
1275
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1277
1276
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1278
1277
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1287,7 +1286,6 @@
1287
1286
 
1288
1287
  <xsl:attribute-set name="table-cell-style">
1289
1288
  <xsl:attribute name="display-align">center</xsl:attribute>
1290
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1291
1289
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1292
1290
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1293
1291
 
@@ -2062,7 +2060,7 @@
2062
2060
  <xsl:apply-templates select="." mode="contents"/>
2063
2061
  </xsl:for-each>
2064
2062
 
2065
- <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')]]">
2063
+ <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]">
2066
2064
  <xsl:sort select="@displayorder" data-type="number"/>
2067
2065
  <xsl:apply-templates select="." mode="contents"/>
2068
2066
  </xsl:for-each>
@@ -3027,6 +3025,10 @@
3027
3025
  </xsl:choose>
3028
3026
  </xsl:variable>
3029
3027
 
3028
+ <xsl:variable name="table_fn_block">
3029
+ <xsl:call-template name="table_fn_display"/>
3030
+ </xsl:variable>
3031
+
3030
3032
  <xsl:variable name="tableWithNotesAndFootnotes">
3031
3033
 
3032
3034
  <fo:table keep-with-previous="always">
@@ -3074,11 +3076,25 @@
3074
3076
 
3075
3077
  <xsl:apply-templates select="../*[local-name()='note']"/>
3076
3078
 
3079
+ <xsl:variable name="isDisplayRowSeparator">
3080
+
3081
+ </xsl:variable>
3082
+
3077
3083
  <!-- horizontal row separator -->
3084
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3085
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3086
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3087
+
3088
+ <xsl:call-template name="setBordersTableArray"/>
3089
+ <fo:block font-size="1pt"> </fo:block>
3090
+ </fo:block-container>
3091
+ </xsl:if>
3092
+ </xsl:if>
3078
3093
 
3079
3094
  <!-- fn processing -->
3080
3095
 
3081
- <xsl:call-template name="table_fn_display"/>
3096
+ <!-- <xsl:call-template name="table_fn_display" /> -->
3097
+ <xsl:copy-of select="$table_fn_block"/>
3082
3098
 
3083
3099
  <!-- for PAS display Notes after footnotes -->
3084
3100
 
@@ -3195,6 +3211,28 @@
3195
3211
  </fo:table-row>
3196
3212
  </xsl:template>
3197
3213
 
3214
+ <xsl:template name="setBorderUnderRow">
3215
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
3216
+ <xsl:choose>
3217
+ <xsl:when test="$border_under_row_ != ''">
3218
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3219
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
3220
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
3221
+ <xsl:variable name="border_under_row">
3222
+ <xsl:call-template name="split">
3223
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3224
+ </xsl:call-template>
3225
+ </xsl:variable>
3226
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3227
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3228
+ </xsl:if>
3229
+ </xsl:when>
3230
+ <xsl:otherwise>
3231
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3232
+ </xsl:otherwise>
3233
+ </xsl:choose>
3234
+ </xsl:template>
3235
+
3198
3236
  <!-- row in table footer (tfoot) -->
3199
3237
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3200
3238
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3529,8 +3567,16 @@
3529
3567
  <!-- figure's footnotes rendering -->
3530
3568
  <xsl:template name="fn_display_figure">
3531
3569
 
3570
+ <!-- current figure id -->
3571
+ <xsl:variable name="figure_id_">
3572
+ <xsl:value-of select="@id"/>
3573
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
3574
+ </xsl:variable>
3575
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
3576
+
3577
+ <!-- all footnotes relates to the current figure -->
3532
3578
  <xsl:variable name="references">
3533
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
3579
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
3534
3580
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3535
3581
  <xsl:apply-templates/>
3536
3582
  </fn>
@@ -3543,91 +3589,93 @@
3543
3589
 
3544
3590
  </xsl:variable>
3545
3591
 
3546
- <!-- current hierarchy is 'figure' element -->
3547
- <xsl:variable name="following_dl_colwidths">
3548
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3549
- <xsl:variable name="simple-table">
3550
- <!-- <xsl:variable name="doc_ns">
3551
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3592
+ <fo:block>
3593
+
3594
+ <!-- current hierarchy is 'figure' element -->
3595
+ <xsl:variable name="following_dl_colwidths">
3596
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3597
+ <xsl:variable name="simple-table">
3598
+ <!-- <xsl:variable name="doc_ns">
3599
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
3600
+ </xsl:variable>
3601
+ <xsl:variable name="ns">
3602
+ <xsl:choose>
3603
+ <xsl:when test="normalize-space($doc_ns) != ''">
3604
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3605
+ </xsl:when>
3606
+ <xsl:otherwise>
3607
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3608
+ </xsl:otherwise>
3609
+ </xsl:choose>
3610
+ </xsl:variable> -->
3611
+
3612
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3613
+ <tbody>
3614
+ <xsl:apply-templates mode="dl"/>
3615
+ </tbody>
3616
+ </xsl:for-each>
3617
+ </xsl:variable>
3618
+
3619
+ <xsl:call-template name="calculate-column-widths">
3620
+ <xsl:with-param name="cols-count" select="2"/>
3621
+ <xsl:with-param name="table" select="$simple-table"/>
3622
+ </xsl:call-template>
3623
+
3624
+ </xsl:if>
3552
3625
  </xsl:variable>
3553
- <xsl:variable name="ns">
3626
+
3627
+ <xsl:variable name="maxlength_dt">
3628
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3629
+ <xsl:call-template name="getMaxLength_dt"/>
3630
+ </xsl:for-each>
3631
+ </xsl:variable>
3632
+
3633
+ <fo:table width="95%" table-layout="fixed">
3634
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3635
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3636
+
3637
+ </xsl:if>
3554
3638
  <xsl:choose>
3555
- <xsl:when test="normalize-space($doc_ns) != ''">
3556
- <xsl:value-of select="normalize-space($doc_ns)"/>
3639
+ <!-- if there 'dl', then set same columns width -->
3640
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3641
+ <xsl:call-template name="setColumnWidth_dl">
3642
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3643
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3644
+ </xsl:call-template>
3557
3645
  </xsl:when>
3558
3646
  <xsl:otherwise>
3559
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3647
+ <fo:table-column column-width="5%"/>
3648
+ <fo:table-column column-width="95%"/>
3560
3649
  </xsl:otherwise>
3561
3650
  </xsl:choose>
3562
- </xsl:variable> -->
3563
-
3564
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3565
- <tbody>
3566
- <xsl:apply-templates mode="dl"/>
3567
- </tbody>
3568
- </xsl:for-each>
3569
- </xsl:variable>
3570
-
3571
- <xsl:call-template name="calculate-column-widths">
3572
- <xsl:with-param name="cols-count" select="2"/>
3573
- <xsl:with-param name="table" select="$simple-table"/>
3574
- </xsl:call-template>
3575
-
3576
- </xsl:if>
3577
- </xsl:variable>
3578
-
3579
- <xsl:variable name="maxlength_dt">
3580
- <xsl:for-each select="*[local-name() = 'dl'][1]">
3581
- <xsl:call-template name="getMaxLength_dt"/>
3582
- </xsl:for-each>
3583
- </xsl:variable>
3651
+ <fo:table-body>
3652
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3653
+ <xsl:variable name="reference" select="@reference"/>
3654
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3655
+ <fo:table-row>
3656
+ <fo:table-cell>
3657
+ <fo:block>
3658
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3659
+ <xsl:value-of select="@reference"/>
3660
+ </fo:inline>
3661
+ </fo:block>
3662
+ </fo:table-cell>
3663
+ <fo:table-cell>
3664
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3665
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3584
3666
 
3585
- <fo:block>
3586
- <fo:table width="95%" table-layout="fixed">
3587
- <xsl:if test="normalize-space($key_iso) = 'true'">
3588
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3667
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
3589
3668
 
3590
- </xsl:if>
3591
- <xsl:choose>
3592
- <!-- if there 'dl', then set same columns width -->
3593
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3594
- <xsl:call-template name="setColumnWidth_dl">
3595
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3596
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3597
- </xsl:call-template>
3598
- </xsl:when>
3599
- <xsl:otherwise>
3600
- <fo:table-column column-width="15%"/>
3601
- <fo:table-column column-width="85%"/>
3602
- </xsl:otherwise>
3603
- </xsl:choose>
3604
- <fo:table-body>
3605
- <xsl:for-each select="xalan:nodeset($references)//fn">
3606
- <xsl:variable name="reference" select="@reference"/>
3607
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3608
- <fo:table-row>
3609
- <fo:table-cell>
3610
- <fo:block>
3611
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
3612
- <xsl:value-of select="@reference"/>
3613
- </fo:inline>
3614
- </fo:block>
3615
- </fo:table-cell>
3616
- <fo:table-cell>
3617
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
3618
- <xsl:if test="normalize-space($key_iso) = 'true'">
3619
-
3620
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
3669
+ </xsl:if>
3670
+ <xsl:copy-of select="./node()"/>
3671
+ </fo:block>
3672
+ </fo:table-cell>
3673
+ </fo:table-row>
3674
+ </xsl:if>
3675
+ </xsl:for-each>
3676
+ </fo:table-body>
3677
+ </fo:table>
3621
3678
 
3622
- </xsl:if>
3623
- <xsl:copy-of select="./node()"/>
3624
- </fo:block>
3625
- </fo:table-cell>
3626
- </fo:table-row>
3627
- </xsl:if>
3628
- </xsl:for-each>
3629
- </fo:table-body>
3630
- </fo:table>
3631
3679
  </fo:block>
3632
3680
  </xsl:if>
3633
3681
 
@@ -3708,12 +3756,14 @@
3708
3756
 
3709
3757
  <fo:block margin-bottom="12pt" text-align="left">
3710
3758
 
3711
- <xsl:variable name="title-where">
3759
+ <!-- <xsl:variable name="title-where">
3712
3760
  <xsl:call-template name="getLocalizedString">
3713
3761
  <xsl:with-param name="key">where</xsl:with-param>
3714
3762
  </xsl:call-template>
3715
3763
  </xsl:variable>
3716
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3764
+ <xsl:value-of select="$title-where"/> -->
3765
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3766
+ <xsl:text> </xsl:text>
3717
3767
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3718
3768
  <xsl:text/>
3719
3769
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3723,12 +3773,14 @@
3723
3773
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3724
3774
  <fo:block margin-bottom="12pt" text-align="left">
3725
3775
 
3726
- <xsl:variable name="title-where">
3776
+ <!-- <xsl:variable name="title-where">
3727
3777
  <xsl:call-template name="getLocalizedString">
3728
3778
  <xsl:with-param name="key">where</xsl:with-param>
3729
3779
  </xsl:call-template>
3730
3780
  </xsl:variable>
3731
- <xsl:value-of select="$title-where"/>
3781
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
3782
+ <!-- preceding 'p' with word 'where' -->
3783
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3732
3784
  </fo:block>
3733
3785
  </xsl:when> <!-- END: a few components -->
3734
3786
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -3911,6 +3963,9 @@
3911
3963
 
3912
3964
  </xsl:template> <!-- END: dl -->
3913
3965
 
3966
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
3967
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
3968
+
3914
3969
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3915
3970
  <xsl:param name="process">false</xsl:param>
3916
3971
  <xsl:if test="$process = 'true'">
@@ -4743,8 +4798,8 @@
4743
4798
 
4744
4799
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
4745
4800
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4746
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
4747
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
4801
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
4802
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
4748
4803
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4749
4804
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4750
4805
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -4755,8 +4810,19 @@
4755
4810
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4756
4811
  <!-- add zero-width space (#x200B) after character: , -->
4757
4812
  <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4813
+ <!-- add zero-width space (#x200B) after character: '/' -->
4814
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
4815
+
4816
+ <xsl:variable name="text9">
4817
+ <xsl:choose>
4818
+ <xsl:when test="$isGenerateTableIF = 'true'">
4819
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
4820
+ </xsl:when>
4821
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
4822
+ </xsl:choose>
4823
+ </xsl:variable>
4758
4824
 
4759
- <xsl:value-of select="$text7"/>
4825
+ <xsl:value-of select="$text9"/>
4760
4826
  </xsl:template>
4761
4827
 
4762
4828
  <xsl:template name="add-zero-spaces-link-java">
@@ -4764,8 +4830,8 @@
4764
4830
 
4765
4831
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4766
4832
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4767
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4768
- <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4833
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
4834
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
4769
4835
  <!-- remove zero-width space at the end -->
4770
4836
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4771
4837
  </xsl:template>
@@ -5120,9 +5186,28 @@
5120
5186
  </xsl:variable>
5121
5187
  <xsl:copy-of select="$newRow"/>
5122
5188
 
5123
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5124
- <xsl:with-param name="previousRow" select="$newRow"/>
5125
- </xsl:apply-templates>
5189
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
5190
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
5191
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
5192
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
5193
+ <xsl:choose>
5194
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
5195
+ <xsl:copy-of select="following-sibling::tr"/>
5196
+ </xsl:when>
5197
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
5198
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
5199
+
5200
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5201
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
5202
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5203
+ </xsl:apply-templates>
5204
+ </xsl:when> -->
5205
+ <xsl:otherwise>
5206
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5207
+ <xsl:with-param name="previousRow" select="$newRow"/>
5208
+ </xsl:apply-templates>
5209
+ </xsl:otherwise>
5210
+ </xsl:choose>
5126
5211
  </xsl:template>
5127
5212
  <!-- End mode simple-table-rowspan -->
5128
5213
 
@@ -5285,6 +5370,27 @@
5285
5370
  </xsl:call-template>
5286
5371
  </xsl:template>
5287
5372
 
5373
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5374
+ <xsl:variable name="link">
5375
+ <link_updated>
5376
+ <xsl:variable name="target_text">
5377
+ <xsl:choose>
5378
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5379
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5380
+ </xsl:when>
5381
+ <xsl:otherwise>
5382
+ <xsl:value-of select="normalize-space(@target)"/>
5383
+ </xsl:otherwise>
5384
+ </xsl:choose>
5385
+ </xsl:variable>
5386
+ <xsl:value-of select="$target_text"/>
5387
+ </link_updated>
5388
+ </xsl:variable>
5389
+ <xsl:for-each select="xalan:nodeset($link)/*">
5390
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5391
+ </xsl:for-each>
5392
+ </xsl:template>
5393
+
5288
5394
  <xsl:template name="getFormattingTags">
5289
5395
  <tags>
5290
5396
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -5626,7 +5732,7 @@
5626
5732
  </xsl:variable>
5627
5733
  <fo:inline xsl:use-attribute-sets="link-style">
5628
5734
 
5629
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
5735
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
5630
5736
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5631
5737
  </xsl:if>
5632
5738
 
@@ -5987,10 +6093,10 @@
5987
6093
  <fo:block xsl:use-attribute-sets="figure-style">
5988
6094
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5989
6095
  </fo:block>
5990
- <xsl:call-template name="fn_display_figure"/>
5991
6096
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5992
6097
  <xsl:call-template name="note"/>
5993
6098
  </xsl:for-each>
6099
+ <xsl:call-template name="fn_display_figure"/>
5994
6100
 
5995
6101
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
5996
6102
 
@@ -6053,7 +6159,13 @@
6053
6159
  </xsl:choose>
6054
6160
  </xsl:variable>
6055
6161
 
6056
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6162
+ <xsl:variable name="image_width_effective">
6163
+
6164
+ <xsl:value-of select="$width_effective"/>
6165
+
6166
+ </xsl:variable>
6167
+
6168
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6057
6169
  <xsl:if test="number($scale) &lt; 100">
6058
6170
 
6059
6171
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -6640,6 +6752,13 @@
6640
6752
  <xsl:when test="$contents_nodes/doc">
6641
6753
  <xsl:choose>
6642
6754
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
6755
+
6756
+ <xsl:if test="$contents_nodes/collection">
6757
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
6758
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
6759
+ </fo:bookmark>
6760
+ </xsl:if>
6761
+
6643
6762
  <xsl:for-each select="$contents_nodes/doc">
6644
6763
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6645
6764
  <xsl:if test="@bundle = 'true'">
@@ -8545,6 +8664,44 @@
8545
8664
 
8546
8665
  <fo:list-block xsl:use-attribute-sets="list-style">
8547
8666
 
8667
+ <xsl:variable name="provisional_distance_between_starts_">
8668
+ <attributes xsl:use-attribute-sets="list-style">
8669
+
8670
+ </attributes>
8671
+ </xsl:variable>
8672
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
8673
+ <xsl:if test="$provisional_distance_between_starts != ''">
8674
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
8675
+ </xsl:if>
8676
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
8677
+
8678
+ <!-- increase provisional-distance-between-starts for long lists -->
8679
+ <xsl:if test="local-name() = 'ol'">
8680
+ <!-- Examples: xiii), xviii), xxviii) -->
8681
+ <xsl:variable name="item_numbers">
8682
+ <xsl:for-each select="*[local-name() = 'li']">
8683
+ <item><xsl:call-template name="getListItemFormat"/></item>
8684
+ </xsl:for-each>
8685
+ </xsl:variable>
8686
+
8687
+ <xsl:variable name="max_length">
8688
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
8689
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
8690
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
8691
+ </xsl:for-each>
8692
+ </xsl:variable>
8693
+
8694
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
8695
+ <xsl:variable name="addon" select="$max_length - 4"/>
8696
+ <xsl:if test="$addon &gt; 0">
8697
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
8698
+ </xsl:if>
8699
+ <!-- DEBUG -->
8700
+ <!-- <xsl:copy-of select="$item_numbers"/>
8701
+ <max_length><xsl:value-of select="$max_length"/></max_length>
8702
+ <addon><xsl:value-of select="$addon"/></addon> -->
8703
+ </xsl:if>
8704
+
8548
8705
  <xsl:if test="*[local-name() = 'name']">
8549
8706
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8550
8707
  </xsl:if>
@@ -9498,7 +9655,7 @@
9498
9655
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9499
9656
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9500
9657
  <!-- add &lt; and &gt; to \S -->
9501
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9658
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9502
9659
  <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>
9503
9660
  <xsl:variable name="text3">
9504
9661
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9520,7 +9677,8 @@
9520
9677
  <xsl:choose>
9521
9678
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9522
9679
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9523
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
9680
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
9681
+ <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>
9524
9682
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9525
9683
  <xsl:choose>
9526
9684
  <xsl:when test="self::text()">
@@ -10123,6 +10281,23 @@
10123
10281
  </xsl:if>
10124
10282
  </xsl:template>
10125
10283
 
10284
+ <xsl:template name="setBlockAttributes">
10285
+ <xsl:param name="text_align_default">left</xsl:param>
10286
+ <xsl:call-template name="setTextAlignment">
10287
+ <xsl:with-param name="default" select="$text_align_default"/>
10288
+ </xsl:call-template>
10289
+
10290
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10291
+ <!-- Example: keep-lines-together="true" -->
10292
+ <xsl:if test="@keep-lines-together = 'true'">
10293
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10294
+ </xsl:if>
10295
+ <!-- Example: keep-with-next="true" -->
10296
+ <xsl:if test="@keep-with-next = 'true'">
10297
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10298
+ </xsl:if>
10299
+ </xsl:template>
10300
+
10126
10301
  <xsl:template name="number-to-words">
10127
10302
  <xsl:param name="number"/>
10128
10303
  <xsl:param name="first"/>
@@ -3,7 +3,7 @@ module IsoDoc
3
3
  module BaseConvert
4
4
  def intro_clause(elem, out)
5
5
  out.div **{ class: "Section3", id: elem["id"] } do |div|
6
- clause_name(nil, elem&.at(ns("./title")), div, class: "IntroTitle")
6
+ clause_name(elem, elem&.at(ns("./title")), div, class: "IntroTitle")
7
7
  elem.elements.each { |e| parse(e, div) unless e.name == "title" }
8
8
  end
9
9
  end
@@ -48,7 +48,7 @@ module IsoDoc
48
48
  f = isoxml.at(ns("//preface/abstract")) || return
49
49
  page_break(out)
50
50
  out.div **attr_code(id: f["id"]) do |s|
51
- clause_name(nil, f&.at(ns("./title")), s, class: "AbstractTitle")
51
+ clause_name(f, f&.at(ns("./title")), s, class: "AbstractTitle")
52
52
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
53
53
  end
54
54
  end
@@ -57,7 +57,7 @@ module IsoDoc
57
57
  f = isoxml.at(ns("//foreword")) || return
58
58
  page_break(out)
59
59
  out.div **attr_code(id: f["id"]) do |s|
60
- clause_name(nil, f&.at(ns("./title")), s, class: "ForewordTitle")
60
+ clause_name(f, f&.at(ns("./title")), s, class: "ForewordTitle")
61
61
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
62
62
  end
63
63
  end
@@ -70,7 +70,7 @@ module IsoDoc
70
70
  def conformance(isoxml, out, num)
71
71
  f = isoxml.at(ns("//clause[@type = 'conformance']")) or return num
72
72
  out.div **attr_code(id: f["id"]) do |div|
73
- clause_name(nil, f&.at(ns("./title")), div, nil)
73
+ clause_name(f, f&.at(ns("./title")), div, nil)
74
74
  f.elements.each { |e| parse(e, div) unless e.name == "title" }
75
75
  end
76
76
  num