metanorma-iec 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1935,14 +1935,41 @@
1935
1935
  </xsl:copy>
1936
1936
  </xsl:template> -->
1937
1937
 
1938
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
1938
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
1939
+ <xsl:for-each select="$table_widths_from_if//table">
1940
+ <xsl:copy>
1941
+ <xsl:copy-of select="@*"/>
1942
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
1943
+ </xsl:copy>
1944
+ </xsl:for-each>
1945
+ </xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
1939
1946
  false
1940
1947
  </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
1941
1948
  <xsl:call-template name="getLang"/>
1942
- </xsl:variable><xsl:variable name="pageWidth_">
1943
- 210
1949
+ </xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
1950
+ <xsl:choose>
1951
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
1952
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
1953
+ </xsl:choose>
1954
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
1955
+ <xsl:choose>
1956
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
1957
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
1958
+ </xsl:choose>
1959
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
1960
+ <xsl:choose>
1961
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
1962
+ <xsl:otherwise>
1963
+ 210
1964
+ </xsl:otherwise>
1965
+ </xsl:choose>
1944
1966
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1945
- 297
1967
+ <xsl:choose>
1968
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
1969
+ <xsl:otherwise>
1970
+ 297
1971
+ </xsl:otherwise>
1972
+ </xsl:choose>
1946
1973
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1947
1974
  25
1948
1975
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -2549,6 +2576,25 @@
2549
2576
 
2550
2577
 
2551
2578
 
2579
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
2580
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2581
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2582
+
2583
+
2584
+
2585
+
2586
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2587
+
2588
+
2589
+
2590
+
2591
+
2592
+
2593
+
2594
+
2595
+
2596
+
2597
+
2552
2598
  </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
2553
2599
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
2554
2600
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
@@ -2873,6 +2919,24 @@
2873
2919
 
2874
2920
 
2875
2921
 
2922
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
2923
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2924
+
2925
+
2926
+
2927
+
2928
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2929
+
2930
+
2931
+
2932
+
2933
+
2934
+
2935
+
2936
+
2937
+
2938
+
2939
+
2876
2940
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2877
2941
 
2878
2942
 
@@ -3281,13 +3345,13 @@
3281
3345
 
3282
3346
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
3283
3347
  <xsl:variable name="nodes_preface_">
3284
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3348
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3285
3349
  <node id="{@id}"/>
3286
3350
  </xsl:for-each>
3287
3351
  </xsl:variable>
3288
3352
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3289
3353
 
3290
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3354
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3291
3355
  <xsl:sort select="@displayorder" data-type="number"/>
3292
3356
 
3293
3357
  <!-- process Section's title -->
@@ -3353,7 +3417,7 @@
3353
3417
  </xsl:for-each>
3354
3418
  </figures>
3355
3419
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3356
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3420
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3357
3421
  <xsl:sort select="@displayorder" data-type="number"/>
3358
3422
  <xsl:apply-templates select="."/>
3359
3423
  </xsl:for-each>
@@ -3971,8 +4035,9 @@
3971
4035
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3972
4036
  </xsl:if>
3973
4037
  </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
3974
- <xsl:param name="table"/>
3975
- <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
4038
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
4039
+
4040
+ <!-- via intermediate format -->
3976
4041
 
3977
4042
  <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
3978
4043
 
@@ -3983,9 +4048,8 @@
3983
4048
  <!-- get current table id -->
3984
4049
  <xsl:variable name="table_id" select="@id"/>
3985
4050
  <!-- find table by id in the file 'table_widths' -->
3986
- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
3987
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
3988
-
4051
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
4052
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
3989
4053
 
3990
4054
  <!-- table='<xsl:copy-of select="$table"/>' -->
3991
4055
  <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
@@ -3993,24 +4057,13 @@
3993
4057
  <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
3994
4058
 
3995
4059
  <xsl:variable name="table_with_cell_widths_">
3996
- <xsl:choose>
3997
- <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
3998
-
3999
- <!-- Example: <column>10</column>
4000
- <column>11</column>
4001
- -->
4002
- <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
4003
- </xsl:when>
4004
- <xsl:otherwise>
4005
- <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
4006
- </xsl:otherwise>
4007
- </xsl:choose>
4060
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
4008
4061
  </xsl:variable>
4009
4062
  <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
4010
4063
 
4011
- <xsl:if test="$table_if_debug = 'true'">
4064
+ <!-- <xsl:if test="$table_if_debug = 'true'">
4012
4065
  <xsl:copy-of select="$table_with_cell_widths"/>
