metanorma-bipm 2.2.4 → 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>
@@ -5522,6 +5520,7 @@
5522
5520
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
5523
5521
 
5524
5522
  <xsl:choose>
5523
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
5525
5524
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
5526
5525
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
5527
5526
  </xsl:choose>
@@ -5643,7 +5642,7 @@
5643
5642
  <xsl:variable name="isDeleted" select="@deleted"/>
5644
5643
 
5645
5644
  <xsl:choose>
5646
- <xsl:when test="@width">
5645
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
5647
5646
 
5648
5647
  <!-- centered table when table name is centered (see table-name-style) -->
5649
5648
 
@@ -5985,6 +5984,7 @@
5985
5984
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
5986
5985
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
5987
5986
  <!-- difference between the available space and the minimum table width -->
5987
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
5988
5988
  <xsl:variable name="W" select="$page_width - @width_min"/>
5989
5989
  <W><xsl:value-of select="$W"/></W>
5990
5990
  <!-- difference between maximum and minimum width of the table -->
@@ -6148,6 +6148,10 @@
6148
6148
  </xsl:choose>
6149
6149
  </xsl:variable>
6150
6150
 
6151
+ <xsl:variable name="table_fn_block">
6152
+ <xsl:call-template name="table_fn_display"/>
6153
+ </xsl:variable>
6154
+
6151
6155
  <xsl:variable name="tableWithNotesAndFootnotes">
6152
6156
 
6153
6157
  <fo:table keep-with-previous="always">
@@ -6205,11 +6209,25 @@
6205
6209
 
6206
6210
  <xsl:apply-templates select="../*[local-name()='note']"/>
6207
6211
 
6212
+ <xsl:variable name="isDisplayRowSeparator">
6213
+
6214
+ </xsl:variable>
6215
+
6208
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>
6209
6226
 
6210
6227
  <!-- fn processing -->
6211
6228
 
6212
- <xsl:call-template name="table_fn_display"/>
6229
+ <!-- <xsl:call-template name="table_fn_display" /> -->
6230
+ <xsl:copy-of select="$table_fn_block"/>
6213
6231
 
6214
6232
  <!-- for PAS display Notes after footnotes -->
6215
6233
 
@@ -6326,6 +6344,28 @@
6326
6344
  </fo:table-row>
6327
6345
  </xsl:template>
6328
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
+
6329
6369
  <!-- row in table footer (tfoot) -->
6330
6370
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6331
6371
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -6663,21 +6703,24 @@
6663
6703
  <xsl:for-each select="xalan:nodeset($references)//fn">
6664
6704
  <xsl:variable name="reference" select="@reference"/>
6665
6705
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6666
- <fo:block xsl:use-attribute-sets="table-fn-style">
6667
6706
 
6668
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6707
+ <fo:block xsl:use-attribute-sets="table-fn-style">
6669
6708
 
6670
- <fo:inline font-style="normal">(</fo:inline>
6709
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6671
6710
 
6672
- <xsl:value-of select="@reference"/>
6711
+ <fo:inline font-style="normal">(</fo:inline>
6673
6712
 
6674
- <fo:inline font-style="normal">)</fo:inline>
6713
+ <xsl:value-of select="@reference"/>
6714
+
6715
+ <fo:inline font-style="normal">)</fo:inline>
6716
+
6717
+ </fo:inline>
6718
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6719
+ <xsl:copy-of select="./node()"/>
6720
+ </fo:inline>
6721
+
6722
+ </fo:block>
6675
6723
 
6676
- </fo:inline>
6677
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6678
- <xsl:copy-of select="./node()"/>
6679
- </fo:inline>
6680
- </fo:block>
6681
6724
  </xsl:if>
6682
6725
  </xsl:for-each>
6683
6726
  </xsl:template>
@@ -6706,8 +6749,16 @@
6706
6749
  <!-- figure's footnotes rendering -->
6707
6750
  <xsl:template name="fn_display_figure">
6708
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 -->
6709
6760
  <xsl:variable name="references">
6710
- <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]]">
6711
6762
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6712
6763
  <xsl:apply-templates/>
6713
6764
  </fn>
@@ -6720,91 +6771,93 @@
6720
6771
 
