metanorma-itu 2.2.5 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -2684,7 +2684,6 @@
2684
2684
 
2685
2685
  <xsl:attribute-set name="table-header-cell-style">
2686
2686
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2687
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2688
2687
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2689
2688
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2690
2689
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -2693,10 +2692,10 @@
2693
2692
 
2694
2693
  <xsl:attribute-set name="table-cell-style">
2695
2694
  <xsl:attribute name="display-align">center</xsl:attribute>
2696
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2697
2695
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
2698
2696
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2699
2697
 
2698
+ <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2700
2699
  <xsl:attribute name="display-align">before</xsl:attribute>
2701
2700
 
2702
2701
  </xsl:attribute-set> <!-- table-cell-style -->
@@ -3439,7 +3438,7 @@
3439
3438
  <xsl:apply-templates select="." mode="contents"/>
3440
3439
  </xsl:for-each>
3441
3440
 
3442
- <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')]]">
3441
+ <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]">
3443
3442
  <xsl:sort select="@displayorder" data-type="number"/>
3444
3443
  <xsl:apply-templates select="." mode="contents"/>
3445
3444
  </xsl:for-each>
@@ -3899,7 +3898,7 @@
3899
3898
  <xsl:variable name="isDeleted" select="@deleted"/>
3900
3899
 
3901
3900
  <xsl:choose>
3902
- <xsl:when test="@width">
3901
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
3903
3902
 
3904
3903
  <!-- centered table when table name is centered (see table-name-style) -->
3905
3904
 
@@ -4224,6 +4223,7 @@
4224
4223
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
4225
4224
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
4226
4225
  <!-- difference between the available space and the minimum table width -->
4226
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
4227
4227
  <xsl:variable name="W" select="$page_width - @width_min"/>
4228
4228
  <W><xsl:value-of select="$W"/></W>
4229
4229
  <!-- difference between maximum and minimum width of the table -->
@@ -4387,6 +4387,10 @@
4387
4387
  </xsl:choose>
4388
4388
  </xsl:variable>
4389
4389
 
4390
+ <xsl:variable name="table_fn_block">
4391
+ <xsl:call-template name="table_fn_display"/>
4392
+ </xsl:variable>
4393
+
4390
4394
  <xsl:variable name="tableWithNotesAndFootnotes">
4391
4395
 
4392
4396
  <fo:table keep-with-previous="always">
@@ -4453,11 +4457,25 @@
4453
4457
 
4454
4458
  <xsl:apply-templates select="../*[local-name()='note']"/>
4455
4459
 
4460
+ <xsl:variable name="isDisplayRowSeparator">
4461
+
4462
+ </xsl:variable>
4463
+
4456
4464
  <!-- horizontal row separator -->
4465
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4466
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
4467
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4468
+
4469
+ <xsl:call-template name="setBordersTableArray"/>
4470
+ <fo:block font-size="1pt"> </fo:block>
4471
+ </fo:block-container>
4472
+ </xsl:if>
4473
+ </xsl:if>
4457
4474
 
4458
4475
  <!-- fn processing -->
4459
4476
 
4460
- <xsl:call-template name="table_fn_display"/>
4477
+ <!-- <xsl:call-template name="table_fn_display" /> -->
4478
+ <xsl:copy-of select="$table_fn_block"/>
4461
4479
 
4462
4480
  <!-- for PAS display Notes after footnotes -->
4463
4481
 
@@ -4578,6 +4596,28 @@
4578
4596
  </fo:table-row>
4579
4597
  </xsl:template>
4580
4598
 
4599
+ <xsl:template name="setBorderUnderRow">
4600
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
4601
+ <xsl:choose>
4602
+ <xsl:when test="$border_under_row_ != ''">
4603
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
4604
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
4605
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
4606
+ <xsl:variable name="border_under_row">
4607
+ <xsl:call-template name="split">
4608
+ <xsl:with-param name="pText" select="$border_under_row_"/>
4609
+ </xsl:call-template>
4610
+ </xsl:variable>
4611
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
4612
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4613
+ </xsl:if>
4614
+ </xsl:when>
4615
+ <xsl:otherwise>
4616
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4617
+ </xsl:otherwise>
4618
+ </xsl:choose>
4619
+ </xsl:template>
4620
+
4581
4621
  <!-- row in table footer (tfoot) -->
