metanorma-bipm 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -682,6 +682,12 @@ pre {
682
682
  font-size: 1em;
683
683
  text-align: center; }
684
684
 
685
+ .ListTitle {
686
+ font-weight: 700;
687
+ font-size: 1em;
688
+ text-align: center;
689
+ text-align: left; }
690
+
685
691
  .FigureTitle,
686
692
  .SourceTitle {
687
693
  font-weight: 700;
@@ -355,6 +355,7 @@ pre {
355
355
 
356
356
  @include admonitionBlock();
357
357
  @include recommendationBlock();
358
+ @include listBlock();
358
359
 
359
360
  .FigureTitle,
360
361
  .SourceTitle {
@@ -440,7 +440,7 @@
440
440
  </xsl:for-each>
441
441
  <xsl:for-each select="//*[contains(local-name(), '-standard')]">
442
442
  <fo:block break-after="page"/>
443
- <xsl:apply-templates select="./*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
443
+ <xsl:apply-templates select="./*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
444
444
  </xsl:for-each>
445
445
  <xsl:for-each select="//*[contains(local-name(), '-standard')]">
446
446
  <fo:block break-after="page"/>
@@ -1724,14 +1724,41 @@
1724
1724
  </fo:block-container>
1725
1725
  </xsl:template>
1726
1726
 
1727
- <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_">
1727
+ <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_">
1728
+ <xsl:for-each select="$table_widths_from_if//table">
1729
+ <xsl:copy>
1730
+ <xsl:copy-of select="@*"/>
1731
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
1732
+ </xsl:copy>
1733
+ </xsl:for-each>
1734
+ </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_">
1728
1735
  false
1729
1736
  </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
1730
1737
  <xsl:call-template name="getLang"/>
1731
- </xsl:variable><xsl:variable name="pageWidth_">
1732
- 210
1738
+ </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_">
1739
+ <xsl:choose>
1740
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
1741
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
1742
+ </xsl:choose>
1743
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
1744
+ <xsl:choose>
1745
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
1746
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
1747
+ </xsl:choose>
1748
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
1749
+ <xsl:choose>
1750
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
1751
+ <xsl:otherwise>
1752
+ 210
1753
+ </xsl:otherwise>
1754
+ </xsl:choose>
1733
1755
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1734
- 297
1756
+ <xsl:choose>
1757
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
1758
+ <xsl:otherwise>
1759
+ 297
1760
+ </xsl:otherwise>
1761
+ </xsl:choose>
1735
1762
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1736
1763
  25
1737
1764
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -2323,6 +2350,25 @@
2323
2350
 
2324
2351
 
2325
2352
 
2353
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
2354
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2355
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2356
+
2357
+
2358
+
2359
+
2360
+
2361
+
2362
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2363
+
2364
+
2365
+
2366
+
2367
+
2368
+
2369
+
2370
+
2371
+
2326
2372
  </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
2327
2373
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
2328
2374
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
@@ -2654,6 +2700,25 @@
2654
2700
 
2655
2701
 
2656
2702
 
2703
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
2704
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2705
+
2706
+
2707
+
2708
+
2709
+
2710
+
2711
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2712
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+
2719
+
2720
+
2721
+
2657
2722
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2658
2723
 
2659
2724
 
@@ -3050,13 +3115,13 @@
3050
3115
 
3051
3116
  </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">
3052
3117
  <xsl:variable name="nodes_preface_">
3053
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3118
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3054
3119
  <node id="{@id}"/>
3055
3120
  </xsl:for-each>
3056
3121
  </xsl:variable>
3057
3122
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3058
3123
 
3059
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3124
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3060
3125
  <xsl:sort select="@displayorder" data-type="number"/>
3061
3126
 
3062
3127
  <!-- process Section's title -->
@@ -3122,7 +3187,7 @@
3122
3187
  </xsl:for-each>
3123
3188
  </figures>
3124
3189
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3125
- <xsl:for-each select="/*/*[local-name()='preface']/*">
3190
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3126
3191
  <xsl:sort select="@displayorder" data-type="number"/>
3127
3192
  <xsl:apply-templates select="."/>
3128
3193
  </xsl:for-each>
@@ -3729,8 +3794,9 @@
3729
3794
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3730
3795
  </xsl:if>
3731
3796
  </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
3732
- <xsl:param name="table"/>
3733
- <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
3797
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
3798
+
3799
+ <!-- via intermediate format -->
3734
3800
 
3735
3801
  <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
3736
3802
 
@@ -3741,9 +3807,8 @@
3741
3807
  <!-- get current table id -->
3742
3808
  <xsl:variable name="table_id" select="@id"/>
3743
3809
  <!-- find table by id in the file 'table_widths' -->
3744
- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
3745
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
3746
-
3810
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
3811
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
3747
3812
 
3748
3813
  <!-- table='<xsl:copy-of select="$table"/>' -->
3749
3814
  <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
@@ -3751,24 +3816,13 @@
3751
3816
  <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
3752
3817
 
3753
3818
  <xsl:variable name="table_with_cell_widths_">
3754
- <xsl:choose>
3755
- <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
3756
-
3757
- <!-- Example: <column>10</column>
3758
- <column>11</column>
3759
- -->
3760
- <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
3761
- </xsl:when>
3762
- <xsl:otherwise>
3763
- <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
3764
- </xsl:otherwise>
3765
- </xsl:choose>
3819
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
3766
3820
  </xsl:variable>
3767
3821
  <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
3768
3822
 
3769
- <xsl:if test="$table_if_debug = 'true'">
3823
+ <!-- <xsl:if test="$table_if_debug = 'true'">
3770
3824
  <xsl:copy-of select="$table_with_cell_widths"/>
3771
- </xsl:if>
3825
+ </xsl:if> -->
3772
3826
 
3773
3827
 
3774
3828
  <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
@@ -3814,8 +3868,12 @@
3814
3868
 
3815
3869
  <xsl:variable name="page_width">
3816
3870
  <xsl:choose>
3817
- <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
3818
- <xsl:otherwise>75</xsl:otherwise>
3871
+ <xsl:when test="$parent_table_page-width != ''">
3872
+ <xsl:value-of select="$parent_table_page-width"/>
3873
+ </xsl:when>
3874
+ <xsl:otherwise>
3875
+ <xsl:value-of select="@page-width"/>
3876
+ </xsl:otherwise>
3819
3877
  </xsl:choose>
3820
3878
  </xsl:variable>
3821
3879
 
@@ -3823,9 +3881,6 @@
3823
3881
  <table_width>
3824
3882
  <xsl:copy-of select="$table_widths"/>
3825
3883
  </table_width>
3826
- <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
3827
- <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
3828
- -->
3829
3884
  <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
3830
3885
  </xsl:if>
3831
3886
 
@@ -3836,11 +3891,11 @@
3836
3891
  <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
3837
3892
  <!-- call old algorithm -->
3838
3893
  <case1/>
3839
- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
3894
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
3840
3895
  <xsl:call-template name="calculate-column-widths-proportional">
3841
3896
  <xsl:with-param name="cols-count" select="$cols-count"/>
3842
3897
  <xsl:with-param name="table" select="$table"/>
3843
- </xsl:call-template>
3898
+ </xsl:call-template> -->
3844
3899
  </xsl:when>
3845
3900
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
3846
3901
  <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
@@ -3884,95 +3939,49 @@
3884
3939
  <xsl:otherwise><unknown_case/></xsl:otherwise>
3885
3940
  </xsl:choose>
3886
3941
 
3942
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
3887
3943
 
3888
- </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
3889
- <xsl:copy>
3890
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
3891
- </xsl:copy>
3892
- </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
3893
- <xsl:copy>
3894
- <xsl:copy-of select="@*"/>
3944
+ <!-- if nested 'dl' or 'table' -->
3945
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
3946
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
3895
3947
 
3896
- <!-- The maximum width is given by the widest line. -->
3897
- <xsl:variable name="widths_max">
3898
- <xsl:for-each select=".//*[local-name() = 'p']">
3899
- <xsl:call-template name="add_width"/>
3900
- </xsl:for-each>
3901
- <xsl:if test="not(*[local-name() = 'p'])">
3902
- <xsl:call-template name="add_width"/>
3903
- </xsl:if>
3904
- </xsl:variable>
3905
- <xsl:variable name="width_max">
3906
- <xsl:for-each select="xalan:nodeset($widths_max)//width">
3907
- <xsl:sort select="." data-type="number" order="descending"/>
3908
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3909
- </xsl:for-each>
3910
- </xsl:variable>
3911
- <xsl:attribute name="width_max">
3912
- <xsl:value-of select="$width_max"/>
3913
- </xsl:attribute>
3948
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
3914
3949
 
3915
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3916
- <!-- To do: image width -->
3917
- <xsl:variable name="td_text">
3918
- <xsl:apply-templates select="." mode="td_text"/>
3919
- </xsl:variable>
3920
- <xsl:variable name="words">
3921
- <xsl:variable name="string_with_added_zerospaces">
3922
- <xsl:call-template name="add-zero-spaces-java">
3923
- <xsl:with-param name="text" select="$td_text"/>
3924
- </xsl:call-template>
3950
+ <xsl:variable name="parent_table_page-width_">
3951
+ <xsl:if test="$parent_table_id != ''">
3952
+ <!-- determine column number in the parent table -->
3953
+ <xsl:variable name="parent_table_column_number">
3954
+ <xsl:choose>
3955
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
3956
+ <xsl:otherwise> <!-- parent is table -->
3957
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
3958
+ </xsl:otherwise>
3959
+ </xsl:choose>
3925
3960
  </xsl:variable>
3926
- <xsl:call-template name="tokenize">
3927
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3928
- </xsl:call-template>
3929
- </xsl:variable>
3930
-
3931
- <xsl:variable name="max_word_length">
3932
- <xsl:call-template name="max_length">
3933
- <xsl:with-param name="words" select="xalan:nodeset($words)"/>
3934
- </xsl:call-template>
3935
- </xsl:variable>
3936
- <xsl:variable name="width_min">
3937
- <xsl:value-of select="$max_word_length"/>
3938
- </xsl:variable>
3939
- <xsl:attribute name="width_min">
3940
- <xsl:value-of select="$width_min"/>
3941
- </xsl:attribute>
3942
- <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
3943
- <xsl:if test="$width_min &gt; $width_max">
3944
- <xsl:attribute name="width_max">
3945
- <xsl:value-of select="$width_min"/>
3946
- </xsl:attribute>
3961
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3962
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3947
3963
  </xsl:if>
3948
- <xsl:if test="$width_min = 0">
3949
- <xsl:attribute name="width_min">1</xsl:attribute>
3950
- </xsl:if>
3951
-
3952
- <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
3953
-
3954
- </xsl:copy>
3955
- </xsl:template><xsl:template name="add_width">
3956
- <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
3957
- <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
3958
-
3959
- <xsl:variable name="p_text_len">
3960
- <xsl:choose>
3961
- <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
3962
- <xsl:value-of select="$p_text_len_ * 1.5"/>
3963
- </xsl:when>
3964
- <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
3965
- </xsl:choose>
3966
3964
  </xsl:variable>
3965
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3967
3966
 
3968
- <xsl:variable name="math_addon_text">
3969
- <xsl:for-each select=".//*[local-name() = 'math']">
3970
- <xsl:apply-templates mode="td_text"/>
3971
- </xsl:for-each>
3972
- </xsl:variable>
3973
- <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
3967
+ <!-- get current table id -->
3968
+ <xsl:variable name="table_id" select="@id"/>
3969
+
3970
+ <xsl:choose>
3971
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
3972
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
3973
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
3974
+ </xsl:when>
3975
+ <xsl:otherwise>
3976
+ <!-- recalculate columns width based on parent table width -->
3977
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
3978
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
3979
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
3980
+ </xsl:call-template>
3981
+ </xsl:for-each>
3982
+ </xsl:otherwise>
3983
+ </xsl:choose>
3974
3984
 
3975
- <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
3976
3985
  </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
3977
3986
  <xsl:copy>
3978
3987
  <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
@@ -4845,11 +4854,19 @@
4845
4854
 
4846
4855
 
4847
4856
 
4857
+
4858
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4859
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4860
+ </xsl:if>
4861
+
4848
4862
  <fo:block>
4849
4863
 
4850
4864
 
4851
4865
 
4852
4866
 
4867
+ <xsl:apply-templates select="*[local-name() = 'name']">
4868
+ <xsl:with-param name="process">true</xsl:with-param>
4869
+ </xsl:apply-templates>
4853
4870
 
4854
4871
  <xsl:if test="$isGenerateTableIF = 'true'">
4855
4872
  <!-- to determine start of table -->
@@ -4872,6 +4889,7 @@
4872
4889
  </xsl:choose>
4873
4890
 
4874
4891
 
4892
+
4875
4893
  <xsl:choose>
4876
4894
  <xsl:when test="$isGenerateTableIF = 'true'">
4877
4895
  <!-- generate IF for table widths -->
@@ -5000,6 +5018,18 @@
5000
5018
  </xsl:if> <!-- END: a few components -->
5001
5019
  </fo:block-container>
5002
5020
  </fo:block-container>
5021
+
5022
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
5023
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
5024
+ </xsl:if>
5025
+
5026
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5027
+ <xsl:param name="process">false</xsl:param>
5028
+ <xsl:if test="$process = 'true'">
5029
+ <fo:block xsl:use-attribute-sets="dl-name-style">
5030
+ <xsl:apply-templates/>
5031
+ </fo:block>
5032
+ </xsl:if>
5003
5033
  </xsl:template><xsl:template name="setColumnWidth_dl">
5004
5034
  <xsl:param name="colwidths"/>
5005
5035
  <xsl:param name="maxlength_dt"/>
@@ -5008,6 +5038,11 @@
5008
5038
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5009
5039
 
5010
5040
  <xsl:choose>
5041
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5042
+ <xsl:call-template name="insertTableColumnWidth">
5043
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5044
+ </xsl:call-template>
5045
+ </xsl:when>
5011
5046
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
5012
5047
  <fo:table-column column-width="50%"/>
5013
5048
  <fo:table-column column-width="50%"/>
@@ -5260,12 +5295,24 @@
5260
5295
  </td>
5261
5296
  <td>
5262
5297
 
5263
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
5298
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5299
+
5300
+ <!-- get paragraphs from nested 'dl' -->
5301
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5302
+
5264
5303
 
5265
5304
  </td>
5266
5305
  </tr>
5267
5306
 
5268
- </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
5307
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5308
+ <xsl:for-each select="*[local-name() = 'dt']">
5309
+ <p>
5310
+ <xsl:copy-of select="node()"/>
5311
+ <xsl:text> </xsl:text>
5312
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
5313
+ </p>
5314
+ </xsl:for-each>
5315
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
5269
5316
  <fo:inline font-style="italic">
5270
5317
  <xsl:apply-templates/>
5271
5318
  </fo:inline>
@@ -5296,7 +5343,7 @@
5296
5343
 
5297
5344
 
5298
5345
 
5299
-
5346
+ <!-- 10 -->
5300
5347
 
5301
5348
  10
5302
5349
 
@@ -7325,7 +7372,7 @@
7325
7372
 
7326
7373
 
7327
7374
 
7328
-
7375
+ <!-- 9 -->
7329
7376
 
7330
7377
  9
7331
7378
 
@@ -7409,7 +7456,7 @@
7409
7456
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
7410
7457
  <xsl:choose>
7411
7458
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
7412
- <xsl:call-template name="interspers">
7459
+ <xsl:call-template name="interspers-java">
7413
7460
  <xsl:with-param name="str" select="."/>
7414
7461
  </xsl:call-template>
7415
7462
  </xsl:when>
@@ -7459,6 +7506,10 @@
7459
7506
  <xsl:with-param name="char" select="$char"/>
7460
7507
  </xsl:call-template>
7461
7508
  </xsl:if>
7509
+ </xsl:template><xsl:template name="interspers-java">
7510
+ <xsl:param name="str"/>
7511
+ <xsl:param name="char" select="$zero_width_space"/>
7512
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
7462
7513
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
7463
7514
  <xsl:apply-templates mode="syntax_highlight"/>
7464
7515
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -8428,6 +8479,11 @@
8428
8479
  </xsl:otherwise>
8429
8480
  </xsl:choose>
8430
8481
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8482
+
8483
+ <xsl:apply-templates select="*[local-name() = 'name']">
8484
+ <xsl:with-param name="process">true</xsl:with-param>
8485
+ </xsl:apply-templates>
8486
+
8431
8487
  <fo:list-block xsl:use-attribute-sets="list-style">
8432
8488
 
8433
8489
 
@@ -8438,12 +8494,23 @@
8438
8494
 
8439
8495
 
8440
8496
 
8497
+ <xsl:if test="*[local-name() = 'name']">
8498
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8499
+ </xsl:if>
8500
+
8441
8501
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
8442
8502
  </fo:list-block>
8443
8503
  <!-- <xsl:for-each select="./iho:note">
8444
8504
  <xsl:call-template name="note"/>
8445
8505
  </xsl:for-each> -->
8446
8506
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8507
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8508
+ <xsl:param name="process">false</xsl:param>
8509
+ <xsl:if test="$process = 'true'">
8510
+ <fo:block xsl:use-attribute-sets="list-name-style">
8511
+ <xsl:apply-templates/>
8512
+ </fo:block>
8513
+ </xsl:if>
8447
8514
  </xsl:template><xsl:template match="*[local-name()='li']">
8448
8515
  <fo:list-item xsl:use-attribute-sets="list-item-style">
8449
8516
  <xsl:copy-of select="@id"/>
@@ -8747,32 +8814,14 @@
8747
8814
  <xsl:variable name="docidentifier">
8748
8815
  <xsl:choose>
8749
8816
  <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
8750
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8817
+ <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal') and not(@type = 'BIPM')]"/></xsl:otherwise>
8751
8818
  </xsl:choose>
8752
8819
  </xsl:variable>
8753
8820
  <xsl:value-of select="$docidentifier"/>
8754
8821
 
8755
- <xsl:choose>
8756
- <xsl:when test="*[local-name()='formattedref']">
8757
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
8758
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
8759
- </xsl:when>
8760
- <xsl:otherwise>
8761
- <xsl:apply-templates select="*[local-name()='note']"/>
8762
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
8763
- <xsl:choose>
8764
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
8765
- <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
8766
- </xsl:when>
8767
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
8768
- <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
8769
- </xsl:when>
8770
- <xsl:otherwise>
8771
- <xsl:apply-templates select="*[local-name()='title']"/>
8772
- </xsl:otherwise>
8773
- </xsl:choose>
8774
- </xsl:otherwise>
8775
- </xsl:choose>
8822
+ <xsl:if test="*[local-name()='formattedref'] and normalize-space($docidentifier) != ''">, </xsl:if>
8823
+ <xsl:apply-templates select="*[local-name()='formattedref']"/>
8824
+
8776
8825
  <!-- end JCGM bibitem processing -->
8777
8826
 
8778
8827
  </xsl:template><xsl:template name="processBibitemDocId">
@@ -9078,36 +9127,58 @@
9078
9127
 
9079
9128
 
9080
9129
 
9130
+ <xsl:if test="@type = 'editorial'">
9131
+ <xsl:attribute name="color">green</xsl:attribute>
9132
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
9133
+
9134
+ <!-- <xsl:variable name="note-style">
9135
+ <style xsl:use-attribute-sets="note-style"></style>
9136
+ </xsl:variable>
9137
+ <xsl:for-each select="xalan:nodeset($note-style)//style/@*">
9138
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9139
+ </xsl:for-each> -->
9140
+ </xsl:if>
9141
+
9142
+
9143
+
9081
9144
 
9082
9145
 
9083
9146
 
9084
- <xsl:call-template name="displayAdmonitionName"/>
9085
- <xsl:text> — </xsl:text>
9147
+ <xsl:call-template name="displayAdmonitionName">
9148
+ <xsl:with-param name="sep"> — </xsl:with-param>
9149
+ </xsl:call-template>
9086
9150
 
9087
9151
 
9088
9152
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9089
9153
  </fo:block>
9090
9154
 
9091
9155
  </xsl:template><xsl:template name="displayAdmonitionName">
9092
-
9156
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
9157
+ <!-- <xsl:choose>
9158
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9159
+ <xsl:choose>
9160
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
9161
+ <xsl:otherwise>
9162
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9163
+ </xsl:otherwise>
9164
+ </xsl:choose>
9165
+ </xsl:when>
9166
+ <xsl:otherwise>
9093
9167
  <xsl:apply-templates select="*[local-name() = 'name']"/>
9094
9168
  <xsl:if test="not(*[local-name() = 'name'])">
9095
9169
  <xsl:apply-templates select="@type"/>
9096
9170
  </xsl:if>
9097
-
9098
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9099
- <xsl:apply-templates/>
9100
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
9101
- <xsl:variable name="admonition_type_">
9102
- <xsl:call-template name="getLocalizedString">
9103
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
9104
- </xsl:call-template>
9171
+ </xsl:otherwise>
9172
+ </xsl:choose> -->
9173
+ <xsl:variable name="name">
9174
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
9105
9175
  </xsl:variable>
9106
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
9107
- <xsl:value-of select="$admonition_type"/>
9108
- <xsl:if test="$admonition_type = ''">
9109
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
9176
+ <xsl:copy-of select="$name"/>
9177
+ <xsl:if test="normalize-space($name) != ''">
9178
+ <xsl:value-of select="$sep"/>
9110
9179
  </xsl:if>
9180
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
9181
+ <xsl:apply-templates/>
9111
9182
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
9112
9183
 
9113
9184
  <fo:block xsl:use-attribute-sets="admonition-p-style">