6721
6772
  </xsl:variable>
6722
6773
 
6723
- <!-- current hierarchy is 'figure' element -->
6724
- <xsl:variable name="following_dl_colwidths">
6725
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6726
- <xsl:variable name="simple-table">
6727
- <!-- <xsl:variable name="doc_ns">
6728
- <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>
6729
6807
  </xsl:variable>
6730
- <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>
6731
6820
  <xsl:choose>
6732
- <xsl:when test="normalize-space($doc_ns) != ''">
6733
- <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>
6734
6827
  </xsl:when>
6735
6828
  <xsl:otherwise>
6736
- <xsl:value-of select="substring-before(name(/*), '-')"/>
6829
+ <fo:table-column column-width="5%"/>
6830
+ <fo:table-column column-width="95%"/>
6737
6831
  </xsl:otherwise>
6738
6832
  </xsl:choose>
6739
- </xsl:variable> -->
6740
-
6741
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6742
- <tbody>
6743
- <xsl:apply-templates mode="dl"/>
6744
- </tbody>
6745
- </xsl:for-each>
6746
- </xsl:variable>
6747
-
6748
- <xsl:call-template name="calculate-column-widths">
6749
- <xsl:with-param name="cols-count" select="2"/>
6750
- <xsl:with-param name="table" select="$simple-table"/>
6751
- </xsl:call-template>
6752
-
6753
- </xsl:if>
6754
- </xsl:variable>
6755
-
6756
- <xsl:variable name="maxlength_dt">
6757
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6758
- <xsl:call-template name="getMaxLength_dt"/>
6759
- </xsl:for-each>
6760
- </xsl:variable>
6761
-
6762
- <fo:block>
6763
- <fo:table width="95%" table-layout="fixed">
6764
- <xsl:if test="normalize-space($key_iso) = 'true'">
6765
- <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'">
6766
6848
 
6767
- </xsl:if>
6768
- <xsl:choose>
6769
- <!-- if there 'dl', then set same columns width -->
6770
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6771
- <xsl:call-template name="setColumnWidth_dl">
6772
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6773
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6774
- </xsl:call-template>
6775
- </xsl:when>
6776
- <xsl:otherwise>
6777
- <fo:table-column column-width="15%"/>
6778
- <fo:table-column column-width="85%"/>
6779
- </xsl:otherwise>
6780
- </xsl:choose>
6781
- <fo:table-body>
6782
- <xsl:for-each select="xalan:nodeset($references)//fn">
6783
- <xsl:variable name="reference" select="@reference"/>
6784
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6785
- <fo:table-row>
6786
- <fo:table-cell>
6787
- <fo:block>
6788
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6789
- <xsl:value-of select="@reference"/>
6790
- </fo:inline>
6791
- </fo:block>
6792
- </fo:table-cell>
6793
- <fo:table-cell>
6794
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6795
- <xsl:if test="normalize-space($key_iso) = 'true'">
6849
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
6796
6850
 
6797
- <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>
6798
6860
 
6799
- </xsl:if>
6800
- <xsl:copy-of select="./node()"/>
6801
- </fo:block>
6802
- </fo:table-cell>
6803
- </fo:table-row>
6804
- </xsl:if>
6805
- </xsl:for-each>
6806
- </fo:table-body>
6807
- </fo:table>
6808
6861
  </fo:block>
6809
6862
  </xsl:if>
6810
6863
 
@@ -6885,12 +6938,14 @@
6885
6938
 
6886
6939
  <fo:block margin-bottom="12pt" text-align="left">
6887
6940
 
6888
- <xsl:variable name="title-where">
6941
+ <!-- <xsl:variable name="title-where">
6889
6942
  <xsl:call-template name="getLocalizedString">
6890
6943
  <xsl:with-param name="key">where</xsl:with-param>
6891
6944
  </xsl:call-template>
6892
6945
  </xsl:variable>
6893
- <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>
6894
6949
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6895
6950
  <xsl:text/>
6896
6951
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -6900,12 +6955,14 @@
6900
6955
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
6901
6956
  <fo:block margin-bottom="12pt" text-align="left">
6902
6957
 