4013
- </xsl:if>
4066
+ </xsl:if> -->
4014
4067
 
4015
4068
 
4016
4069
  <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
@@ -4056,8 +4109,12 @@
4056
4109
 
4057
4110
  <xsl:variable name="page_width">
4058
4111
  <xsl:choose>
4059
- <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
4060
- <xsl:otherwise>75</xsl:otherwise>
4112
+ <xsl:when test="$parent_table_page-width != ''">
4113
+ <xsl:value-of select="$parent_table_page-width"/>
4114
+ </xsl:when>
4115
+ <xsl:otherwise>
4116
+ <xsl:value-of select="@page-width"/>
4117
+ </xsl:otherwise>
4061
4118
  </xsl:choose>
4062
4119
  </xsl:variable>
4063
4120
 
@@ -4065,9 +4122,6 @@
4065
4122
  <table_width>
4066
4123
  <xsl:copy-of select="$table_widths"/>
4067
4124
  </table_width>
4068
- <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
4069
- <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
4070
- -->
4071
4125
  <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
4072
4126
  </xsl:if>
4073
4127
 
@@ -4078,11 +4132,11 @@
4078
4132
  <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
4079
4133
  <!-- call old algorithm -->
4080
4134
  <case1/>
4081
- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
4135
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
4082
4136
  <xsl:call-template name="calculate-column-widths-proportional">
4083
4137
  <xsl:with-param name="cols-count" select="$cols-count"/>
4084
4138
  <xsl:with-param name="table" select="$table"/>
4085
- </xsl:call-template>
4139
+ </xsl:call-template> -->
4086
4140
  </xsl:when>
4087
4141
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
4088
4142
  <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
@@ -4126,95 +4180,49 @@
4126
4180
  <xsl:otherwise><unknown_case/></xsl:otherwise>
4127
4181
  </xsl:choose>
4128
4182
 
4183
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
4129
4184
 
4130
- </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
4131
- <xsl:copy>
4132
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
4133
- </xsl:copy>
4134
- </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
4135
- <xsl:copy>
4136
- <xsl:copy-of select="@*"/>
4185
+ <!-- if nested 'dl' or 'table' -->
4186
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
4187
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
4137
4188
 
4138
- <!-- The maximum width is given by the widest line. -->
4139
- <xsl:variable name="widths_max">
4140
- <xsl:for-each select=".//*[local-name() = 'p']">
4141
- <xsl:call-template name="add_width"/>
4142
- </xsl:for-each>
4143
- <xsl:if test="not(*[local-name() = 'p'])">
4144
- <xsl:call-template name="add_width"/>
4145
- </xsl:if>
4146
- </xsl:variable>
4147
- <xsl:variable name="width_max">
4148
- <xsl:for-each select="xalan:nodeset($widths_max)//width">
4149
- <xsl:sort select="." data-type="number" order="descending"/>
4150
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4151
- </xsl:for-each>
4152
- </xsl:variable>
4153
- <xsl:attribute name="width_max">
4154
- <xsl:value-of select="$width_max"/>
4155
- </xsl:attribute>
4189
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
4156
4190
 
4157
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
4158
- <!-- To do: image width -->
4159
- <xsl:variable name="td_text">
4160
- <xsl:apply-templates select="." mode="td_text"/>
4161
- </xsl:variable>
4162
- <xsl:variable name="words">
4163
- <xsl:variable name="string_with_added_zerospaces">
4164
- <xsl:call-template name="add-zero-spaces-java">
4165
- <xsl:with-param name="text" select="$td_text"/>
4166
- </xsl:call-template>
4191
+ <xsl:variable name="parent_table_page-width_">
4192
+ <xsl:if test="$parent_table_id != ''">
4193
+ <!-- determine column number in the parent table -->
4194
+ <xsl:variable name="parent_table_column_number">
4195
+ <xsl:choose>
4196
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
4197
+ <xsl:otherwise> <!-- parent is table -->
4198
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
4199
+ </xsl:otherwise>
4200
+ </xsl:choose>
4167
4201
  </xsl:variable>
