metanorma-ribose 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1799,7 +1799,6 @@
1799
1799
 
1800
1800
  <xsl:attribute-set name="table-header-cell-style">
1801
1801
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1802
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1803
1802
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1804
1803
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1805
1804
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -1811,7 +1810,6 @@
1811
1810
 
1812
1811
  <xsl:attribute-set name="table-cell-style">
1813
1812
  <xsl:attribute name="display-align">center</xsl:attribute>
1814
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1815
1813
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1816
1814
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1817
1815
 
@@ -2609,7 +2607,7 @@
2609
2607
  <xsl:apply-templates select="." mode="contents"/>
2610
2608
  </xsl:for-each>
2611
2609
 
2612
- <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')]]">
2610
+ <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]">
2613
2611
  <xsl:sort select="@displayorder" data-type="number"/>
2614
2612
  <xsl:apply-templates select="." mode="contents"/>
2615
2613
  </xsl:for-each>
@@ -3051,7 +3049,7 @@
3051
3049
  <xsl:variable name="isDeleted" select="@deleted"/>
3052
3050
 
3053
3051
  <xsl:choose>
3054
- <xsl:when test="@width">
3052
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
3055
3053
 
3056
3054
  <!-- centered table when table name is centered (see table-name-style) -->
3057
3055
 
@@ -3376,6 +3374,7 @@
3376
3374
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3377
3375
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
3378
3376
  <!-- difference between the available space and the minimum table width -->
3377
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
3379
3378
  <xsl:variable name="W" select="$page_width - @width_min"/>
3380
3379
  <W><xsl:value-of select="$W"/></W>
3381
3380
  <!-- difference between maximum and minimum width of the table -->
@@ -3539,6 +3538,10 @@
3539
3538
  </xsl:choose>
3540
3539
  </xsl:variable>
3541
3540
 
3541
+ <xsl:variable name="table_fn_block">
3542
+ <xsl:call-template name="table_fn_display"/>
3543
+ </xsl:variable>
3544
+
3542
3545
  <xsl:variable name="tableWithNotesAndFootnotes">
3543
3546
 
3544
3547
  <fo:table keep-with-previous="always">
@@ -3586,11 +3589,25 @@
3586
3589
 
3587
3590
  <xsl:apply-templates select="../*[local-name()='note']"/>
3588
3591
 
3592
+ <xsl:variable name="isDisplayRowSeparator">
3593
+
3594
+ </xsl:variable>
3595
+
3589
3596
  <!-- horizontal row separator -->
3597
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3598
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3599
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3600
+
3601
+ <xsl:call-template name="setBordersTableArray"/>
3602
+ <fo:block font-size="1pt"> </fo:block>
3603
+ </fo:block-container>
3604
+ </xsl:if>
3605
+ </xsl:if>
3590
3606
 
3591
3607
  <!-- fn processing -->
3592
3608
 
3593
- <xsl:call-template name="table_fn_display"/>
3609
+ <!-- <xsl:call-template name="table_fn_display" /> -->
3610
+ <xsl:copy-of select="$table_fn_block"/>
3594
3611
 
3595
3612
  <!-- for PAS display Notes after footnotes -->
3596
3613
 
@@ -3707,6 +3724,28 @@
3707
3724
  </fo:table-row>
3708
3725
  </xsl:template>
3709
3726
 
3727
+ <xsl:template name="setBorderUnderRow">
3728
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
3729
+ <xsl:choose>
3730
+ <xsl:when test="$border_under_row_ != ''">
3731
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3732
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
3733
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
3734
+ <xsl:variable name="border_under_row">
3735
+ <xsl:call-template name="split">
3736
+ <xsl:with-param name="pText" select="$border_under_row_"/>
3737
+ </xsl:call-template>
3738
+ </xsl:variable>
3739
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
3740
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3741
+ </xsl:if>
3742
+ </xsl:when>
3743
+ <xsl:otherwise>
3744
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3745
+ </xsl:otherwise>
3746
+ </xsl:choose>
3747
+ </xsl:template>
3748
+
3710
3749
  <!-- row in table footer (tfoot) -->
3711
3750
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3712
3751
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -3998,17 +4037,20 @@
3998
4037
  <xsl:for-each select="xalan:nodeset($references)//fn">