6903
- <xsl:variable name="title-where">
6958
+ <!-- <xsl:variable name="title-where">
6904
6959
  <xsl:call-template name="getLocalizedString">
6905
6960
  <xsl:with-param name="key">where</xsl:with-param>
6906
6961
  </xsl:call-template>
6907
6962
  </xsl:variable>
6908
- <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()"/>
6909
6966
  </fo:block>
6910
6967
  </xsl:when> <!-- END: a few components -->
6911
6968
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -7088,6 +7145,9 @@
7088
7145
 
7089
7146
  </xsl:template> <!-- END: dl -->
7090
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
+
7091
7151
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
7092
7152
  <xsl:param name="process">false</xsl:param>
7093
7153
  <xsl:if test="$process = 'true'">
@@ -7618,12 +7678,12 @@
7618
7678
  <xsl:param name="value"/>
7619
7679
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
7620
7680
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
7621
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
7622
- <xsl:attribute name="height">5mm</xsl:attribute>
7681
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
7682
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
7623
7683
  <xsl:attribute name="content-width">100%</xsl:attribute>
7624
7684
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7625
7685
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7626
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7686
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7627
7687
  <g>
7628
7688
  <xsl:if test="$type = 'closing' or $type = 'end'">
7629
7689
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -7637,6 +7697,27 @@
7637
7697
  </xsl:if>
7638
7698
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
7639
7699
  </text>
7700
+ </svg> -->
7701
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7702
+ <g>
7703
+ <xsl:if test="$type = 'closing' or $type = 'end'">
7704
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
7705
+ </xsl:if>
7706
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
7707
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
7708
+ </g>
7709
+ <xsl:variable name="text_x">
7710
+ <xsl:choose>
7711
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
7712
+ <xsl:otherwise>22</xsl:otherwise>
7713
+ </xsl:choose>
7714
+ </xsl:variable>
7715
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
7716
+ <xsl:value-of select="$kind"/>
7717
+ </text>
7718
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
7719
+ <xsl:value-of select="$value"/>
7720
+ </text>
7640
7721
  </svg>
7641
7722
  </fo:instream-foreign-object>
7642
7723
  </xsl:template>
@@ -7891,18 +7972,34 @@
7891
7972
 
7892
7973
  <xsl:template name="add-zero-spaces-java">
7893
7974
  <xsl:param name="text" select="."/>