4168
- <xsl:call-template name="tokenize">
4169
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4170
- </xsl:call-template>
4171
- </xsl:variable>
4172
-
4173
- <xsl:variable name="max_word_length">
4174
- <xsl:call-template name="max_length">
4175
- <xsl:with-param name="words" select="xalan:nodeset($words)"/>
4176
- </xsl:call-template>
4177
- </xsl:variable>
4178
- <xsl:variable name="width_min">
4179
- <xsl:value-of select="$max_word_length"/>
4180
- </xsl:variable>
4181
- <xsl:attribute name="width_min">
4182
- <xsl:value-of select="$width_min"/>
4183
- </xsl:attribute>
4184
- <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
4185
- <xsl:if test="$width_min &gt; $width_max">
4186
- <xsl:attribute name="width_max">
4187
- <xsl:value-of select="$width_min"/>
4188
- </xsl:attribute>
4189
- </xsl:if>
4190
- <xsl:if test="$width_min = 0">
4191
- <xsl:attribute name="width_min">1</xsl:attribute>
4202
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
4203
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
4192
4204
  </xsl:if>
4193
-
4194
- <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
4195
-
4196
- </xsl:copy>
4197
- </xsl:template><xsl:template name="add_width">
4198
- <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
4199
- <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
4200
-
4201
- <xsl:variable name="p_text_len">
4202
- <xsl:choose>
4203
- <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
4204
- <xsl:value-of select="$p_text_len_ * 1.5"/>
4205
- </xsl:when>
4206
- <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
4207
- </xsl:choose>
4208
4205
  </xsl:variable>
4206
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
4209
4207
 
4210
- <xsl:variable name="math_addon_text">
4211
- <xsl:for-each select=".//*[local-name() = 'math']">
4212
- <xsl:apply-templates mode="td_text"/>
4213
- </xsl:for-each>
4214
- </xsl:variable>
4215
- <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
4208
+ <!-- get current table id -->
4209
+ <xsl:variable name="table_id" select="@id"/>
4210
+
4211
+ <xsl:choose>
4212
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
4213
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
4214
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
4215
+ </xsl:when>
4216
+ <xsl:otherwise>
4217
+ <!-- recalculate columns width based on parent table width -->
4218
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
4219
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
4220
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
4221
+ </xsl:call-template>
4222
+ </xsl:for-each>
4223
+ </xsl:otherwise>
4224
+ </xsl:choose>
4216
4225
 
4217
- <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
4218
4226
  </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
4219
4227
  <xsl:copy>
4220
4228
  <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
@@ -5030,11 +5038,19 @@
5030
5038
 
5031
5039
 
5032
5040
 
5041
+
5042
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
5043
+ <xsl:attribute name="margin-top">0</xsl:attribute>
5044
+ </xsl:if>
5045
+
5033
5046
  <fo:block>
5034
5047
 
5035
5048
 
5036
5049
 
5037
5050
 
5051
+ <xsl:apply-templates select="*[local-name() = 'name']">
5052
+ <xsl:with-param name="process">true</xsl:with-param>
5053
+ </xsl:apply-templates>
5038
5054
 
5039
5055
  <xsl:if test="$isGenerateTableIF = 'true'">
5040
5056
  <!-- to determine start of table -->
@@ -5059,6 +5075,7 @@
5059
5075
  </xsl:choose>
5060
5076
 
5061
5077
 
5078
+
5062
5079
  <xsl:choose>
5063
5080
  <xsl:when test="$isGenerateTableIF = 'true'">
5064
5081
  <!-- generate IF for table widths -->
@@ -5187,6 +5204,18 @@
5187
5204
  </xsl:if> <!-- END: a few components -->
5188
5205
  </fo:block-container>
5189
5206
  </fo:block-container>
5207
+
5208
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
5209
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
5210
+ </xsl:if>
5211
+
5212
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5213
+ <xsl:param name="process">false</xsl:param>
5214
+ <xsl:if test="$process = 'true'">
5215
+ <fo:block xsl:use-attribute-sets="dl-name-style">
5216
+ <xsl:apply-templates/>
5217
+ </fo:block>
5218
+ </xsl:if>
5190
5219
  </xsl:template><xsl:template name="setColumnWidth_dl">
5191
5220
  <xsl:param name="colwidths"/>
5192
5221
  <xsl:param name="maxlength_dt"/>
@@ -5195,6 +5224,11 @@
5195
5224
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5196
5225
 
5197
5226
  <xsl:choose>
5227
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5228
+ <xsl:call-template name="insertTableColumnWidth">
5229
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5230
+ </xsl:call-template>
5231
+ </xsl:when>
5198
5232
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
5199
5233
  <fo:table-column column-width="50%"/>
5200
5234
  <fo:table-column column-width="50%"/>
@@ -5447,12 +5481,24 @@
5447
5481
  </td>
