metanorma-bipm 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -167,7 +167,7 @@
167
167
  <xsl:template name="generateContents">
168
168
  <contents>
169
169
 
170
- <xsl:apply-templates select="/*/bipm:preface/*[position() &gt; 1]" mode="contents"/>
170
+ <xsl:apply-templates select="/*/bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() &gt; 1]" mode="contents"/>
171
171
 
172
172
  <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
173
173
  <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
@@ -631,7 +631,7 @@
631
631
  </xsl:template>
632
632
 
633
633
 
634
- <xsl:template match="bipm:note" name="change_note_kind" mode="flatxml">
634
+ <xsl:template match="bipm:note[not(parent::bipm:preface)]" name="change_note_kind" mode="flatxml">
635
635
  <xsl:variable name="element">
636
636
  <xsl:choose>
637
637
  <xsl:when test="ancestor::bipm:quote">note</xsl:when>
@@ -1020,17 +1020,17 @@
1020
1020
  </fo:page-sequence>
1021
1021
 
1022
1022
 
1023
- <xsl:if test="bipm:preface/*">
1023
+ <xsl:if test="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1024
1024
  <fo:page-sequence master-reference="document" force-page-count="no-force">
1025
1025
  <xsl:call-template name="insertFootnoteSeparator"/>
1026
1026
 
1027
1027
  <xsl:variable name="header-title">
1028
1028
  <xsl:choose>
1029
- <xsl:when test="bipm:preface/*[1]/bipm:title[1]/*[local-name() = 'tab']">
1030
- <xsl:apply-templates select="bipm:preface/*[1]/bipm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
1029
+ <xsl:when test="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]/*[local-name() = 'tab']">
1030
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
1031
1031
  </xsl:when>
1032
1032
  <xsl:otherwise>
1033
- <xsl:apply-templates select="bipm:preface/*[1]/bipm:title[1]" mode="header"/>
1033
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]" mode="header"/>
1034
1034
  </xsl:otherwise>
1035
1035
  </xsl:choose>
1036
1036
  </xsl:variable>
@@ -1040,7 +1040,7 @@
1040
1040
 
1041
1041
  <fo:flow flow-name="xsl-region-body">
1042
1042
  <fo:block line-height="135%">
1043
- <xsl:apply-templates select="bipm:preface/*[1]"/>
1043
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]"/>
1044
1044
  </fo:block>
1045
1045
  </fo:flow>
1046
1046
  </fo:page-sequence>
@@ -1139,7 +1139,7 @@
1139
1139
  </fo:page-sequence>
1140
1140
 
1141
1141
 
1142
- <xsl:apply-templates select="bipm:preface/*[position() &gt; 1]" mode="sections"/> <!-- bipm:clause -->
1142
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() &gt; 1]" mode="sections"/> <!-- bipm:clause -->
1143
1143
 
1144
1144
 
1145
1145
 
@@ -1304,7 +1304,7 @@
1304
1304
  </fo:page-sequence>
1305
1305
 
1306
1306
 
1307
- <xsl:apply-templates select="bipm:preface/*" mode="sections"/>
1307
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]" mode="sections"/>
1308
1308
 
1309
1309
  <!-- Document Pages -->
1310
1310
  <xsl:apply-templates select="bipm:sections/*" mode="sections"/>
@@ -2280,7 +2280,7 @@
2280
2280
  <!-- ====== -->
2281
2281
 
2282
2282
 
2283
- <xsl:template match="bipm:preface/*[1]" priority="3">
2283
+ <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
2284
2284
  <fo:table table-layout="fixed" width="173.5mm">
2285
2285
  <xsl:call-template name="setId"/>
2286
2286
  <fo:table-column column-width="137mm"/>
@@ -2371,7 +2371,7 @@
2371
2371
  </xsl:template>
2372
2372
 
2373
2373
 