4582
4622
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4583
4623
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -4891,19 +4931,22 @@
4891
4931
  <xsl:for-each select="xalan:nodeset($references)//fn">
4892
4932
  <xsl:variable name="reference" select="@reference"/>
4893
4933
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4894
- <fo:block xsl:use-attribute-sets="table-fn-style">
4895
4934
 
4896
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4935
+ <fo:block xsl:use-attribute-sets="table-fn-style">
4897
4936
 
4898
- <xsl:value-of select="@reference"/>
4937
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4899
4938
 
4900
- <xsl:text>)</xsl:text>
4939
+ <xsl:value-of select="@reference"/>
4940
+
4941
+ <xsl:text>)</xsl:text>
4942
+
4943
+ </fo:inline>
4944
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4945
+ <xsl:copy-of select="./node()"/>
4946
+ </fo:inline>
4947
+
4948
+ </fo:block>
4901
4949
 
4902
- </fo:inline>
4903
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4904
- <xsl:copy-of select="./node()"/>
4905
- </fo:inline>
4906
- </fo:block>
4907
4950
  </xsl:if>
4908
4951
  </xsl:for-each>
4909
4952
  </xsl:template>
@@ -4936,8 +4979,16 @@
4936
4979
  <!-- figure's footnotes rendering -->
4937
4980
  <xsl:template name="fn_display_figure">
4938
4981
 
4982
+ <!-- current figure id -->
4983
+ <xsl:variable name="figure_id_">
4984
+ <xsl:value-of select="@id"/>
4985
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4986
+ </xsl:variable>
4987
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4988
+
4989
+ <!-- all footnotes relates to the current figure -->
4939
4990
  <xsl:variable name="references">
4940
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
4991
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4941
4992
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4942
4993
  <xsl:apply-templates/>
4943
4994
  </fn>
@@ -4950,91 +5001,93 @@
4950
5001
 
4951
5002
  </xsl:variable>
4952
5003
 
4953
- <!-- current hierarchy is 'figure' element -->
4954
- <xsl:variable name="following_dl_colwidths">
4955
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4956
- <xsl:variable name="simple-table">
4957
- <!-- <xsl:variable name="doc_ns">
4958
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5004
+ <fo:block>
5005
+
5006
+ <!-- current hierarchy is 'figure' element -->
5007
+ <xsl:variable name="following_dl_colwidths">
5008
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5009
+ <xsl:variable name="simple-table">
5010
+ <!-- <xsl:variable name="doc_ns">
5011
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5012
+ </xsl:variable>
5013
+ <xsl:variable name="ns">
5014
+ <xsl:choose>
5015
+ <xsl:when test="normalize-space($doc_ns) != ''">
5016
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5017
+ </xsl:when>
5018
+ <xsl:otherwise>
5019
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5020
+ </xsl:otherwise>
5021
+ </xsl:choose>
5022
+ </xsl:variable> -->
5023
+
5024
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5025
+ <tbody>
5026
+ <xsl:apply-templates mode="dl"/>
5027
+ </tbody>
5028
+ </xsl:for-each>
5029
+ </xsl:variable>
5030
+
5031
+ <xsl:call-template name="calculate-column-widths">
5032
+ <xsl:with-param name="cols-count" select="2"/>
5033
+ <xsl:with-param name="table" select="$simple-table"/>
5034
+ </xsl:call-template>
5035
+
5036
+ </xsl:if>
4959
5037
  </xsl:variable>
4960
- <xsl:variable name="ns">
5038
+
5039
+ <xsl:variable name="maxlength_dt">
5040
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5041
+ <xsl:call-template name="getMaxLength_dt"/>
5042
+ </xsl:for-each>
5043
+ </xsl:variable>
5044
+
5045
+ <fo:table width="95%" table-layout="fixed">
5046
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5047
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5048
+
5049
+ </xsl:if>
4961
5050
  <xsl:choose>
4962
- <xsl:when test="normalize-space($doc_ns) != ''">
4963
- <xsl:value-of select="normalize-space($doc_ns)"/>
5051
+ <!-- if there 'dl', then set same columns width -->
5052
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5053
+ <xsl:call-template name="setColumnWidth_dl">
5054
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5055
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5056
+ </xsl:call-template>
4964
5057
  </xsl:when>
4965
5058
  <xsl:otherwise>
