metanorma-bipm 2.2.5 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -4420,7 +4420,6 @@
4420
4420
 
4421
4421
  <xsl:attribute-set name="table-header-cell-style">
4422
4422
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4423
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
4424
4423
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
4425
4424
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4426
4425
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -4435,7 +4434,6 @@
4435
4434
 
4436
4435
  <xsl:attribute-set name="table-cell-style">
4437
4436
  <xsl:attribute name="display-align">center</xsl:attribute>
4438
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
4439
4437
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
4440
4438
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4441
4439
 
@@ -5180,7 +5178,7 @@
5180
5178
  <xsl:apply-templates select="." mode="contents"/>
5181
5179
  </xsl:for-each>
5182
5180
 
5183
- <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')]]">
5181
+ <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]">
5184
5182
  <xsl:sort select="@displayorder" data-type="number"/>
5185
5183
  <xsl:apply-templates select="." mode="contents"/>
5186
5184
  </xsl:for-each>
@@ -6150,6 +6148,10 @@
6150
6148
  </xsl:choose>
6151
6149
  </xsl:variable>
6152
6150
 
6151
+ <xsl:variable name="table_fn_block">
6152
+ <xsl:call-template name="table_fn_display"/>
6153
+ </xsl:variable>
6154
+
6153
6155
  <xsl:variable name="tableWithNotesAndFootnotes">
6154
6156
 
6155
6157
  <fo:table keep-with-previous="always">
@@ -6207,11 +6209,25 @@
6207
6209
 
6208
6210
  <xsl:apply-templates select="../*[local-name()='note']"/>
6209
6211
 
6212
+ <xsl:variable name="isDisplayRowSeparator">
6213
+
6214
+ </xsl:variable>
6215
+
6210
6216
  <!-- horizontal row separator -->
6217
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6218
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
6219
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6220
+
6221
+ <xsl:call-template name="setBordersTableArray"/>
6222
+ <fo:block font-size="1pt"> </fo:block>
6223
+ </fo:block-container>
6224
+ </xsl:if>
6225
+ </xsl:if>
6211
6226
 
6212
6227
  <!-- fn processing -->
6213
6228
 
6214
- <xsl:call-template name="table_fn_display"/>
6229
+ <!-- <xsl:call-template name="table_fn_display" /> -->
6230
+ <xsl:copy-of select="$table_fn_block"/>
6215
6231
 
6216
6232
  <!-- for PAS display Notes after footnotes -->
6217
6233
 
@@ -6328,6 +6344,28 @@
6328
6344
  </fo:table-row>
6329
6345
  </xsl:template>
6330
6346
 
6347
+ <xsl:template name="setBorderUnderRow">
6348
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
6349
+ <xsl:choose>
6350
+ <xsl:when test="$border_under_row_ != ''">
6351
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
6352
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
6353
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
6354
+ <xsl:variable name="border_under_row">
6355
+ <xsl:call-template name="split">
6356
+ <xsl:with-param name="pText" select="$border_under_row_"/>
6357
+ </xsl:call-template>
6358
+ </xsl:variable>
6359
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
6360
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6361
+ </xsl:if>
6362
+ </xsl:when>
6363
+ <xsl:otherwise>
6364
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6365
+ </xsl:otherwise>
6366
+ </xsl:choose>
6367
+ </xsl:template>
6368
+
6331
6369
  <!-- row in table footer (tfoot) -->
6332
6370
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6333
6371
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -6711,8 +6749,16 @@
6711
6749
  <!-- figure's footnotes rendering -->
6712
6750
  <xsl:template name="fn_display_figure">
6713
6751
 
6752
+ <!-- current figure id -->
6753
+ <xsl:variable name="figure_id_">
6754
+ <xsl:value-of select="@id"/>
6755
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
6756
+ </xsl:variable>
6757
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
6758
+
6759
+ <!-- all footnotes relates to the current figure -->
6714
6760
  <xsl:variable name="references">
6715
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
6761
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
6716
6762
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6717
6763
  <xsl:apply-templates/>
6718
6764
  </fn>
@@ -6725,91 +6771,93 @@
6725
6771
 
6726
6772
  </xsl:variable>
6727
6773
 