3999
4038
  <xsl:variable name="reference" select="@reference"/>
4000
4039
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4001
- <fo:block xsl:use-attribute-sets="table-fn-style">
4002
4040
 
4003
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4041
+ <fo:block xsl:use-attribute-sets="table-fn-style">
4004
4042
 
4005
- <xsl:value-of select="@reference"/>
4043
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4044
+
4045
+ <xsl:value-of select="@reference"/>
4046
+
4047
+ </fo:inline>
4048
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4049
+ <xsl:copy-of select="./node()"/>
4050
+ </fo:inline>
4051
+
4052
+ </fo:block>
4006
4053
 
4007
- </fo:inline>
4008
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4009
- <xsl:copy-of select="./node()"/>
4010
- </fo:inline>
4011
- </fo:block>
4012
4054
  </xsl:if>
4013
4055
  </xsl:for-each>
4014
4056
  </xsl:template>
@@ -4037,8 +4079,16 @@
4037
4079
  <!-- figure's footnotes rendering -->
4038
4080
  <xsl:template name="fn_display_figure">
4039
4081
 
4082
+ <!-- current figure id -->
4083
+ <xsl:variable name="figure_id_">
4084
+ <xsl:value-of select="@id"/>
4085
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4086
+ </xsl:variable>
4087
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4088
+
4089
+ <!-- all footnotes relates to the current figure -->
4040
4090
  <xsl:variable name="references">
4041
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
4091
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4042
4092
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4043
4093
  <xsl:apply-templates/>
4044
4094
  </fn>
@@ -4051,91 +4101,93 @@
4051
4101
 
4052
4102
  </xsl:variable>
4053
4103
 
4054
- <!-- current hierarchy is 'figure' element -->
4055
- <xsl:variable name="following_dl_colwidths">
4056
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4057
- <xsl:variable name="simple-table">
4058
- <!-- <xsl:variable name="doc_ns">
4059
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4104
+ <fo:block>
4105
+
4106
+ <!-- current hierarchy is 'figure' element -->
4107
+ <xsl:variable name="following_dl_colwidths">
4108
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4109
+ <xsl:variable name="simple-table">
4110
+ <!-- <xsl:variable name="doc_ns">
4111
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4112
+ </xsl:variable>
4113
+ <xsl:variable name="ns">
4114
+ <xsl:choose>
4115
+ <xsl:when test="normalize-space($doc_ns) != ''">
4116
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4117
+ </xsl:when>
4118
+ <xsl:otherwise>
4119
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4120
+ </xsl:otherwise>
4121
+ </xsl:choose>
4122
+ </xsl:variable> -->
4123
+
4124
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4125
+ <tbody>
4126
+ <xsl:apply-templates mode="dl"/>
4127
+ </tbody>
4128
+ </xsl:for-each>
4129
+ </xsl:variable>
4130
+
4131
+ <xsl:call-template name="calculate-column-widths">
4132
+ <xsl:with-param name="cols-count" select="2"/>
4133
+ <xsl:with-param name="table" select="$simple-table"/>
4134
+ </xsl:call-template>
4135
+
4136
+ </xsl:if>
4060
4137
  </xsl:variable>
4061
- <xsl:variable name="ns">
4138
+
4139
+ <xsl:variable name="maxlength_dt">
4140
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4141
+ <xsl:call-template name="getMaxLength_dt"/>
4142
+ </xsl:for-each>
4143
+ </xsl:variable>
4144
+
4145
+ <fo:table width="95%" table-layout="fixed">
4146
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4147
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4148
+
4149
+ </xsl:if>
4062
4150
  <xsl:choose>
4063
- <xsl:when test="normalize-space($doc_ns) != ''">
4064
- <xsl:value-of select="normalize-space($doc_ns)"/>
4151
+ <!-- if there 'dl', then set same columns width -->
4152
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4153
+ <xsl:call-template name="setColumnWidth_dl">
4154
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4155
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4156
+ </xsl:call-template>
4065
4157
  </xsl:when>
4066
4158
  <xsl:otherwise>
4067
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4159
+ <fo:table-column column-width="5%"/>
4160
+ <fo:table-column column-width="95%"/>
4068
4161
  </xsl:otherwise>
4069
4162
  </xsl:choose>