4966
- <xsl:value-of select="substring-before(name(/*), '-')"/>
5059
+ <fo:table-column column-width="5%"/>
5060
+ <fo:table-column column-width="95%"/>
4967
5061
  </xsl:otherwise>
4968
5062
  </xsl:choose>
4969
- </xsl:variable> -->
4970
-
4971
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4972
- <tbody>
4973
- <xsl:apply-templates mode="dl"/>
4974
- </tbody>
4975
- </xsl:for-each>
4976
- </xsl:variable>
4977
-
4978
- <xsl:call-template name="calculate-column-widths">
4979
- <xsl:with-param name="cols-count" select="2"/>
4980
- <xsl:with-param name="table" select="$simple-table"/>
4981
- </xsl:call-template>
4982
-
4983
- </xsl:if>
4984
- </xsl:variable>
4985
-
4986
- <xsl:variable name="maxlength_dt">
4987
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4988
- <xsl:call-template name="getMaxLength_dt"/>
4989
- </xsl:for-each>
4990
- </xsl:variable>
5063
+ <fo:table-body>
5064
+ <xsl:for-each select="xalan:nodeset($references)//fn">
5065
+ <xsl:variable name="reference" select="@reference"/>
5066
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5067
+ <fo:table-row>
5068
+ <fo:table-cell>
5069
+ <fo:block>
5070
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5071
+ <xsl:value-of select="@reference"/>
5072
+ </fo:inline>
5073
+ </fo:block>
5074
+ </fo:table-cell>
5075
+ <fo:table-cell>
5076
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5077
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4991
5078
 
4992
- <fo:block>
4993
- <fo:table width="95%" table-layout="fixed">
4994
- <xsl:if test="normalize-space($key_iso) = 'true'">
4995
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5079
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4996
5080
 
4997
- </xsl:if>
4998
- <xsl:choose>
4999
- <!-- if there 'dl', then set same columns width -->
5000
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5001
- <xsl:call-template name="setColumnWidth_dl">
5002
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5003
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5004
- </xsl:call-template>
5005
- </xsl:when>
5006
- <xsl:otherwise>
5007
- <fo:table-column column-width="15%"/>
5008
- <fo:table-column column-width="85%"/>
5009
- </xsl:otherwise>
5010
- </xsl:choose>
5011
- <fo:table-body>
5012
- <xsl:for-each select="xalan:nodeset($references)//fn">
5013
- <xsl:variable name="reference" select="@reference"/>
5014
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5015
- <fo:table-row>
5016
- <fo:table-cell>
5017
- <fo:block>
5018
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5019
- <xsl:value-of select="@reference"/>
5020
- </fo:inline>
5021
- </fo:block>
5022
- </fo:table-cell>
5023
- <fo:table-cell>
5024
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5025
- <xsl:if test="normalize-space($key_iso) = 'true'">
5026
-
5027
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5081
+ </xsl:if>
5082
+ <xsl:copy-of select="./node()"/>
5083
+ </fo:block>
5084
+ </fo:table-cell>
5085
+ </fo:table-row>
5086
+ </xsl:if>
5087
+ </xsl:for-each>
5088
+ </fo:table-body>
5089
+ </fo:table>
5028
5090
 
5029
- </xsl:if>
5030
- <xsl:copy-of select="./node()"/>
5031
- </fo:block>
5032
- </fo:table-cell>
5033
- </fo:table-row>
5034
- </xsl:if>
5035
- </xsl:for-each>
5036
- </fo:table-body>
5037
- </fo:table>
5038
5091
  </fo:block>
5039
5092
  </xsl:if>
5040
5093
 
@@ -5110,12 +5163,14 @@
5110
5163
 
5111
5164
  <fo:block margin-bottom="12pt" text-align="left">
5112
5165
 
5113
- <xsl:variable name="title-where">
5166
+ <!-- <xsl:variable name="title-where">
5114
5167
  <xsl:call-template name="getLocalizedString">
5115
5168
  <xsl:with-param name="key">where</xsl:with-param>
5116
5169
  </xsl:call-template>
5117
5170
  </xsl:variable>
5118
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
5171
+ <xsl:value-of select="$title-where"/> -->
5172
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5173
+ <xsl:text> </xsl:text>
5119
5174
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5120
5175
  <xsl:text/>