5448
5482
  <td>
5449
5483
 
5450
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
5484
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5485
+
5486
+ <!-- get paragraphs from nested 'dl' -->
5487
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5488
+
5451
5489
 
5452
5490
  </td>
5453
5491
  </tr>
5454
5492
 
5455
- </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
5493
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5494
+ <xsl:for-each select="*[local-name() = 'dt']">
5495
+ <p>
5496
+ <xsl:copy-of select="node()"/>
5497
+ <xsl:text> </xsl:text>
5498
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
5499
+ </p>
5500
+ </xsl:for-each>
5501
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
5456
5502
  <fo:inline font-style="italic">
5457
5503
  <xsl:apply-templates/>
5458
5504
  </fo:inline>
@@ -5483,7 +5529,7 @@
5483
5529
 
5484
5530
  10
5485
5531
 
5486
-
5532
+ <!-- 10 -->
5487
5533
 
5488
5534
 
5489
5535
 
@@ -7518,7 +7564,7 @@
7518
7564
 
7519
7565
  9
7520
7566
 
7521
-
7567
+ <!-- 9 -->
7522
7568
 
7523
7569
 
7524
7570
 
@@ -7602,7 +7648,7 @@
7602
7648
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
7603
7649
  <xsl:choose>
7604
7650
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
7605
- <xsl:call-template name="interspers">
7651
+ <xsl:call-template name="interspers-java">
7606
7652
  <xsl:with-param name="str" select="."/>
7607
7653
  </xsl:call-template>
7608
7654
  </xsl:when>
@@ -7652,6 +7698,10 @@
7652
7698
  <xsl:with-param name="char" select="$char"/>
7653
7699
  </xsl:call-template>
7654
7700
  </xsl:if>
7701
+ </xsl:template><xsl:template name="interspers-java">
7702
+ <xsl:param name="str"/>
7703
+ <xsl:param name="char" select="$zero_width_space"/>
7704
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
7655
7705
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
7656
7706
  <xsl:apply-templates mode="syntax_highlight"/>
7657
7707
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -8609,6 +8659,11 @@
8609
8659
  </xsl:otherwise>
8610
8660
  </xsl:choose>
8611
8661
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8662
+
8663
+ <xsl:apply-templates select="*[local-name() = 'name']">
8664
+ <xsl:with-param name="process">true</xsl:with-param>
8665
+ </xsl:apply-templates>
8666
+
8612
8667
  <fo:list-block xsl:use-attribute-sets="list-style">
8613
8668
 
8614
8669
 
@@ -8626,12 +8681,23 @@
8626
8681
 
8627
8682
 
8628
8683
 
8684
+ <xsl:if test="*[local-name() = 'name']">
8685
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8686
+ </xsl:if>
8687
+
8629
8688
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
8630
8689
  </fo:list-block>
8631
8690
  <!-- <xsl:for-each select="./iho:note">
8632
8691
  <xsl:call-template name="note"/>
8633
8692
  </xsl:for-each> -->
8634
8693
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8694
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8695
+ <xsl:param name="process">false</xsl:param>
8696
+ <xsl:if test="$process = 'true'">
8697
+ <fo:block xsl:use-attribute-sets="list-name-style">
8698
+ <xsl:apply-templates/>
8699
+ </fo:block>
8700
+ </xsl:if>
8635
8701
  </xsl:template><xsl:template match="*[local-name()='li']">
8636
8702
  <fo:list-item xsl:use-attribute-sets="list-item-style">
8637
8703
  <xsl:copy-of select="@id"/>
@@ -8940,26 +9006,23 @@
8940
9006
  <xsl:if test=".//*[local-name() = 'fn']">
8941
9007
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8942
9008
  </xsl:if>
9009
+
9010
+ <!-- display document identifier, not number [1] -->
8943
9011
  <xsl:variable name="docidentifier">
8944
9012
  <xsl:choose>
8945
9013
  <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
8946
9014
  <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8947
9015
  </xsl:choose>
8948
9016
  </xsl:variable>
8949
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
9017
+ <xsl:value-of select="$docidentifier"/>
9018
+
8950
9019
  <xsl:apply-templates select="*[local-name() = 'note']"/>
8951
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
8952
- <xsl:choose>
8953
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
8954
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
8955
- </xsl:when>
8956
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
8957
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
8958
- </xsl:when>
8959
- <xsl:otherwise>
8960
- <xsl:apply-templates select="*[local-name() = 'title']"/>
8961
- </xsl:otherwise>
8962
- </xsl:choose>
9020
+
9021
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
9022
+ <xsl:text>,</xsl:text>
9023
+ <xsl:text> </xsl:text>
9024
+ </xsl:if>
9025
+
8963
9026
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8964
9027
  <!-- end bibitem processing -->