4070
- </xsl:variable> -->
4071
-
4072
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4073
- <tbody>
4074
- <xsl:apply-templates mode="dl"/>
4075
- </tbody>
4076
- </xsl:for-each>
4077
- </xsl:variable>
4078
-
4079
- <xsl:call-template name="calculate-column-widths">
4080
- <xsl:with-param name="cols-count" select="2"/>
4081
- <xsl:with-param name="table" select="$simple-table"/>
4082
- </xsl:call-template>
4083
-
4084
- </xsl:if>
4085
- </xsl:variable>
4086
-
4087
- <xsl:variable name="maxlength_dt">
4088
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4089
- <xsl:call-template name="getMaxLength_dt"/>
4090
- </xsl:for-each>
4091
- </xsl:variable>
4163
+ <fo:table-body>
4164
+ <xsl:for-each select="xalan:nodeset($references)//fn">
4165
+ <xsl:variable name="reference" select="@reference"/>
4166
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4167
+ <fo:table-row>
4168
+ <fo:table-cell>
4169
+ <fo:block>
4170
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4171
+ <xsl:value-of select="@reference"/>
4172
+ </fo:inline>
4173
+ </fo:block>
4174
+ </fo:table-cell>
4175
+ <fo:table-cell>
4176
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4177
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4092
4178
 
4093
- <fo:block>
4094
- <fo:table width="95%" table-layout="fixed">
4095
- <xsl:if test="normalize-space($key_iso) = 'true'">
4096
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4179
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4097
4180
 
4098
- </xsl:if>
4099
- <xsl:choose>
4100
- <!-- if there 'dl', then set same columns width -->
4101
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4102
- <xsl:call-template name="setColumnWidth_dl">
4103
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4104
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4105
- </xsl:call-template>
4106
- </xsl:when>
4107
- <xsl:otherwise>
4108
- <fo:table-column column-width="15%"/>
4109
- <fo:table-column column-width="85%"/>
4110
- </xsl:otherwise>
4111
- </xsl:choose>
4112
- <fo:table-body>
4113
- <xsl:for-each select="xalan:nodeset($references)//fn">
4114
- <xsl:variable name="reference" select="@reference"/>
4115
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4116
- <fo:table-row>
4117
- <fo:table-cell>
4118
- <fo:block>
4119
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4120
- <xsl:value-of select="@reference"/>
4121
- </fo:inline>
4122
- </fo:block>
4123
- </fo:table-cell>
4124
- <fo:table-cell>
4125
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4126
- <xsl:if test="normalize-space($key_iso) = 'true'">
4127
-
4128
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4181
+ </xsl:if>
4182
+ <xsl:copy-of select="./node()"/>
4183
+ </fo:block>
4184
+ </fo:table-cell>
4185
+ </fo:table-row>
4186
+ </xsl:if>
4187
+ </xsl:for-each>
4188
+ </fo:table-body>
4189
+ </fo:table>
4129
4190
 
4130
- </xsl:if>
4131
- <xsl:copy-of select="./node()"/>
4132
- </fo:block>
4133
- </fo:table-cell>
4134
- </fo:table-row>
4135
- </xsl:if>
4136
- </xsl:for-each>
4137
- </fo:table-body>
4138
- </fo:table>
4139
4191
  </fo:block>
4140
4192
  </xsl:if>
4141
4193
 
@@ -4211,12 +4263,14 @@
4211
4263
 
4212
4264
  <fo:block margin-bottom="12pt" text-align="left">
4213
4265
 
4214
- <xsl:variable name="title-where">
4266
+ <!-- <xsl:variable name="title-where">
4215
4267
  <xsl:call-template name="getLocalizedString">
4216
4268
  <xsl:with-param name="key">where</xsl:with-param>
4217
4269
  </xsl:call-template>
4218
4270
  </xsl:variable>
4219
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4271
+ <xsl:value-of select="$title-where"/> -->
4272
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4273
+ <xsl:text> </xsl:text>
4220
4274
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4221
4275
  <xsl:text/>
4222
4276
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -4226,12 +4280,14 @@
4226
4280
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4227
4281
  <fo:block margin-bottom="12pt" text-align="left">
4228
4282
 