5121
5176
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -5127,12 +5182,14 @@
5127
5182
 
5128
5183
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5129
5184
 
5130
- <xsl:variable name="title-where">
5185
+ <!-- <xsl:variable name="title-where">
5131
5186
  <xsl:call-template name="getLocalizedString">
5132
5187
  <xsl:with-param name="key">where</xsl:with-param>
5133
5188
  </xsl:call-template>
5134
5189
  </xsl:variable>
5135
- <xsl:value-of select="$title-where"/>:
5190
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
5191
+ <!-- preceding 'p' with word 'where' -->
5192
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5136
5193
  </fo:block>
5137
5194
  </xsl:when> <!-- END: a few components -->
5138
5195
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -5319,6 +5376,9 @@
5319
5376
 
5320
5377
  </xsl:template> <!-- END: dl -->
5321
5378
 
5379
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5380
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5381
+
5322
5382
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5323
5383
  <xsl:param name="process">false</xsl:param>
5324
5384
  <xsl:if test="$process = 'true'">
@@ -5859,12 +5919,12 @@
5859
5919
  <xsl:param name="value"/>
5860
5920
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
5861
5921
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
5862
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
5863
- <xsl:attribute name="height">5mm</xsl:attribute>
5922
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
5923
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
5864
5924
  <xsl:attribute name="content-width">100%</xsl:attribute>
5865
5925
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5866
5926
  <xsl:attribute name="scaling">uniform</xsl:attribute>
5867
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5927
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5868
5928
  <g>
5869
5929
  <xsl:if test="$type = 'closing' or $type = 'end'">
5870
5930
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -5878,6 +5938,27 @@
5878
5938
  </xsl:if>
5879
5939
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
5880
5940
  </text>
5941
+ </svg> -->
5942
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5943
+ <g>
5944
+ <xsl:if test="$type = 'closing' or $type = 'end'">
5945
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
5946
+ </xsl:if>
5947
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
5948
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
5949
+ </g>
5950
+ <xsl:variable name="text_x">
5951
+ <xsl:choose>
5952
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
5953
+ <xsl:otherwise>22</xsl:otherwise>
5954
+ </xsl:choose>
5955
+ </xsl:variable>
5956
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
5957
+ <xsl:value-of select="$kind"/>
5958
+ </text>
5959
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
5960
+ <xsl:value-of select="$value"/>
5961
+ </text>
5881
5962
  </svg>
5882
5963
  </fo:instream-foreign-object>
5883
5964
  </xsl:template>
@@ -6132,18 +6213,34 @@
6132
6213
 
6133
6214
  <xsl:template name="add-zero-spaces-java">
6134
6215
  <xsl:param name="text" select="."/>