7894
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
7895
- <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​')"/>
7980
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
7981
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
7896
7982
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
7897
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
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' -->
7898
7984
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
7899
- <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
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' -->
7900
7986
  <!-- add zero-width space (#x200B) before character: { -->
7901
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&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' -->
7902
7988
  <!-- add zero-width space (#x200B) after character: , -->
7903
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\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 '/' -->
7992
+
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>
7904
8001
 
7905
- <xsl:value-of select="$text5"/>
8002
+ <xsl:value-of select="$text9"/>
7906
8003
  </xsl:template>
7907
8004
 
7908
8005
  <xsl:template name="add-zero-spaces-link-java">
@@ -7910,8 +8007,10 @@
7910
8007
 
7911
8008
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7912
8009
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7913
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7914
- <xsl:value-of 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​')"/>
8012
+ <!-- remove zero-width space at the end -->
8013
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
7915
8014
  </xsl:template>
7916
8015
 
7917
8016
  <!-- add zero space after dash character (for table's entries) -->
@@ -8048,7 +8147,7 @@
8048
8147
  </xsl:copy>
8049
8148
  </xsl:template>
8050
8149
 
8051
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
8150
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
8052
8151
  <xsl:copy>
8053
8152
  <xsl:copy-of select="@*"/>
8054
8153
  <p>
@@ -8124,6 +8223,14 @@
8124
8223
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
8125
8224
  </xsl:template>
8126
8225
 
8226
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
8227
+ <xsl:apply-templates mode="table-without-br"/>
8228
+ </xsl:template>
8229
+
8230
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
8231
+ <xsl:apply-templates mode="table-without-br"/>
8232
+ </xsl:template>
8233
+
8127
8234
  <!-- mode="table-without-br" -->
8128
8235
  <!-- ================================== -->
8129
8236
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -8256,9 +8363,28 @@
8256
8363
  </xsl:variable>
8257
8364
  <xsl:copy-of select="$newRow"/>
8258
8365
 
8259
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
8260
- <xsl:with-param name="previousRow" select="$newRow"/>
8261
- </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>
8262
8388
  </xsl:template>
8263
8389
  <!-- End mode simple-table-rowspan -->
8264
8390
 
@@ -8421,6 +8547,27 @@
8421
8547
  </xsl:call-template>
8422
8548
  </xsl:template>
8423
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
+
8424
8571
  <xsl:template name="getFormattingTags">
8425
8572
  <tags>
8426
8573
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -8802,7 +8949,7 @@
8802
8949
  </xsl:variable>
8803
8950
  <fo:inline xsl:use-attribute-sets="link-style">
8804
8951
 
8805
- <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'])">
8806
8953
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8807
8954
  </xsl:if>
8808
8955
 
@@ -8982,7 +9129,7 @@
8982
9129
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
8983
9130
  </xsl:if>
8984
9131
 
8985
- <fo:block-container margin-left="0mm">
9132
+ <fo:block-container margin-left="0mm" margin-right="0mm">
8986
9133
 
8987
9134
  <fo:block>
8988
9135
 
@@ -9181,13 +9328,16 @@
9181
9328
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
9182
9329
  </xsl:call-template>
9183
9330
 
9331
+ <!-- Example: Dimensions in millimeters -->
9332
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
9333
+
9184
9334
  <fo:block xsl:use-attribute-sets="figure-style">
9185
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9335
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9186
9336
  </fo:block>
9187
- <xsl:call-template name="fn_display_figure"/>
9188
- <xsl:for-each select="*[local-name() = 'note']">
9337
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9189
9338
  <xsl:call-template name="note"/>
9190
9339
  </xsl:for-each>
9340
+ <xsl:call-template name="fn_display_figure"/>
9191
9341
 
9192
9342
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9193
9343
 
@@ -9250,7 +9400,13 @@
9250
9400
  </xsl:choose>
9251
9401
  </xsl:variable>
9252
9402
 
9253
- <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)"/>
9254
9410
  <xsl:if test="number($scale) &lt; 100">
9255
9411
 
9256
9412
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -9442,24 +9598,47 @@
9442
9598
 
9443
9599
  </xsl:when>
9444
9600
  <xsl:otherwise>
9445
- <fo:block xsl:use-attribute-sets="image-style">
9446
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
9447
- <xsl:attribute name="width">100%</xsl:attribute>
9448
- <xsl:attribute name="content-height">100%</xsl:attribute>
9449
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9450
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9451
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9452
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
9453
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
9454
- <!-- effective height / width = 1.48, 1.4 - with title -->
9455
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9456
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
9457
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9458
- </xsl:if>
9459
- <xsl:attribute name="scaling">uniform</xsl:attribute>
9460
- <xsl:copy-of select="$svg_content"/>
9461
- </fo:instream-foreign-object>
9462
- </fo:block>
9601
+
9602
+ <xsl:variable name="element">
9603
+ <xsl:choose>
9604
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
9605
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
9606
+ </xsl:when>
9607
+ <xsl:otherwise>
9608
+ <fo:block xsl:use-attribute-sets="image-style">
9609
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
9610
+ <xsl:attribute name="text-align">left</xsl:attribute>
9611
+ </xsl:if>
9612
+ </fo:block>
9613
+ </xsl:otherwise>
9614
+ </xsl:choose>
9615
+ </xsl:variable>
9616
+
9617
+ <xsl:for-each select="xalan:nodeset($element)/*">
9618
+ <xsl:copy>
9619
+ <xsl:copy-of select="@*"/>
9620
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
9621
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
9622
+ <xsl:if test="$isGenerateTableIF = 'false'">
9623
+ <xsl:attribute name="width">100%</xsl:attribute>
9624
+ </xsl:if>
9625
+ <xsl:attribute name="content-height">100%</xsl:attribute>
9626
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9627
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9628
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9629
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
9630
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
9631
+ <!-- effective height / width = 1.48, 1.4 - with title -->
9632
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9633
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
9634
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9635
+ </xsl:if>
9636
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
9637
+ <xsl:copy-of select="$svg_content"/>
9638
+ </fo:instream-foreign-object>
9639
+ <!-- </fo:block> -->
9640
+ </xsl:copy>
9641
+ </xsl:for-each>
9463
9642
  </xsl:otherwise>
9464
9643
  </xsl:choose>
9465
9644
  </xsl:template>
@@ -9551,6 +9730,13 @@
9551
9730
  </xsl:for-each>
9552
9731
  </xsl:template>
9553
9732
 
9733
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
9734
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
9735
+ <xsl:for-each select="*[local-name() = 'svg']">
9736
+ <xsl:call-template name="image_svg"/>
9737
+ </xsl:for-each>
9738
+ </xsl:template>
9739
+
9554
9740
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
9555
9741
  <xsl:variable name="svg_content" select="document(@src)"/>
9556
9742
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9689,6 +9875,8 @@
9689
9875
  <xsl:value-of select="."/>
9690
9876
  </xsl:template>
9691
9877
 
9878
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
9879
+
9692
9880
  <xsl:template match="node()" mode="contents">
9693
9881
  <xsl:apply-templates mode="contents"/>
9694
9882
  </xsl:template>
@@ -9805,6 +9993,13 @@
9805
9993
  <xsl:when test="$contents_nodes/doc">
9806
9994
  <xsl:choose>
9807
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
+
9808
10003
  <xsl:for-each select="$contents_nodes/doc">
9809
10004
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
9810
10005
  <xsl:if test="@bundle = 'true'">
@@ -10010,7 +10205,15 @@
10010
10205
  <xsl:value-of select="@section"/>
10011
10206
  <xsl:text> </xsl:text>
10012
10207
  </xsl:if>
10013
- <xsl:value-of select="normalize-space(title)"/>
10208
+ <xsl:variable name="title">
10209
+ <xsl:for-each select="title/node()">
10210
+ <xsl:choose>
10211
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
10212
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10213
+ </xsl:choose>
10214
+ </xsl:for-each>
10215
+ </xsl:variable>
10216
+ <xsl:value-of select="normalize-space($title)"/>
10014
10217
  </fo:bookmark-title>
10015
10218
  <xsl:apply-templates mode="bookmark"/>
10016
10219
  </fo:bookmark>
@@ -10036,6 +10239,12 @@
10036
10239
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
10037
10240
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
10038
10241
 
10242
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
10243
+ <fo:block text-align="right" keep-with-next="always">
10244
+ <xsl:apply-templates/>
10245
+ </fo:block>
10246
+ </xsl:template>
10247
+
10039
10248
  <!-- ====== -->
10040
10249
  <!-- ====== -->
10041
10250
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -10185,6 +10394,10 @@
10185
10394
  </xsl:for-each>
10186
10395
  </xsl:template>
10187
10396
 
10397
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
10398
+ <xsl:value-of select="."/>
10399
+ </xsl:template>
10400
+
10188
10401
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10189
10402
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10190
10403
  <xsl:apply-templates mode="contents_item"/>
@@ -11681,6 +11894,44 @@
11681
11894
 
11682
11895
  <fo:list-block xsl:use-attribute-sets="list-style">
11683
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
+
11684
11935
  <xsl:if test="*[local-name() = 'name']">
11685
11936
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
11686
11937
  </xsl:if>
@@ -12632,7 +12883,7 @@
12632
12883
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12633
12884
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12634
12885
  <!-- add &lt; and &gt; to \S -->
12635
- <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>
12636
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>
12637
12888
  <xsl:variable name="text3">
12638
12889
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -12654,7 +12905,8 @@
12654
12905
  <xsl:choose>
12655
12906
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
12656
12907
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12657
- <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>
12658
12910
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
12659
12911
  <xsl:choose>
12660
12912
  <xsl:when test="self::text()">
@@ -13257,6 +13509,23 @@
13257
13509
  </xsl:if>
13258
13510
  </xsl:template>
13259
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
+
13260
13529
  <xsl:template name="number-to-words">
13261
13530
  <xsl:param name="number"/>
13262
13531
  <xsl:param name="first"/>