4229
- <xsl:variable name="title-where">
4283
+ <!-- <xsl:variable name="title-where">
4230
4284
  <xsl:call-template name="getLocalizedString">
4231
4285
  <xsl:with-param name="key">where</xsl:with-param>
4232
4286
  </xsl:call-template>
4233
4287
  </xsl:variable>
4234
- <xsl:value-of select="$title-where"/>
4288
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
4289
+ <!-- preceding 'p' with word 'where' -->
4290
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4235
4291
  </fo:block>
4236
4292
  </xsl:when> <!-- END: a few components -->
4237
4293
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -4417,6 +4473,9 @@
4417
4473
 
4418
4474
  </xsl:template> <!-- END: dl -->
4419
4475
 
4476
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4477
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4478
+
4420
4479
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4421
4480
  <xsl:param name="process">false</xsl:param>
4422
4481
  <xsl:if test="$process = 'true'">
@@ -4957,12 +5016,12 @@
4957
5016
  <xsl:param name="value"/>
4958
5017
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4959
5018
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4960
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4961
- <xsl:attribute name="height">5mm</xsl:attribute>
5019
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
5020
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4962
5021
  <xsl:attribute name="content-width">100%</xsl:attribute>
4963
5022
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4964
5023
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4965
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5024
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4966
5025
  <g>
4967
5026
  <xsl:if test="$type = 'closing' or $type = 'end'">
4968
5027
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4976,6 +5035,27 @@
4976
5035
  </xsl:if>
4977
5036
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4978
5037
  </text>
5038
+ </svg> -->
5039
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
5040
+ <g>
5041
+ <xsl:if test="$type = 'closing' or $type = 'end'">
5042
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
5043
+ </xsl:if>
5044
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
5045
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
5046
+ </g>
5047
+ <xsl:variable name="text_x">
5048
+ <xsl:choose>
5049
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
5050
+ <xsl:otherwise>22</xsl:otherwise>
5051
+ </xsl:choose>
5052
+ </xsl:variable>
5053
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
5054
+ <xsl:value-of select="$kind"/>
5055
+ </text>
5056
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
5057
+ <xsl:value-of select="$value"/>
5058
+ </text>
4979
5059
  </svg>
4980
5060
  </fo:instream-foreign-object>
4981
5061
  </xsl:template>
@@ -5230,18 +5310,34 @@
5230
5310
 
5231
5311
  <xsl:template name="add-zero-spaces-java">
5232
5312
  <xsl:param name="text" select="."/>