8965
9028
 
@@ -9271,8 +9334,9 @@
9271
9334
 
9272
9335
  <fo:block text-align="justify">
9273
9336
  <fo:inline>
9274
- <xsl:call-template name="displayAdmonitionName"/>
9275
- <xsl:text> – </xsl:text>
9337
+ <xsl:call-template name="displayAdmonitionName">
9338
+ <xsl:with-param name="sep"> – </xsl:with-param>
9339
+ </xsl:call-template>
9276
9340
  </fo:inline>
9277
9341
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9278
9342
  </fo:block>
@@ -9282,25 +9346,32 @@
9282
9346
  </fo:block-container>
9283
9347
 
9284
9348
  </xsl:template><xsl:template name="displayAdmonitionName">
9285
-
9349
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
9350
+ <!-- <xsl:choose>
9351
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9352
+ <xsl:choose>
9353
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
9354
+ <xsl:otherwise>
9355
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9356
+ </xsl:otherwise>
9357
+ </xsl:choose>
9358
+ </xsl:when>
9359
+ <xsl:otherwise>
9286
9360
  <xsl:apply-templates select="*[local-name() = 'name']"/>
9287
9361
  <xsl:if test="not(*[local-name() = 'name'])">
9288
9362
  <xsl:apply-templates select="@type"/>
9289
9363
  </xsl:if>
9290
-
9291
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9292
- <xsl:apply-templates/>
9293
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
9294
- <xsl:variable name="admonition_type_">
9295
- <xsl:call-template name="getLocalizedString">
9296
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
9297
- </xsl:call-template>
9364
+ </xsl:otherwise>
9365
+ </xsl:choose> -->
9366
+ <xsl:variable name="name">
9367
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9298
9368
  </xsl:variable>
9299
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
9300
- <xsl:value-of select="$admonition_type"/>
9301
- <xsl:if test="$admonition_type = ''">
9302
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
9369
+ <xsl:copy-of select="$name"/>
9370
+ <xsl:if test="normalize-space($name) != ''">
9371
+ <xsl:value-of select="$sep"/>
9303
9372
  </xsl:if>
9373
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9374
+ <xsl:apply-templates/>
9304
9375
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
9305
9376
  <!-- processing for admonition/p found in the template for 'p' -->
9306
9377
  <xsl:call-template name="paragraph"/>
@@ -37,18 +37,20 @@ module IsoDoc
37
37
  .call(elem)
38
38
  end
39
39
 
40
- DICT_PATHS = { doctype_dict: "./ext/doctype", stage_dict: "./status/stage",
40
+ DICT_PATHS = { doctype_dict: "./ext/doctype",
41
41
  substage_dict: "./status/substage",
42
42
  function_dict: "./ext/function",
43
43
  horizontal_dict: "./ext/horizontal" }.freeze
44
44
 
45
45
  def bibdata_i18n(bib)
46
- fr = IsoDoc::Iec::I18n.new("fr", "Latn")
47
- en = IsoDoc::Iec::I18n.new("en", "Latn")
48
- [{ lang: "en", i18n: en }, { lang: "fr", i18n: fr }].each do |v|
46
+ [{ lang: "en", i18n: IsoDoc::Iec::I18n.new("en", "Latn") },
47
+ { lang: "fr", i18n: IsoDoc::Iec::I18n.new("fr", "Latn") }].each do |v|
49
48
  DICT_PATHS.each do |lbl, xpath|
50
49
  hash_translate(bib, v[:i18n].get[lbl.to_s], xpath, v[:lang])
51
50
  end
51
+ bibdata_i18n_stage(bib, bib.at(ns("./status/stage")),
52
+ bib.at(ns("./ext/doctype")),
53
+ lang: v[:lang], i18n: v[:i18n])
52
54
  end
53
55
  end
54
56
 
@@ -113,7 +113,7 @@ module IsoDoc
113
113
  ret = super
114
114
  css_class =
115
115
  cell.name == "th" || header ? "TABLE-col-heading" : "TABLE-cell"
116
- ret.merge("class": css_class)
116
+ ret.merge(class: css_class)
117
117
  end
118
118
 
119
119
  def tr_parse(node, out, ord, totalrows, header)