6728
- <!-- current hierarchy is 'figure' element -->
6729
- <xsl:variable name="following_dl_colwidths">
6730
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6731
- <xsl:variable name="simple-table">
6732
- <!-- <xsl:variable name="doc_ns">
6733
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
6774
+ <fo:block>
6775
+
6776
+ <!-- current hierarchy is 'figure' element -->
6777
+ <xsl:variable name="following_dl_colwidths">
6778
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6779
+ <xsl:variable name="simple-table">
6780
+ <!-- <xsl:variable name="doc_ns">
6781
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
6782
+ </xsl:variable>
6783
+ <xsl:variable name="ns">
6784
+ <xsl:choose>
6785
+ <xsl:when test="normalize-space($doc_ns) != ''">
6786
+ <xsl:value-of select="normalize-space($doc_ns)"/>
6787
+ </xsl:when>
6788
+ <xsl:otherwise>
6789
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
6790
+ </xsl:otherwise>
6791
+ </xsl:choose>
6792
+ </xsl:variable> -->
6793
+
6794
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
6795
+ <tbody>
6796
+ <xsl:apply-templates mode="dl"/>
6797
+ </tbody>
6798
+ </xsl:for-each>
6799
+ </xsl:variable>
6800
+
6801
+ <xsl:call-template name="calculate-column-widths">
6802
+ <xsl:with-param name="cols-count" select="2"/>
6803
+ <xsl:with-param name="table" select="$simple-table"/>
6804
+ </xsl:call-template>
6805
+
6806
+ </xsl:if>
6734
6807
  </xsl:variable>
6735
- <xsl:variable name="ns">
6808
+
6809
+ <xsl:variable name="maxlength_dt">
6810
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
6811
+ <xsl:call-template name="getMaxLength_dt"/>
6812
+ </xsl:for-each>
6813
+ </xsl:variable>
6814
+
6815
+ <fo:table width="95%" table-layout="fixed">
6816
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6817
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6818
+
6819
+ </xsl:if>
6736
6820
  <xsl:choose>
6737
- <xsl:when test="normalize-space($doc_ns) != ''">
6738
- <xsl:value-of select="normalize-space($doc_ns)"/>
6821
+ <!-- if there 'dl', then set same columns width -->
6822
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6823
+ <xsl:call-template name="setColumnWidth_dl">
6824
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6825
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6826
+ </xsl:call-template>
6739
6827
  </xsl:when>
6740
6828
  <xsl:otherwise>
6741
- <xsl:value-of select="substring-before(name(/*), '-')"/>
6829
+ <fo:table-column column-width="5%"/>
6830
+ <fo:table-column column-width="95%"/>
6742
6831
  </xsl:otherwise>
6743
6832
  </xsl:choose>
6744
- </xsl:variable> -->
6745
-
6746
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6747
- <tbody>
6748
- <xsl:apply-templates mode="dl"/>
6749
- </tbody>
6750
- </xsl:for-each>
6751
- </xsl:variable>
6752
-
6753
- <xsl:call-template name="calculate-column-widths">
6754
- <xsl:with-param name="cols-count" select="2"/>
6755
- <xsl:with-param name="table" select="$simple-table"/>
6756
- </xsl:call-template>
6757
-
6758
- </xsl:if>
6759
- </xsl:variable>
6760
-
6761
- <xsl:variable name="maxlength_dt">
6762
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6763
- <xsl:call-template name="getMaxLength_dt"/>
6764
- </xsl:for-each>
6765
- </xsl:variable>
6766
-
6767
- <fo:block>
6768
- <fo:table width="95%" table-layout="fixed">
6769
- <xsl:if test="normalize-space($key_iso) = 'true'">
6770
- <xsl:attribute name="font-size">10pt</xsl:attribute>
6833
+ <fo:table-body>
6834
+ <xsl:for-each select="xalan:nodeset($references)//fn">
6835
+ <xsl:variable name="reference" select="@reference"/>
6836
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6837
+ <fo:table-row>
6838
+ <fo:table-cell>
6839
+ <fo:block>
6840
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6841
+ <xsl:value-of select="@reference"/>
6842
+ </fo:inline>
6843
+ </fo:block>
6844
+ </fo:table-cell>
6845
+ <fo:table-cell>
6846
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6847
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6771
6848
 