5233
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
5234
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
5313
+
5314
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
5315
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
5316
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
5317
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
5318
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
5319
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
5235
5320
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
5236
- <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' -->
5321
+ <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' -->
5237
5322
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
5238
- <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' -->
5323
+ <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' -->
5239
5324
  <!-- add zero-width space (#x200B) before character: { -->
5240
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5325
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5241
5326
  <!-- add zero-width space (#x200B) after character: , -->
5242
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5327
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5328
+ <!-- add zero-width space (#x200B) after character: '/' -->
5329
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
5243
5330
 
5244
- <xsl:value-of select="$text5"/>
5331
+ <xsl:variable name="text9">
5332
+ <xsl:choose>
5333
+ <xsl:when test="$isGenerateTableIF = 'true'">
5334
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
5335
+ </xsl:when>
5336
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
5337
+ </xsl:choose>
5338
+ </xsl:variable>
5339
+
5340
+ <xsl:value-of select="$text9"/>
5245
5341
  </xsl:template>
5246
5342
 
5247
5343
  <xsl:template name="add-zero-spaces-link-java">
@@ -5249,8 +5345,10 @@
5249
5345
 
5250
5346
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
5251
5347
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
5252
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5253
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
5348
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
5349
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
5350
+ <!-- remove zero-width space at the end -->
5351
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
5254
5352
  </xsl:template>
5255
5353
 
5256
5354
  <!-- add zero space after dash character (for table's entries) -->
@@ -5387,7 +5485,7 @@
5387
5485
  </xsl:copy>
5388
5486
  </xsl:template>
5389
5487
 
5390
- <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">
5488
+ <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">
5391
5489
  <xsl:copy>
5392
5490
  <xsl:copy-of select="@*"/>
5393
5491
  <p>
@@ -5463,6 +5561,14 @@
5463
5561
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
5464
5562
  </xsl:template>
5465
5563
 
5564
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
5565
+ <xsl:apply-templates mode="table-without-br"/>
5566
+ </xsl:template>
5567
+
5568
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
5569
+ <xsl:apply-templates mode="table-without-br"/>
5570
+ </xsl:template>
5571
+
5466
5572
  <!-- mode="table-without-br" -->
5467
5573
  <!-- ================================== -->
5468
5574
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5595,9 +5701,28 @@
5595
5701
  </xsl:variable>
5596
5702
  <xsl:copy-of select="$newRow"/>
5597
5703
 
5598
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5599
- <xsl:with-param name="previousRow" select="$newRow"/>
5600
- </xsl:apply-templates>
5704
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
5705
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
5706
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
5707
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
5708
+ <xsl:choose>
5709
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
5710
+ <xsl:copy-of select="following-sibling::tr"/>
5711
+ </xsl:when>
5712
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
5713
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
5714
+
5715
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5716
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
5717
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
5718
+ </xsl:apply-templates>
5719
+ </xsl:when> -->
5720
+ <xsl:otherwise>
5721
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
5722
+ <xsl:with-param name="previousRow" select="$newRow"/>
5723
+ </xsl:apply-templates>
5724
+ </xsl:otherwise>
5725
+ </xsl:choose>
5601
5726
  </xsl:template>
5602
5727
  <!-- End mode simple-table-rowspan -->
5603
5728
 
@@ -5760,6 +5885,27 @@
5760
5885
  </xsl:call-template>
5761
5886
  </xsl:template>
5762
5887
 
5888
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
5889
+ <xsl:variable name="link">
5890
+ <link_updated>
5891
+ <xsl:variable name="target_text">
5892
+ <xsl:choose>
5893
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
5894
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
5895
+ </xsl:when>
5896
+ <xsl:otherwise>
5897
+ <xsl:value-of select="normalize-space(@target)"/>
5898
+ </xsl:otherwise>
5899
+ </xsl:choose>
5900
+ </xsl:variable>
5901
+ <xsl:value-of select="$target_text"/>
5902
+ </link_updated>
5903
+ </xsl:variable>
5904
+ <xsl:for-each select="xalan:nodeset($link)/*">
5905
+ <xsl:apply-templates mode="td_text_with_formatting"/>
5906
+ </xsl:for-each>
5907
+ </xsl:template>
5908
+
5763
5909
  <xsl:template name="getFormattingTags">
5764
5910
  <tags>
5765
5911
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -6101,7 +6247,7 @@
6101
6247
  </xsl:variable>
6102
6248
  <fo:inline xsl:use-attribute-sets="link-style">
6103
6249
 
6104
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
6250
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
6105
6251
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6106
6252
  </xsl:if>
6107
6253
 
@@ -6287,7 +6433,7 @@
6287
6433
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
6288
6434
  </xsl:if>
6289
6435
 
6290
- <fo:block-container margin-left="0mm">
6436
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6291
6437
 
6292
6438
  <fo:block>
6293
6439
 
@@ -6468,13 +6614,16 @@
6468
6614
  <!-- show figure's name BEFORE image -->
6469
6615
  <xsl:apply-templates select="*[local-name() = 'name']"/>
6470
6616
 
6617
+ <!-- Example: Dimensions in millimeters -->
6618
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
6619
+
6471
6620
  <fo:block xsl:use-attribute-sets="figure-style">
6472
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6621
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
6473
6622
  </fo:block>
6474
- <xsl:call-template name="fn_display_figure"/>
6475
- <xsl:for-each select="*[local-name() = 'note']">
6623
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
6476
6624
  <xsl:call-template name="note"/>
6477
6625
  </xsl:for-each>
6626
+ <xsl:call-template name="fn_display_figure"/>
6478
6627
 
6479
6628
  </fo:block-container>
6480
6629
  </xsl:template>
@@ -6535,7 +6684,13 @@
6535
6684
  </xsl:choose>
6536
6685
  </xsl:variable>
6537
6686
 
6538
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6687
+ <xsl:variable name="image_width_effective">
6688
+
6689
+ <xsl:value-of select="$width_effective"/>
6690
+
6691
+ </xsl:variable>
6692
+
6693
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6539
6694
  <xsl:if test="number($scale) &lt; 100">
6540
6695
 
6541
6696
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -6727,24 +6882,47 @@
6727
6882
 
6728
6883
  </xsl:when>
6729
6884
  <xsl:otherwise>
6730
- <fo:block xsl:use-attribute-sets="image-style">
6731
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6732
- <xsl:attribute name="width">100%</xsl:attribute>
6733
- <xsl:attribute name="content-height">100%</xsl:attribute>
6734
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6735
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6736
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6737
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6738
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6739
- <!-- effective height / width = 1.48, 1.4 - with title -->
6740
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6741
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6742
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6743
- </xsl:if>
6744
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6745
- <xsl:copy-of select="$svg_content"/>
6746
- </fo:instream-foreign-object>
6747
- </fo:block>
6885
+
6886
+ <xsl:variable name="element">
6887
+ <xsl:choose>
6888
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6889
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6890
+ </xsl:when>
6891
+ <xsl:otherwise>
6892
+ <fo:block xsl:use-attribute-sets="image-style">
6893
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6894
+ <xsl:attribute name="text-align">left</xsl:attribute>
6895
+ </xsl:if>
6896
+ </fo:block>
6897
+ </xsl:otherwise>
6898
+ </xsl:choose>
6899
+ </xsl:variable>
6900
+
6901
+ <xsl:for-each select="xalan:nodeset($element)/*">
6902
+ <xsl:copy>
6903
+ <xsl:copy-of select="@*"/>
6904
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6905
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6906
+ <xsl:if test="$isGenerateTableIF = 'false'">
6907
+ <xsl:attribute name="width">100%</xsl:attribute>
6908
+ </xsl:if>
6909
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6910
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6911
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6912
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6913
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6914
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6915
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6916
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6917
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6918
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6919
+ </xsl:if>
6920
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6921
+ <xsl:copy-of select="$svg_content"/>
6922
+ </fo:instream-foreign-object>
6923
+ <!-- </fo:block> -->
6924
+ </xsl:copy>
6925
+ </xsl:for-each>
6748
6926
  </xsl:otherwise>
6749
6927
  </xsl:choose>
6750
6928
  </xsl:template>
@@ -6836,6 +7014,13 @@
6836
7014
  </xsl:for-each>
6837
7015
  </xsl:template>
6838
7016
 
7017
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
7018
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7019
+ <xsl:for-each select="*[local-name() = 'svg']">
7020
+ <xsl:call-template name="image_svg"/>
7021
+ </xsl:for-each>
7022
+ </xsl:template>
7023
+
6839
7024
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6840
7025
  <xsl:variable name="svg_content" select="document(@src)"/>
6841
7026
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6974,6 +7159,8 @@
6974
7159
  <xsl:value-of select="."/>
6975
7160
  </xsl:template>
6976
7161
 
7162
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
7163
+
6977
7164
  <xsl:template match="node()" mode="contents">
6978
7165
  <xsl:apply-templates mode="contents"/>
6979
7166
  </xsl:template>
@@ -7090,6 +7277,13 @@
7090
7277
  <xsl:when test="$contents_nodes/doc">
7091
7278
  <xsl:choose>
7092
7279
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
7280
+
7281
+ <xsl:if test="$contents_nodes/collection">
7282
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
7283
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
7284
+ </fo:bookmark>
7285
+ </xsl:if>
7286
+
7093
7287
  <xsl:for-each select="$contents_nodes/doc">
7094
7288
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7095
7289
  <xsl:if test="@bundle = 'true'">
@@ -7281,7 +7475,15 @@
7281
7475
  <xsl:value-of select="@section"/>
7282
7476
  <xsl:text> </xsl:text>
7283
7477
  </xsl:if>
7284
- <xsl:value-of select="normalize-space(title)"/>
7478
+ <xsl:variable name="title">
7479
+ <xsl:for-each select="title/node()">
7480
+ <xsl:choose>
7481
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
7482
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7483
+ </xsl:choose>
7484
+ </xsl:for-each>
7485
+ </xsl:variable>
7486
+ <xsl:value-of select="normalize-space($title)"/>
7285
7487
  </fo:bookmark-title>
7286
7488
  <xsl:apply-templates mode="bookmark"/>
7287
7489
  </fo:bookmark>
@@ -7307,6 +7509,12 @@
7307
7509
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
7308
7510
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
7309
7511
 
7512
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
7513
+ <fo:block text-align="right" keep-with-next="always">
7514
+ <xsl:apply-templates/>
7515
+ </fo:block>
7516
+ </xsl:template>
7517
+
7310
7518
  <!-- ====== -->
7311
7519
  <!-- ====== -->
7312
7520
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -7456,6 +7664,10 @@
7456
7664
  </xsl:for-each>
7457
7665
  </xsl:template>
7458
7666
 
7667
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
7668
+ <xsl:value-of select="."/>
7669
+ </xsl:template>
7670
+
7459
7671
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
7460
7672
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
7461
7673
  <xsl:apply-templates mode="contents_item"/>
@@ -8971,6 +9183,44 @@
8971
9183
 
8972
9184
  <fo:list-block xsl:use-attribute-sets="list-style">
8973
9185
 
9186
+ <xsl:variable name="provisional_distance_between_starts_">
9187
+ <attributes xsl:use-attribute-sets="list-style">
9188
+
9189
+ </attributes>
9190
+ </xsl:variable>
9191
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
9192
+ <xsl:if test="$provisional_distance_between_starts != ''">
9193
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
9194
+ </xsl:if>
9195
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
9196
+
9197
+ <!-- increase provisional-distance-between-starts for long lists -->
9198
+ <xsl:if test="local-name() = 'ol'">
9199
+ <!-- Examples: xiii), xviii), xxviii) -->
9200
+ <xsl:variable name="item_numbers">
9201
+ <xsl:for-each select="*[local-name() = 'li']">
9202
+ <item><xsl:call-template name="getListItemFormat"/></item>
9203
+ </xsl:for-each>
9204
+ </xsl:variable>
9205
+
9206
+ <xsl:variable name="max_length">
9207
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
9208
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
9209
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
9210
+ </xsl:for-each>
9211
+ </xsl:variable>
9212
+
9213
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
9214
+ <xsl:variable name="addon" select="$max_length - 4"/>
9215
+ <xsl:if test="$addon &gt; 0">
9216
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
9217
+ </xsl:if>
9218
+ <!-- DEBUG -->
9219
+ <!-- <xsl:copy-of select="$item_numbers"/>
9220
+ <max_length><xsl:value-of select="$max_length"/></max_length>
9221
+ <addon><xsl:value-of select="$addon"/></addon> -->
9222
+ </xsl:if>
9223
+
8974
9224
  <xsl:if test="*[local-name() = 'name']">
8975
9225
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8976
9226
  </xsl:if>
@@ -9920,7 +10170,7 @@
9920
10170
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9921
10171
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9922
10172
  <!-- add &lt; and &gt; to \S -->
9923
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
10173
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
9924
10174
  <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>
9925
10175
  <xsl:variable name="text3">
9926
10176
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -9942,7 +10192,8 @@
9942
10192
  <xsl:choose>
9943
10193
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
9944
10194
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9945
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
10195
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
10196
+ <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>
9946
10197
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
9947
10198
  <xsl:choose>
9948
10199
  <xsl:when test="self::text()">
@@ -10545,6 +10796,23 @@
10545
10796
  </xsl:if>
10546
10797
  </xsl:template>
10547
10798
 
10799
+ <xsl:template name="setBlockAttributes">
10800
+ <xsl:param name="text_align_default">left</xsl:param>
10801
+ <xsl:call-template name="setTextAlignment">
10802
+ <xsl:with-param name="default" select="$text_align_default"/>
10803
+ </xsl:call-template>
10804
+
10805
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
10806
+ <!-- Example: keep-lines-together="true" -->
10807
+ <xsl:if test="@keep-lines-together = 'true'">
10808
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
10809
+ </xsl:if>
10810
+ <!-- Example: keep-with-next="true" -->
10811
+ <xsl:if test="@keep-with-next = 'true'">
10812
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10813
+ </xsl:if>
10814
+ </xsl:template>
10815
+
10548
10816
  <xsl:template name="number-to-words">
10549
10817
  <xsl:param name="number"/>
10550
10818
  <xsl:param name="first"/>