6135
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
6136
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
6216
+
6217
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
6218
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
6219
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
6220
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
6221
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
6222
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
6137
6223
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
6138
- <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' -->
6224
+ <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' -->
6139
6225
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
6140
- <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' -->
6226
+ <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' -->
6141
6227
  <!-- add zero-width space (#x200B) before character: { -->
6142
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
6228
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
6143
6229
  <!-- add zero-width space (#x200B) after character: , -->
6144
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
6230
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
6231
+ <!-- add zero-width space (#x200B) after character: '/' -->
6232
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
6233
+
6234
+ <xsl:variable name="text9">
6235
+ <xsl:choose>
6236
+ <xsl:when test="$isGenerateTableIF = 'true'">
6237
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
6238
+ </xsl:when>
6239
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
6240
+ </xsl:choose>
6241
+ </xsl:variable>
6145
6242
 
6146
- <xsl:value-of select="$text5"/>
6243
+ <xsl:value-of select="$text9"/>
6147
6244
  </xsl:template>
6148
6245
 
6149
6246
  <xsl:template name="add-zero-spaces-link-java">
@@ -6151,8 +6248,10 @@
6151
6248
 
6152
6249
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
6153
6250
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
6154
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
6155
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
6251
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
6252
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
6253
+ <!-- remove zero-width space at the end -->
6254
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
6156
6255
  </xsl:template>
6157
6256
 
6158
6257
  <!-- add zero space after dash character (for table's entries) -->
@@ -6289,7 +6388,7 @@
6289
6388
  </xsl:copy>
6290
6389
  </xsl:template>
6291
6390
 
6292
- <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">
6391
+ <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">
6293
6392
  <xsl:copy>
6294
6393
  <xsl:copy-of select="@*"/>
6295
6394
  <p>
@@ -6365,6 +6464,14 @@
6365
6464
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
6366
6465
  </xsl:template>
6367
6466
 
6467
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
6468
+ <xsl:apply-templates mode="table-without-br"/>
6469
+ </xsl:template>
6470
+
6471
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
6472
+ <xsl:apply-templates mode="table-without-br"/>
6473
+ </xsl:template>
6474
+
6368
6475
  <!-- mode="table-without-br" -->
6369
6476
  <!-- ================================== -->
6370
6477
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -6497,9 +6604,28 @@
6497
6604
  </xsl:variable>
6498
6605
  <xsl:copy-of select="$newRow"/>
6499
6606
 
6500
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6501
- <xsl:with-param name="previousRow" select="$newRow"/>
6502
- </xsl:apply-templates>
6607
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
6608
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
6609
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
6610
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
6611
+ <xsl:choose>
6612
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
6613
+ <xsl:copy-of select="following-sibling::tr"/>
6614
+ </xsl:when>
6615
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
6616
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
6617
+
6618
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6619
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
6620
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
6621
+ </xsl:apply-templates>
6622
+ </xsl:when> -->
6623
+ <xsl:otherwise>
6624
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
6625
+ <xsl:with-param name="previousRow" select="$newRow"/>
6626
+ </xsl:apply-templates>
6627
+ </xsl:otherwise>
6628
+ </xsl:choose>
6503
6629
  </xsl:template>
6504
6630
  <!-- End mode simple-table-rowspan -->
6505
6631
 
@@ -6662,6 +6788,27 @@
6662
6788
  </xsl:call-template>
6663
6789
  </xsl:template>
6664
6790
 
6791
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
6792
+ <xsl:variable name="link">
6793
+ <link_updated>
6794
+ <xsl:variable name="target_text">
6795
+ <xsl:choose>
6796
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
6797
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
6798
+ </xsl:when>
6799
+ <xsl:otherwise>
6800
+ <xsl:value-of select="normalize-space(@target)"/>
6801
+ </xsl:otherwise>
6802
+ </xsl:choose>
6803
+ </xsl:variable>
6804
+ <xsl:value-of select="$target_text"/>
6805
+ </link_updated>
6806
+ </xsl:variable>
6807
+ <xsl:for-each select="xalan:nodeset($link)/*">
6808
+ <xsl:apply-templates mode="td_text_with_formatting"/>
6809
+ </xsl:for-each>
6810
+ </xsl:template>
6811
+
6665
6812
  <xsl:template name="getFormattingTags">
6666
6813
  <tags>
6667
6814
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -7003,7 +7150,7 @@
7003
7150
  </xsl:variable>
7004
7151
  <fo:inline xsl:use-attribute-sets="link-style">
7005
7152
 
7006
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
7153
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
7007
7154
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7008
7155
  </xsl:if>
7009
7156
 
@@ -7178,7 +7325,7 @@
7178
7325
 
7179
7326
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
7180
7327
 
7181
- <fo:block-container margin-left="0mm">
7328
+ <fo:block-container margin-left="0mm" margin-right="0mm">
7182
7329
 
7183
7330
  <fo:block>
7184
7331
 
@@ -7360,13 +7507,16 @@
7360
7507
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
7361
7508
  </xsl:call-template>
7362
7509
 
7510
+ <!-- Example: Dimensions in millimeters -->
7511
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
7512
+
7363
7513
  <fo:block xsl:use-attribute-sets="figure-style">
7364
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7514
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
7365
7515
  </fo:block>
7366
- <xsl:call-template name="fn_display_figure"/>
7367
- <xsl:for-each select="*[local-name() = 'note']">
7516
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7368
7517
  <xsl:call-template name="note"/>
7369
7518
  </xsl:for-each>
7519
+ <xsl:call-template name="fn_display_figure"/>
7370
7520
 
7371
7521
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
7372
7522
 
@@ -7429,7 +7579,13 @@
7429
7579
  </xsl:choose>
7430
7580
  </xsl:variable>
7431
7581
 
7432
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7582
+ <xsl:variable name="image_width_effective">
7583
+
7584
+ <xsl:value-of select="$width_effective"/>
7585
+
7586
+ </xsl:variable>
7587
+
7588
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7433
7589
  <xsl:if test="number($scale) &lt; 100">
7434
7590
 
7435
7591
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -7621,24 +7777,47 @@
7621
7777
 
7622
7778
  </xsl:when>
7623
7779
  <xsl:otherwise>
7624
- <fo:block xsl:use-attribute-sets="image-style">
7625
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7626
- <xsl:attribute name="width">100%</xsl:attribute>
7627
- <xsl:attribute name="content-height">100%</xsl:attribute>
7628
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7629
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7630
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7631
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7632
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7633
- <!-- effective height / width = 1.48, 1.4 - with title -->
7634
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7635
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7636
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7637
- </xsl:if>
7638
- <xsl:attribute name="scaling">uniform</xsl:attribute>
7639
- <xsl:copy-of select="$svg_content"/>
7640
- </fo:instream-foreign-object>
7641
- </fo:block>
7780
+
7781
+ <xsl:variable name="element">
7782
+ <xsl:choose>
7783
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
7784
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7785
+ </xsl:when>
7786
+ <xsl:otherwise>
7787
+ <fo:block xsl:use-attribute-sets="image-style">
7788
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
7789
+ <xsl:attribute name="text-align">left</xsl:attribute>
7790
+ </xsl:if>
7791
+ </fo:block>
7792
+ </xsl:otherwise>
7793
+ </xsl:choose>
7794
+ </xsl:variable>
7795
+
7796
+ <xsl:for-each select="xalan:nodeset($element)/*">
7797
+ <xsl:copy>
7798
+ <xsl:copy-of select="@*"/>
7799
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
7800
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7801
+ <xsl:if test="$isGenerateTableIF = 'false'">
7802
+ <xsl:attribute name="width">100%</xsl:attribute>
7803
+ </xsl:if>
7804
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7805
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7806
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7807
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7808
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7809
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7810
+ <!-- effective height / width = 1.48, 1.4 - with title -->
7811
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7812
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7813
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7814
+ </xsl:if>
7815
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7816
+ <xsl:copy-of select="$svg_content"/>
7817
+ </fo:instream-foreign-object>
7818
+ <!-- </fo:block> -->
7819
+ </xsl:copy>
7820
+ </xsl:for-each>
7642
7821
  </xsl:otherwise>
7643
7822
  </xsl:choose>
7644
7823
  </xsl:template>
@@ -7730,6 +7909,13 @@
7730
7909
  </xsl:for-each>
7731
7910
  </xsl:template>
7732
7911
 
7912
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
7913
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7914
+ <xsl:for-each select="*[local-name() = 'svg']">
7915
+ <xsl:call-template name="image_svg"/>
7916
+ </xsl:for-each>
7917
+ </xsl:template>
7918
+
7733
7919
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7734
7920
  <xsl:variable name="svg_content" select="document(@src)"/>
7735
7921
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7868,6 +8054,8 @@
7868
8054
  <xsl:value-of select="."/>
7869
8055
  </xsl:template>
7870
8056
 
8057
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
8058
+
7871
8059
  <xsl:template match="node()" mode="contents">
7872
8060
  <xsl:apply-templates mode="contents"/>
7873
8061
  </xsl:template>
@@ -7984,6 +8172,13 @@
7984
8172
  <xsl:when test="$contents_nodes/doc">
7985
8173
  <xsl:choose>
7986
8174
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
8175
+
8176
+ <xsl:if test="$contents_nodes/collection">
8177
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
8178
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
8179
+ </fo:bookmark>
8180
+ </xsl:if>
8181
+
7987
8182
  <xsl:for-each select="$contents_nodes/doc">
7988
8183
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7989
8184
  <xsl:if test="@bundle = 'true'">
@@ -8175,7 +8370,15 @@
8175
8370
  <xsl:value-of select="@section"/>
8176
8371
  <xsl:text> </xsl:text>
8177
8372
  </xsl:if>
8178
- <xsl:value-of select="normalize-space(title)"/>
8373
+ <xsl:variable name="title">
8374
+ <xsl:for-each select="title/node()">
8375
+ <xsl:choose>
8376
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
8377
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8378
+ </xsl:choose>
8379
+ </xsl:for-each>
8380
+ </xsl:variable>
8381
+ <xsl:value-of select="normalize-space($title)"/>
8179
8382
  </fo:bookmark-title>
8180
8383
  <xsl:apply-templates mode="bookmark"/>
8181
8384
  </fo:bookmark>
@@ -8201,6 +8404,12 @@
8201
8404
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
8202
8405
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
8203
8406
 
8407
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
8408
+ <fo:block text-align="right" keep-with-next="always">
8409
+ <xsl:apply-templates/>
8410
+ </fo:block>
8411
+ </xsl:template>
8412
+
8204
8413
  <!-- ====== -->
8205
8414
  <!-- ====== -->
8206
8415
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -8350,6 +8559,10 @@
8350
8559
  </xsl:for-each>
8351
8560
  </xsl:template>
8352
8561
 
8562
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
8563
+ <xsl:value-of select="."/>
8564
+ </xsl:template>
8565
+
8353
8566
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
8354
8567
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
8355
8568
  <xsl:apply-templates mode="contents_item"/>
@@ -9849,6 +10062,44 @@
9849
10062
 
9850
10063
  <fo:list-block xsl:use-attribute-sets="list-style">
9851
10064
 
10065
+ <xsl:variable name="provisional_distance_between_starts_">
10066
+ <attributes xsl:use-attribute-sets="list-style">
10067
+
10068
+ </attributes>
10069
+ </xsl:variable>
10070
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
10071
+ <xsl:if test="$provisional_distance_between_starts != ''">
10072
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
10073
+ </xsl:if>
10074
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
10075
+
10076
+ <!-- increase provisional-distance-between-starts for long lists -->
10077
+ <xsl:if test="local-name() = 'ol'">
10078
+ <!-- Examples: xiii), xviii), xxviii) -->
10079
+ <xsl:variable name="item_numbers">
10080
+ <xsl:for-each select="*[local-name() = 'li']">
10081
+ <item><xsl:call-template name="getListItemFormat"/></item>
10082
+ </xsl:for-each>
10083
+ </xsl:variable>
10084
+
10085
+ <xsl:variable name="max_length">
10086
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
10087
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
10088
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
10089
+ </xsl:for-each>
10090
+ </xsl:variable>
10091
+
10092
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
10093
+ <xsl:variable name="addon" select="$max_length - 4"/>
10094
+ <xsl:if test="$addon &gt; 0">
10095
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
10096
+ </xsl:if>
10097
+ <!-- DEBUG -->
10098
+ <!-- <xsl:copy-of select="$item_numbers"/>
10099
+ <max_length><xsl:value-of select="$max_length"/></max_length>
10100
+ <addon><xsl:value-of select="$addon"/></addon> -->
10101
+ </xsl:if>
10102
+
9852
10103
  <xsl:if test="*[local-name() = 'name']">
9853
10104
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9854
10105
  </xsl:if>
@@ -10830,7 +11081,7 @@
10830
11081
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10831
11082
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10832
11083
  <!-- add &lt; and &gt; to \S -->
10833
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
11084
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
10834
11085
  <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>
10835
11086
  <xsl:variable name="text3">
10836
11087
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -10852,7 +11103,8 @@
10852
11103
  <xsl:choose>
10853
11104
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
10854
11105
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10855
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
11106
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
11107
+ <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>
10856
11108
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
10857
11109
  <xsl:choose>
10858
11110
  <xsl:when test="self::text()">
@@ -11455,6 +11707,23 @@
11455
11707
  </xsl:if>
11456
11708
  </xsl:template>
11457
11709
 
11710
+ <xsl:template name="setBlockAttributes">
11711
+ <xsl:param name="text_align_default">left</xsl:param>
11712
+ <xsl:call-template name="setTextAlignment">
11713
+ <xsl:with-param name="default" select="$text_align_default"/>
11714
+ </xsl:call-template>
11715
+
11716
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
11717
+ <!-- Example: keep-lines-together="true" -->
11718
+ <xsl:if test="@keep-lines-together = 'true'">
11719
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
11720
+ </xsl:if>
11721
+ <!-- Example: keep-with-next="true" -->
11722
+ <xsl:if test="@keep-with-next = 'true'">
11723
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11724
+ </xsl:if>
11725
+ </xsl:template>
11726
+
11458
11727
  <xsl:template name="number-to-words">
11459
11728
  <xsl:param name="number"/>
11460
11729
  <xsl:param name="first"/>