6772
- </xsl:if>
6773
- <xsl:choose>
6774
- <!-- if there 'dl', then set same columns width -->
6775
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6776
- <xsl:call-template name="setColumnWidth_dl">
6777
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6778
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6779
- </xsl:call-template>
6780
- </xsl:when>
6781
- <xsl:otherwise>
6782
- <fo:table-column column-width="15%"/>
6783
- <fo:table-column column-width="85%"/>
6784
- </xsl:otherwise>
6785
- </xsl:choose>
6786
- <fo:table-body>
6787
- <xsl:for-each select="xalan:nodeset($references)//fn">
6788
- <xsl:variable name="reference" select="@reference"/>
6789
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6790
- <fo:table-row>
6791
- <fo:table-cell>
6792
- <fo:block>
6793
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6794
- <xsl:value-of select="@reference"/>
6795
- </fo:inline>
6796
- </fo:block>
6797
- </fo:table-cell>
6798
- <fo:table-cell>
6799
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6800
- <xsl:if test="normalize-space($key_iso) = 'true'">
6849
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
6801
6850
 
6802
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
6851
+ </xsl:if>
6852
+ <xsl:copy-of select="./node()"/>
6853
+ </fo:block>
6854
+ </fo:table-cell>
6855
+ </fo:table-row>
6856
+ </xsl:if>
6857
+ </xsl:for-each>
6858
+ </fo:table-body>
6859
+ </fo:table>
6803
6860
 
6804
- </xsl:if>
6805
- <xsl:copy-of select="./node()"/>
6806
- </fo:block>
6807
- </fo:table-cell>
6808
- </fo:table-row>
6809
- </xsl:if>
6810
- </xsl:for-each>
6811
- </fo:table-body>
6812
- </fo:table>
6813
6861
  </fo:block>
6814
6862
  </xsl:if>
6815
6863
 
@@ -6890,12 +6938,14 @@
6890
6938
 
6891
6939
  <fo:block margin-bottom="12pt" text-align="left">
6892
6940
 
6893
- <xsl:variable name="title-where">
6941
+ <!-- <xsl:variable name="title-where">
6894
6942
  <xsl:call-template name="getLocalizedString">
6895
6943
  <xsl:with-param name="key">where</xsl:with-param>
6896
6944
  </xsl:call-template>
6897
6945
  </xsl:variable>
6898
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
6946
+ <xsl:value-of select="$title-where"/> -->
6947
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6948
+ <xsl:text> </xsl:text>
6899
6949
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6900
6950
  <xsl:text/>
6901
6951
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -6905,12 +6955,14 @@
6905
6955
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
6906
6956
  <fo:block margin-bottom="12pt" text-align="left">
6907
6957
 
6908
- <xsl:variable name="title-where">
6958
+ <!-- <xsl:variable name="title-where">
6909
6959
  <xsl:call-template name="getLocalizedString">
6910
6960
  <xsl:with-param name="key">where</xsl:with-param>
6911
6961
  </xsl:call-template>
6912
6962
  </xsl:variable>
6913
- <xsl:value-of select="$title-where"/>
6963
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
6964
+ <!-- preceding 'p' with word 'where' -->
6965
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6914
6966
  </fo:block>
6915
6967
  </xsl:when> <!-- END: a few components -->
6916
6968
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -7093,6 +7145,9 @@
7093
7145
 
7094
7146
  </xsl:template> <!-- END: dl -->
7095
7147
 
7148
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
7149
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
7150
+
7096
7151
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
7097
7152
  <xsl:param name="process">false</xsl:param>
7098
7153
  <xsl:if test="$process = 'true'">
@@ -7917,20 +7972,34 @@
7917
7972
 
7918
7973
  <xsl:template name="add-zero-spaces-java">
7919
7974
  <xsl:param name="text" select="."/>