2374
- <xsl:template match="bipm:preface/*[1]/*" mode="clause_table">
2374
+ <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/*" mode="clause_table">
2375
2375
  <xsl:param name="rows"/>
2376
2376
 
2377
2377
  <xsl:variable name="current_row"><xsl:number count="*"/></xsl:variable>
@@ -2403,7 +2403,7 @@
2403
2403
  <xsl:variable name="end_row" select="$current_row + $number-rows-spanned"/>
2404
2404
  <fo:block>
2405
2405
 
2406
- <xsl:for-each select="ancestor::bipm:preface/*[1]/*[position() &gt;= $start_row and position() &lt; $end_row]//bipm:note_side">
2406
+ <xsl:for-each select="ancestor::bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/*[position() &gt;= $start_row and position() &lt; $end_row]//bipm:note_side">
2407
2407
  <xsl:apply-templates select="." mode="note_side"/>
2408
2408
  </xsl:for-each>
2409
2409
  </fo:block>
@@ -2663,7 +2663,7 @@
2663
2663
 
2664
2664
 
2665
2665
  <!-- skip, because it process in note_side template -->
2666
- <xsl:template match="bipm:preface/*[1]//bipm:note_side" priority="3"/>
2666
+ <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]//bipm:note_side" priority="3"/>
2667
2667
 
2668
2668
 
2669
2669
  <xsl:template match="bipm:sections//bipm:note_side | bipm:annex//bipm:note_side" priority="3">
@@ -3813,14 +3813,41 @@
3813
3813
  </xsl:template>
3814
3814
 
3815
3815
 
3816
- <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_">
3816
+ <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_">
3817
+ <xsl:for-each select="$table_widths_from_if//table">
3818
+ <xsl:copy>
3819
+ <xsl:copy-of select="@*"/>
3820
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
3821
+ </xsl:copy>
3822
+ </xsl:for-each>
3823
+ </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_">
3817
3824
  false
3818
3825
  </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
3819
3826
  <xsl:call-template name="getLang"/>
3820
- </xsl:variable><xsl:variable name="pageWidth_">
3821
- 210
3827
+ </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_">
3828
+ <xsl:choose>
3829
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
3830
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
3831
+ </xsl:choose>
3832
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
3833
+ <xsl:choose>
3834
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
3835
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
3836
+ </xsl:choose>
3837
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
3838
+ <xsl:choose>
3839
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
3840
+ <xsl:otherwise>
3841
+ 210
3842
+ </xsl:otherwise>
3843
+ </xsl:choose>
3822
3844
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
3823
- 297
3845
+ <xsl:choose>
3846
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
3847
+ <xsl:otherwise>
3848
+ 297
3849
+ </xsl:otherwise>
3850
+ </xsl:choose>
3824
3851
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
3825
3852
  31.7
3826
3853
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -4415,6 +4442,25 @@
4415
4442
 
4416
4443
 
4417
4444
 
4445
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
4446
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4447
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4448
+
4449
+
4450
+
4451
+
4452
+
4453
+
4454
+
4455
+
4456
+
4457
+
4458
+
4459
+
4460
+
4461
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4462
+
4463
+
4418
4464
  </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
4419
4465
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
4420
4466
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
@@ -4704,6 +4750,24 @@
4704
4750
 
4705
4751
 
4706
4752
 
4753
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
4754
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4755
+
4756
+
4757
+
4758
+
4759
+
4760
+
4761
+
4762
+
4763
+
4764
+
4765
+
4766
+
4767
+
4768
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4769
+
4770
+
4707
4771
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
4708
4772
 
4709
4773
 
@@ -5124,13 +5188,13 @@
5124
5188
 
5125
5189
  </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">
5126
5190
  <xsl:variable name="nodes_preface_">
5127
- <xsl:for-each select="/*/*[local-name()='preface']/*">
5191
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
5128
5192
  <node id="{@id}"/>
5129
5193
  </xsl:for-each>
5130
5194
  </xsl:variable>
5131
5195
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
5132
5196
 
5133
- <xsl:for-each select="/*/*[local-name()='preface']/*">
5197
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
5134
5198
  <xsl:sort select="@displayorder" data-type="number"/>
5135
5199
 
5136
5200
  <!-- process Section's title -->
@@ -5196,7 +5260,7 @@
5196
5260
  </xsl:for-each>
5197
5261
  </figures>
5198
5262
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5199
- <xsl:for-each select="/*/*[local-name()='preface']/*">
5263
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
5200
5264
  <xsl:sort select="@displayorder" data-type="number"/>
5201
5265
  <xsl:apply-templates select="."/>
5202
5266
  </xsl:for-each>
@@ -5833,8 +5897,9 @@
5833
5897
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
5834
5898
  </xsl:if>
5835
5899
  </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
5836
- <xsl:param name="table"/>
5837
- <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
5900
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
5901
+
5902
+ <!-- via intermediate format -->
5838
5903
 
5839
5904
  <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
5840
5905
 
@@ -5845,9 +5910,8 @@
5845
5910
  <!-- get current table id -->
5846
5911
  <xsl:variable name="table_id" select="@id"/>
5847
5912
  <!-- find table by id in the file 'table_widths' -->
5848
- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
5849
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
5850
-
5913
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
5914
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
5851
5915
 
5852
5916
  <!-- table='<xsl:copy-of select="$table"/>' -->
5853
5917
  <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
@@ -5855,24 +5919,13 @@
5855
5919
  <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
5856
5920
 
5857
5921
  <xsl:variable name="table_with_cell_widths_">
5858
- <xsl:choose>
5859
- <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
5860
-
5861
- <!-- Example: <column>10</column>
5862
- <column>11</column>
5863
- -->
5864
- <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
5865
- </xsl:when>
5866
- <xsl:otherwise>
5867
- <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
5868
- </xsl:otherwise>
5869
- </xsl:choose>
5922
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
5870
5923
  </xsl:variable>
5871
5924
  <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
5872
5925
 
5873
- <xsl:if test="$table_if_debug = 'true'">
5926
+ <!-- <xsl:if test="$table_if_debug = 'true'">
5874
5927
  <xsl:copy-of select="$table_with_cell_widths"/>
5875
- </xsl:if>
5928
+ </xsl:if> -->
5876
5929
 
5877
5930
 
5878
5931
  <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
@@ -5918,8 +5971,12 @@
5918
5971
 
5919
5972
  <xsl:variable name="page_width">
5920
5973
  <xsl:choose>
5921
- <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
5922
- <xsl:otherwise>75</xsl:otherwise>
5974
+ <xsl:when test="$parent_table_page-width != ''">
5975
+ <xsl:value-of select="$parent_table_page-width"/>
5976
+ </xsl:when>
5977
+ <xsl:otherwise>
5978
+ <xsl:value-of select="@page-width"/>
5979
+ </xsl:otherwise>
5923
5980
  </xsl:choose>
5924
5981
  </xsl:variable>
5925
5982
 
@@ -5927,9 +5984,6 @@
5927
5984
  <table_width>
5928
5985
  <xsl:copy-of select="$table_widths"/>
5929
5986
  </table_width>
5930
- <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
5931
- <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
5932
- -->
5933
5987
  <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
5934
5988
  </xsl:if>
5935
5989
 
@@ -5940,11 +5994,11 @@
5940
5994
  <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
5941
5995
  <!-- call old algorithm -->
5942
5996
  <case1/>
5943
- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
5997
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
5944
5998
  <xsl:call-template name="calculate-column-widths-proportional">
5945
5999
  <xsl:with-param name="cols-count" select="$cols-count"/>
5946
6000
  <xsl:with-param name="table" select="$table"/>
5947
- </xsl:call-template>
6001
+ </xsl:call-template> -->
5948
6002
  </xsl:when>
5949
6003
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
5950
6004
  <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
@@ -5988,95 +6042,49 @@
5988
6042
  <xsl:otherwise><unknown_case/></xsl:otherwise>
5989
6043
  </xsl:choose>
5990
6044
 
6045
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
5991
6046
 
5992
- </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
5993
- <xsl:copy>
5994
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
5995
- </xsl:copy>
5996
- </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
5997
- <xsl:copy>
5998
- <xsl:copy-of select="@*"/>
6047
+ <!-- if nested 'dl' or 'table' -->
6048
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
6049
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
5999
6050
 
6000
- <!-- The maximum width is given by the widest line. -->
6001
- <xsl:variable name="widths_max">
6002
- <xsl:for-each select=".//*[local-name() = 'p']">
6003
- <xsl:call-template name="add_width"/>
6004
- </xsl:for-each>
6005
- <xsl:if test="not(*[local-name() = 'p'])">
6006
- <xsl:call-template name="add_width"/>
6007
- </xsl:if>
6008
- </xsl:variable>
6009
- <xsl:variable name="width_max">
6010
- <xsl:for-each select="xalan:nodeset($widths_max)//width">
6011
- <xsl:sort select="." data-type="number" order="descending"/>
6012
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
6013
- </xsl:for-each>
6014
- </xsl:variable>
6015
- <xsl:attribute name="width_max">
6016
- <xsl:value-of select="$width_max"/>
6017
- </xsl:attribute>
6051
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
6018
6052
 
6019
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
6020
- <!-- To do: image width -->
6021
- <xsl:variable name="td_text">
6022
- <xsl:apply-templates select="." mode="td_text"/>
6023
- </xsl:variable>
6024
- <xsl:variable name="words">
6025
- <xsl:variable name="string_with_added_zerospaces">
6026
- <xsl:call-template name="add-zero-spaces-java">
6027
- <xsl:with-param name="text" select="$td_text"/>
6028
- </xsl:call-template>
6053
+ <xsl:variable name="parent_table_page-width_">
6054
+ <xsl:if test="$parent_table_id != ''">
6055
+ <!-- determine column number in the parent table -->
6056
+ <xsl:variable name="parent_table_column_number">
6057
+ <xsl:choose>
6058
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
6059
+ <xsl:otherwise> <!-- parent is table -->
6060
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
6061
+ </xsl:otherwise>
6062
+ </xsl:choose>
6029
6063
  </xsl:variable>
6030
- <xsl:call-template name="tokenize">
6031
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
6032
- </xsl:call-template>
6033
- </xsl:variable>
6034
-
6035
- <xsl:variable name="max_word_length">
6036
- <xsl:call-template name="max_length">
6037
- <xsl:with-param name="words" select="xalan:nodeset($words)"/>
6038
- </xsl:call-template>
6039
- </xsl:variable>
6040
- <xsl:variable name="width_min">
6041
- <xsl:value-of select="$max_word_length"/>
6042
- </xsl:variable>
6043
- <xsl:attribute name="width_min">
6044
- <xsl:value-of select="$width_min"/>
6045
- </xsl:attribute>
6046
- <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
6047
- <xsl:if test="$width_min &gt; $width_max">
6048
- <xsl:attribute name="width_max">
6049
- <xsl:value-of select="$width_min"/>
6050
- </xsl:attribute>
6051
- </xsl:if>
6052
- <xsl:if test="$width_min = 0">
6053
- <xsl:attribute name="width_min">1</xsl:attribute>
6064
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
6065
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
6054
6066
  </xsl:if>
6055
-
6056
- <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
6057
-
6058
- </xsl:copy>
6059
- </xsl:template><xsl:template name="add_width">
6060
- <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
6061
- <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
6062
-
6063
- <xsl:variable name="p_text_len">
6064
- <xsl:choose>
6065
- <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
6066
- <xsl:value-of select="$p_text_len_ * 1.5"/>
6067
- </xsl:when>
6068
- <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
6069
- </xsl:choose>
6070
6067
  </xsl:variable>
6068
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
6071
6069
 
6072
- <xsl:variable name="math_addon_text">
6073
- <xsl:for-each select=".//*[local-name() = 'math']">
6074
- <xsl:apply-templates mode="td_text"/>
6075
- </xsl:for-each>
6076
- </xsl:variable>
6077
- <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
6070
+ <!-- get current table id -->
6071
+ <xsl:variable name="table_id" select="@id"/>
6072
+
6073
+ <xsl:choose>
6074
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
6075
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
6076
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
6077
+ </xsl:when>
6078
+ <xsl:otherwise>
6079
+ <!-- recalculate columns width based on parent table width -->
6080
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
6081
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
6082
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
6083
+ </xsl:call-template>
6084
+ </xsl:for-each>
6085
+ </xsl:otherwise>
6086
+ </xsl:choose>
6078
6087
 
6079
- <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
6080
6088
  </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
6081
6089
  <xsl:copy>
6082
6090
  <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
@@ -6924,11 +6932,19 @@
6924
6932
 
6925
6933
 
6926
6934
 
6935
+
6936
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
6937
+ <xsl:attribute name="margin-top">0</xsl:attribute>
6938
+ </xsl:if>
6939
+
6927
6940
  <fo:block>
6928
6941
 
6929
6942
 
6930
6943
 
6931
6944
 
6945
+ <xsl:apply-templates select="*[local-name() = 'name']">
6946
+ <xsl:with-param name="process">true</xsl:with-param>
6947
+ </xsl:apply-templates>
6932
6948
 
6933
6949
  <xsl:if test="$isGenerateTableIF = 'true'">
6934
6950
  <!-- to determine start of table -->
@@ -6951,6 +6967,7 @@
6951
6967
  </xsl:choose>
6952
6968
 
6953
6969
 
6970
+
6954
6971
  <xsl:choose>
6955
6972
  <xsl:when test="$isGenerateTableIF = 'true'">
6956
6973
  <!-- generate IF for table widths -->
@@ -7079,6 +7096,18 @@
7079
7096
  </xsl:if> <!-- END: a few components -->
7080
7097
  </fo:block-container>
7081
7098
  </fo:block-container>
7099
+
7100
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
7101
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
7102
+ </xsl:if>
7103
+
7104
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
7105
+ <xsl:param name="process">false</xsl:param>
7106
+ <xsl:if test="$process = 'true'">
7107
+ <fo:block xsl:use-attribute-sets="dl-name-style">
7108
+ <xsl:apply-templates/>
7109
+ </fo:block>
7110
+ </xsl:if>
7082
7111
  </xsl:template><xsl:template name="setColumnWidth_dl">
7083
7112
  <xsl:param name="colwidths"/>
7084
7113
  <xsl:param name="maxlength_dt"/>
@@ -7087,6 +7116,11 @@
7087
7116
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
7088
7117
 
7089
7118
  <xsl:choose>
7119
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
7120
+ <xsl:call-template name="insertTableColumnWidth">
7121
+ <xsl:with-param name="colwidths" select="$colwidths"/>
7122
+ </xsl:call-template>
7123
+ </xsl:when>
7090
7124
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
7091
7125
  <fo:table-column column-width="50%"/>
7092
7126
  <fo:table-column column-width="50%"/>
@@ -7339,12 +7373,24 @@
7339
7373
  </td>
7340
7374
  <td>
7341
7375
 
7342
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
7376
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
7377
+
7378
+ <!-- get paragraphs from nested 'dl' -->
7379
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7380
+
7343
7381
 
7344
7382
  </td>
7345
7383
  </tr>
7346
7384
 
7347
- </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
7385
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
7386
+ <xsl:for-each select="*[local-name() = 'dt']">
7387
+ <p>
7388
+ <xsl:copy-of select="node()"/>
7389
+ <xsl:text> </xsl:text>
7390
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
7391
+ </p>
7392
+ </xsl:for-each>
7393
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
7348
7394
  <fo:inline font-style="italic">
7349
7395
  <xsl:apply-templates/>
7350
7396
  </fo:inline>
@@ -7375,7 +7421,7 @@
7375
7421
 
7376
7422
 
7377
7423
 
7378
-
7424
+ <!-- 10 -->
7379
7425
 
7380
7426
 
7381
7427
 
@@ -9464,7 +9510,7 @@
9464
9510
 
9465
9511
 
9466
9512
 
9467
-
9513
+ <!-- 9 -->
9468
9514
 
9469
9515
 
9470
9516
 
@@ -9548,7 +9594,7 @@
9548
9594
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
9549
9595
  <xsl:choose>
9550
9596
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
9551
- <xsl:call-template name="interspers">
9597
+ <xsl:call-template name="interspers-java">
9552
9598
  <xsl:with-param name="str" select="."/>
9553
9599
  </xsl:call-template>
9554
9600
  </xsl:when>
@@ -9598,6 +9644,10 @@
9598
9644
  <xsl:with-param name="char" select="$char"/>
9599
9645
  </xsl:call-template>
9600
9646
  </xsl:if>
9647
+ </xsl:template><xsl:template name="interspers-java">
9648
+ <xsl:param name="str"/>
9649
+ <xsl:param name="char" select="$zero_width_space"/>
9650
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
9601
9651
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
9602
9652
  <xsl:apply-templates mode="syntax_highlight"/>
9603
9653
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -10556,6 +10606,11 @@
10556
10606
  </xsl:otherwise>
10557
10607
  </xsl:choose>
10558
10608
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
10609
+
10610
+ <xsl:apply-templates select="*[local-name() = 'name']">
10611
+ <xsl:with-param name="process">true</xsl:with-param>
10612
+ </xsl:apply-templates>
10613
+
10559
10614
  <fo:list-block xsl:use-attribute-sets="list-style">
10560
10615
 
10561
10616
 
@@ -10566,12 +10621,23 @@
10566
10621
 
10567
10622
 
10568
10623
 
10624
+ <xsl:if test="*[local-name() = 'name']">
10625
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10626
+ </xsl:if>
10627
+
10569
10628
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
10570
10629
  </fo:list-block>
10571
10630
  <!-- <xsl:for-each select="./iho:note">
10572
10631
  <xsl:call-template name="note"/>
10573
10632
  </xsl:for-each> -->
10574
10633
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
10634
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
10635
+ <xsl:param name="process">false</xsl:param>
10636
+ <xsl:if test="$process = 'true'">
10637
+ <fo:block xsl:use-attribute-sets="list-name-style">
10638
+ <xsl:apply-templates/>
10639
+ </fo:block>
10640
+ </xsl:if>
10575
10641
  </xsl:template><xsl:template match="*[local-name()='li']">
10576
10642
  <fo:list-item xsl:use-attribute-sets="list-item-style">
10577
10643
  <xsl:copy-of select="@id"/>
@@ -10843,6 +10909,7 @@
10843
10909
  </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
10844
10910
 
10845
10911
 
10912
+ <!-- start BIPM bibitem processing -->
10846
10913
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
10847
10914
  <fo:list-item>
10848
10915
  <fo:list-item-label end-indent="label-end()">
@@ -10869,6 +10936,7 @@
10869
10936
  </fo:list-item-body>
10870
10937
  </fo:list-item>
10871
10938
  </fo:list-block>
10939
+ <!-- END BIPM bibitem processing -->
10872
10940
 
10873
10941
 
10874
10942
  </xsl:template><xsl:template name="processBibitem">
@@ -10878,32 +10946,12 @@
10878
10946
  <xsl:if test=".//bipm:fn">
10879
10947
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
10880
10948
  </xsl:if>
10881
- <xsl:choose>
10882
- <xsl:when test="*[local-name() = 'formattedref']">
10883
- <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
10884
- </xsl:when>
10885
- <xsl:otherwise>
10886
- <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
10887
-
10888
- <xsl:value-of select="$docidentifier"/>
10889
- <xsl:if test="$docidentifier != '' and *[local-name() = 'title']">, </xsl:if>
10890
-
10891
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
10892
-
10893
- <xsl:choose>
10894
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $curr_lang]">
10895
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $curr_lang]"/>
10896
- </xsl:when>
10897
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
10898
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
10899
- </xsl:when>
10900
- <xsl:otherwise>
10901
- <xsl:apply-templates select="*[local-name() = 'title']"/>
10902
- </xsl:otherwise>
10903
- </xsl:choose>
10904
-
10905
- </xsl:otherwise>
10906
- </xsl:choose>
10949
+
10950
+ <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
10951
+ <xsl:value-of select="$docidentifier"/>
10952
+
10953
+ <xsl:if test="$docidentifier != '' and *[local-name() = 'formattedref']">, </xsl:if>
10954
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
10907
10955
  <!-- end BIPM bibitem processing-->
10908
10956
 
10909
10957
  </xsl:template><xsl:template name="processBibitemDocId">
@@ -11231,25 +11279,32 @@
11231
11279
  </fo:block-container>
11232
11280
 
11233
11281
  </xsl:template><xsl:template name="displayAdmonitionName">
11234
-
11282
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
11283
+ <!-- <xsl:choose>
11284
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
11285
+ <xsl:choose>
11286
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
11287
+ <xsl:otherwise>
11288
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
11289
+ </xsl:otherwise>
11290
+ </xsl:choose>
11291
+ </xsl:when>
11292
+ <xsl:otherwise>
11235
11293
  <xsl:apply-templates select="*[local-name() = 'name']"/>
11236
11294
  <xsl:if test="not(*[local-name() = 'name'])">
11237
11295
  <xsl:apply-templates select="@type"/>
11238
11296
  </xsl:if>
11239
-
11240
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
11241
- <xsl:apply-templates/>
11242
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
11243
- <xsl:variable name="admonition_type_">
11244
- <xsl:call-template name="getLocalizedString">
11245
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
11246
- </xsl:call-template>
11297
+ </xsl:otherwise>
11298
+ </xsl:choose> -->
11299
+ <xsl:variable name="name">
11300
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
11247
11301
  </xsl:variable>
11248
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
11249
- <xsl:value-of select="$admonition_type"/>
11250
- <xsl:if test="$admonition_type = ''">
11251
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
11302
+ <xsl:copy-of select="$name"/>
11303
+ <xsl:if test="normalize-space($name) != ''">
11304
+ <xsl:value-of select="$sep"/>
11252
11305
  </xsl:if>
11306
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
11307
+ <xsl:apply-templates/>
11253
11308
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
11254
11309
 
11255
11310
  <fo:block xsl:use-attribute-sets="admonition-p-style">