7920
- <!-- add zero-width space (#x200B) after characters: dash, dot, equal, underscore, em dash, thin space, arrow right -->
7921
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|=|_|—| |→)','$1​')"/>
7975
+
7976
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
7977
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
7978
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
7979
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
7922
7980
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
7923
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(:)(\D)','$1​$2')"/>
7981
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
7924
7982
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
7925
- <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
7983
+ <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' -->
7926
7984
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
7927
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
7985
+ <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' -->
7928
7986
  <!-- add zero-width space (#x200B) before character: { -->
7929
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7987
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7930
7988
  <!-- add zero-width space (#x200B) after character: , -->
7931
- <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7989
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7990
+ <!-- add zero-width space (#x200B) after character: '/' -->
7991
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
7932
7992
 
7933
- <xsl:value-of select="$text6"/>
7993
+ <xsl:variable name="text9">
7994
+ <xsl:choose>
7995
+ <xsl:when test="$isGenerateTableIF = 'true'">
7996
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
7997
+ </xsl:when>
7998
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
7999
+ </xsl:choose>
8000
+ </xsl:variable>
8001
+
8002
+ <xsl:value-of select="$text9"/>
7934
8003
  </xsl:template>
7935
8004
 
7936
8005
  <xsl:template name="add-zero-spaces-link-java">
@@ -7938,8 +8007,8 @@
7938
8007
 
7939
8008
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7940
8009
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7941
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7942
- <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
8010
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
8011
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
7943
8012
  <!-- remove zero-width space at the end -->
7944
8013
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
7945
8014
  </xsl:template>
@@ -8294,9 +8363,28 @@
8294
8363
  </xsl:variable>
8295
8364
  <xsl:copy-of select="$newRow"/>
8296
8365
 
8297
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
8298
- <xsl:with-param name="previousRow" select="$newRow"/>
8299
- </xsl:apply-templates>
8366
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
8367
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
8368
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
8369
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
8370
+ <xsl:choose>
8371
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
8372
+ <xsl:copy-of select="following-sibling::tr"/>
8373
+ </xsl:when>
8374
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
8375
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
8376
+
8377
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
8378
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
8379
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
8380
+ </xsl:apply-templates>
8381
+ </xsl:when> -->
8382
+ <xsl:otherwise>
8383
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
8384
+ <xsl:with-param name="previousRow" select="$newRow"/>
8385
+ </xsl:apply-templates>
8386
+ </xsl:otherwise>
8387
+ </xsl:choose>
8300
8388
  </xsl:template>
8301
8389
  <!-- End mode simple-table-rowspan -->
8302
8390
 
@@ -8459,6 +8547,27 @@
8459
8547
  </xsl:call-template>
8460
8548
  </xsl:template>
8461
8549
 
8550
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
8551
+ <xsl:variable name="link">
8552
+ <link_updated>
8553
+ <xsl:variable name="target_text">
8554
+ <xsl:choose>
8555
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
8556
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
8557
+ </xsl:when>
8558
+ <xsl:otherwise>
8559
+ <xsl:value-of select="normalize-space(@target)"/>
8560
+ </xsl:otherwise>
8561
+ </xsl:choose>
8562
+ </xsl:variable>
8563
+ <xsl:value-of select="$target_text"/>
8564
+ </link_updated>
8565
+ </xsl:variable>
8566
+ <xsl:for-each select="xalan:nodeset($link)/*">
8567
+ <xsl:apply-templates mode="td_text_with_formatting"/>
8568
+ </xsl:for-each>
8569
+ </xsl:template>
8570
+
8462
8571
  <xsl:template name="getFormattingTags">
8463
8572
  <tags>
8464
8573
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -8840,7 +8949,7 @@
8840
8949
  </xsl:variable>
8841
8950
  <fo:inline xsl:use-attribute-sets="link-style">
8842
8951
 
8843
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
8952
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
8844
8953
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8845
8954
  </xsl:if>
8846
8955
 
@@ -9225,10 +9334,10 @@
9225
9334
  <fo:block xsl:use-attribute-sets="figure-style">
9226
9335
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9227
9336
  </fo:block>
9228
- <xsl:call-template name="fn_display_figure"/>
9229
9337
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9230
9338
  <xsl:call-template name="note"/>
9231
9339
  </xsl:for-each>
9340
+ <xsl:call-template name="fn_display_figure"/>
9232
9341
 
9233
9342
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9234
9343
 
@@ -9291,7 +9400,13 @@
9291
9400
  </xsl:choose>
9292
9401
  </xsl:variable>
9293
9402
 
9294
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9403
+ <xsl:variable name="image_width_effective">
9404
+
9405
+ <xsl:value-of select="$width_effective"/>
9406
+
9407
+ </xsl:variable>
9408
+
9409
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9295
9410
  <xsl:if test="number($scale) &lt; 100">
9296
9411
 
9297
9412
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -9878,6 +9993,13 @@
9878
9993
  <xsl:when test="$contents_nodes/doc">
9879
9994
  <xsl:choose>
9880
9995
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
9996
+
9997
+ <xsl:if test="$contents_nodes/collection">
9998
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
9999
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
10000
+ </fo:bookmark>
10001
+ </xsl:if>
10002
+
9881
10003
  <xsl:for-each select="$contents_nodes/doc">
9882
10004
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
9883
10005
  <xsl:if test="@bundle = 'true'">
@@ -11772,6 +11894,44 @@
11772
11894
 
11773
11895
  <fo:list-block xsl:use-attribute-sets="list-style">
11774
11896
 
11897
+ <xsl:variable name="provisional_distance_between_starts_">
11898
+ <attributes xsl:use-attribute-sets="list-style">
11899
+
11900
+ </attributes>
11901
+ </xsl:variable>
11902
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
11903
+ <xsl:if test="$provisional_distance_between_starts != ''">
11904
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
11905
+ </xsl:if>
11906
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
11907
+
11908
+ <!-- increase provisional-distance-between-starts for long lists -->
11909
+ <xsl:if test="local-name() = 'ol'">
11910
+ <!-- Examples: xiii), xviii), xxviii) -->
11911
+ <xsl:variable name="item_numbers">
11912
+ <xsl:for-each select="*[local-name() = 'li']">
11913
+ <item><xsl:call-template name="getListItemFormat"/></item>
11914
+ </xsl:for-each>
11915
+ </xsl:variable>
11916
+
11917
+ <xsl:variable name="max_length">
11918
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
11919
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
11920
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
11921
+ </xsl:for-each>
11922
+ </xsl:variable>
11923
+
11924
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
11925
+ <xsl:variable name="addon" select="$max_length - 4"/>
11926
+ <xsl:if test="$addon &gt; 0">
11927
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
11928
+ </xsl:if>
11929
+ <!-- DEBUG -->
11930
+ <!-- <xsl:copy-of select="$item_numbers"/>
11931
+ <max_length><xsl:value-of select="$max_length"/></max_length>
11932
+ <addon><xsl:value-of select="$addon"/></addon> -->
11933
+ </xsl:if>
11934
+
11775
11935
  <xsl:if test="*[local-name() = 'name']">
11776
11936
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
11777
11937
  </xsl:if>
@@ -12723,7 +12883,7 @@
12723
12883
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12724
12884
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12725
12885
  <!-- add &lt; and &gt; to \S -->
12726
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
12886
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
12727
12887
  <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>
12728
12888
  <xsl:variable name="text3">
12729
12889
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -12745,7 +12905,8 @@
12745
12905
  <xsl:choose>
12746
12906
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
12747
12907
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12748
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
12908
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12909
+ <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>
12749
12910
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
12750
12911
  <xsl:choose>
12751
12912
  <xsl:when test="self::text()">
@@ -13348,6 +13509,23 @@
13348
13509
  </xsl:if>
13349
13510
  </xsl:template>
13350
13511
 
13512
+ <xsl:template name="setBlockAttributes">
13513
+ <xsl:param name="text_align_default">left</xsl:param>
13514
+ <xsl:call-template name="setTextAlignment">
13515
+ <xsl:with-param name="default" select="$text_align_default"/>
13516
+ </xsl:call-template>
13517
+
13518
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
13519
+ <!-- Example: keep-lines-together="true" -->
13520
+ <xsl:if test="@keep-lines-together = 'true'">
13521
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
13522
+ </xsl:if>
13523
+ <!-- Example: keep-with-next="true" -->
13524
+ <xsl:if test="@keep-with-next = 'true'">
13525
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13526
+ </xsl:if>
13527
+ </xsl:template>
13528
+
13351
13529
  <xsl:template name="number-to-words">
13352
13530
  <xsl:param name="number"/>
13353
13531
  <xsl:param name="first"/>