metanorma-bipm 2.1.6 → 2.1.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1724,8 +1724,18 @@
1724
1724
 
1725
1725
  <xsl:param name="table_if_debug">false</xsl:param> <!-- set 'true' to put debug width data before table or dl -->
1726
1726
 
1727
+ <xsl:variable name="isApplyAutolayoutAlgorithm_">
1728
+ true
1729
+ </xsl:variable>
1730
+ <xsl:variable name="isApplyAutolayoutAlgorithm" select="normalize-space($isApplyAutolayoutAlgorithm_)"/>
1731
+
1727
1732
  <xsl:variable name="isGenerateTableIF_">
1728
- false
1733
+ <xsl:choose>
1734
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
1735
+ <xsl:value-of select="normalize-space($table_if) = 'true'"/>
1736
+ </xsl:when>
1737
+ <xsl:otherwise>false</xsl:otherwise>
1738
+ </xsl:choose>
1729
1739
  </xsl:variable>
1730
1740
  <xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/>
1731
1741
 
@@ -2136,6 +2146,9 @@
2136
2146
  <xsl:attribute-set name="import-style">
2137
2147
  </xsl:attribute-set>
2138
2148
 
2149
+ <xsl:attribute-set name="component-style">
2150
+ </xsl:attribute-set>
2151
+
2139
2152
  <xsl:attribute-set name="recommendation-style">
2140
2153
 
2141
2154
  </xsl:attribute-set>
@@ -2345,9 +2358,7 @@
2345
2358
  </xsl:attribute-set>
2346
2359
 
2347
2360
  <xsl:attribute-set name="dt-block-style">
2348
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
2349
-
2350
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
2361
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
2351
2362
 
2352
2363
  </xsl:attribute-set>
2353
2364
 
@@ -3319,6 +3330,7 @@
3319
3330
 
3320
3331
  <xsl:variable name="margin-side">
3321
3332
  <xsl:choose>
3333
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
3322
3334
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3323
3335
  <xsl:otherwise>0</xsl:otherwise>
3324
3336
  </xsl:choose>
@@ -3385,6 +3397,7 @@
3385
3397
  </td>
3386
3398
  </tr>
3387
3399
  -->
3400
+ <!-- Simple_table=<xsl:copy-of select="$simple-table"/> -->
3388
3401
  <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
3389
3402
 
3390
3403
  </xsl:when>
@@ -3521,12 +3534,17 @@
3521
3534
  <xsl:template name="calculate-column-widths">
3522
3535
  <xsl:param name="table"/>
3523
3536
  <xsl:param name="cols-count"/>
3524
-
3537
+ <xsl:choose>
3538
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
3539
+ <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
3540
+ </xsl:when>
3541
+ <xsl:otherwise>
3525
3542
  <xsl:call-template name="calculate-column-widths-proportional">
3526
3543
  <xsl:with-param name="cols-count" select="$cols-count"/>
3527
3544
  <xsl:with-param name="table" select="$table"/>
3528
3545
  </xsl:call-template>
3529
-
3546
+ </xsl:otherwise>
3547
+ </xsl:choose>
3530
3548
  </xsl:template>
3531
3549
 
3532
3550
  <!-- ================================================== -->
@@ -3704,6 +3722,7 @@
3704
3722
  <!-- (https://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2) -->
3705
3723
  <!-- ================================================== -->
3706
3724
 
3725
+ <!-- INPUT: table with columns widths, generated by table_if.xsl -->
3707
3726
  <xsl:template name="calculate-column-widths-autolayout-algorithm">
3708
3727
  <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
3709
3728
 
@@ -3715,67 +3734,6 @@
3715
3734
 
3716
3735
  <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
3717
3736
 
3718
- <!-- get current table id -->
3719
- <xsl:variable name="table_id" select="@id"/>
3720
- <!-- find table by id in the file 'table_widths' -->
3721
- <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
3722
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
3723
-
3724
- <!-- table='<xsl:copy-of select="$table"/>' -->
3725
- <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
3726
- <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
3727
- <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
3728
-
3729
- <xsl:variable name="table_with_cell_widths_">
3730
- <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
3731
- </xsl:variable>
3732
- <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
3733
-
3734
- <!-- <xsl:if test="$table_if_debug = 'true'">
3735
- <xsl:copy-of select="$table_with_cell_widths"/>
3736
- </xsl:if> -->
3737
-
3738
- <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
3739
-
3740
- <xsl:variable name="column_widths_">
3741
- <!-- iteration of columns -->
3742
- <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
3743
- <xsl:variable name="pos" select="position()"/>
3744
- <column>
3745
- <xsl:attribute name="width_max">
3746
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
3747
- <xsl:sort select="." data-type="number" order="descending"/>
3748
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3749
- </xsl:for-each>
3750
- </xsl:attribute>
3751
- <xsl:attribute name="width_min">
3752
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
3753
- <xsl:sort select="." data-type="number" order="descending"/>
3754
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3755
- </xsl:for-each>
3756
- </xsl:attribute>
3757
- </column>
3758
- </xsl:for-each>
3759
- </xsl:variable>
3760
- <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
3761
-
3762
- <!-- <column_widths>
3763
- <xsl:copy-of select="$column_widths"/>
3764
- </column_widths> -->
3765
-
3766
- <!-- These in turn, are used to find the minimum and maximum width for the table. -->
3767
- <xsl:variable name="table_widths_">
3768
- <table>
3769
- <xsl:attribute name="width_max">
3770
- <xsl:value-of select="sum($column_widths/column/@width_max)"/>
3771
- </xsl:attribute>
3772
- <xsl:attribute name="width_min">
3773
- <xsl:value-of select="sum($column_widths/column/@width_min)"/>
3774
- </xsl:attribute>
3775
- </table>
3776
- </xsl:variable>
3777
- <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
3778
-
3779
3737
  <xsl:variable name="page_width">
3780
3738
  <xsl:choose>
3781
3739
  <xsl:when test="$parent_table_page-width != ''">
@@ -3788,16 +3746,13 @@
3788
3746
  </xsl:variable>
3789
3747
 
3790
3748
  <xsl:if test="$table_if_debug = 'true'">
3791
- <table_width>
3792
- <xsl:copy-of select="$table_widths"/>
3793
- </table_width>
3794
- <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
3749
+ <page_width><xsl:value-of select="$page_width"/></page_width>
3795
3750
  </xsl:if>
3796
3751
 
3797
3752
  <!-- There are three cases: -->
3798
3753
  <xsl:choose>
3799
3754
  <!-- 1. The minimum table width is equal to or wider than the available space -->
3800
- <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
3755
+ <xsl:when test="@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
3801
3756
  <!-- call old algorithm -->
3802
3757
  <case1/>
3803
3758
  <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
@@ -3807,10 +3762,10 @@
3807
3762
  </xsl:call-template> -->
3808
3763
  </xsl:when>
3809
3764
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
3810
- <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
3765
+ <xsl:when test="@width_max &lt;= $page_width">
3811
3766
  <case2/>
3812
3767
  <autolayout/>
3813
- <xsl:for-each select="$column_widths/column/@width_max">
3768
+ <xsl:for-each select="column/@width_max">
3814
3769
  <column divider="100"><xsl:value-of select="."/></column>
3815
3770
  </xsl:for-each>
3816
3771
  </xsl:when>
@@ -3820,19 +3775,19 @@
3820
3775
  For each column, let d be the difference between maximum and minimum width of that column.
3821
3776
  Now set the column's width to the minimum width plus d times W over D.
3822
3777
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
3823
- <xsl:when test="($table_widths/table/@width_max &gt; $page_width and $table_widths/table/@width_min &lt; $page_width) or ($table_widths/table/@width_min &gt;= $page_width)">
3778
+ <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
3824
3779
  <!-- difference between the available space and the minimum table width -->
3825
- <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
3780
+ <xsl:variable name="W" select="$page_width - @width_min"/>
3826
3781
  <W><xsl:value-of select="$W"/></W>
3827
3782
  <!-- difference between maximum and minimum width of the table -->
3828
- <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
3783
+ <xsl:variable name="D" select="@width_max - @width_min"/>
3829
3784
  <D><xsl:value-of select="$D"/></D>
3830
3785
  <case3/>
3831
3786
  <autolayout/>
3832
- <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
3787
+ <xsl:if test="@width_min &gt;= $page_width">
3833
3788
  <split_keep-within-line>true</split_keep-within-line>
3834
3789
  </xsl:if>
3835
- <xsl:for-each select="$column_widths/column">
3790
+ <xsl:for-each select="column">
3836
3791
  <!-- difference between maximum and minimum width of that column. -->
3837
3792
  <xsl:variable name="d" select="@width_max - @width_min"/>
3838
3793
  <d><xsl:value-of select="$d"/></d>
@@ -3858,23 +3813,39 @@
3858
3813
 
3859
3814
  <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
3860
3815
 
3816
+ <ancestor_tree>
3817
+ <xsl:for-each select="ancestor::*">
3818
+ <ancestor><xsl:value-of select="local-name()"/></ancestor>
3819
+ </xsl:for-each>
3820
+ </ancestor_tree>
3821
+
3861
3822
  <xsl:variable name="parent_table_page-width_">
3862
3823
  <xsl:if test="$parent_table_id != ''">
3863
3824
  <!-- determine column number in the parent table -->
3864
3825
  <xsl:variable name="parent_table_column_number">
3865
3826
  <xsl:choose>
3866
- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
3827
+ <!-- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> -->
3828
+ <xsl:when test="(ancestor::*[local-name() = 'dd' or local-name() = 'table' or local-name() = 'dl'])[last()][local-name() = 'dd' or local-name() = 'dl']">2</xsl:when>
3867
3829
  <xsl:otherwise> <!-- parent is table -->
3868
3830
  <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
3869
3831
  </xsl:otherwise>
3870
3832
  </xsl:choose>
3871
3833
  </xsl:variable>
3872
3834
  <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
3873
- <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3835
+
3836
+ <xsl:variable name="parent_table_column_" select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
3837
+ <xsl:variable name="parent_table_column" select="xalan:nodeset($parent_table_column_)"/>
3838
+ <!-- <xsl:variable name="divider">
3839
+ <xsl:value-of select="$parent_table_column/@divider"/>
3840
+ <xsl:if test="not($parent_table_column/@divider)">1</xsl:if>
3841
+ </xsl:variable> -->
3842
+ <xsl:value-of select="$parent_table_column/text()"/> <!-- * 10 -->
3874
3843
  </xsl:if>
3875
3844
  </xsl:variable>
3876
3845
  <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
3877
3846
 
3847
+ <parent_table_page-width><xsl:value-of select="$parent_table_page-width"/></parent_table_page-width>
3848
+
3878
3849
  <!-- get current table id -->
3879
3850
  <xsl:variable name="table_id" select="@id"/>
3880
3851
 
@@ -3895,50 +3866,6 @@
3895
3866
 
3896
3867
  </xsl:template> <!-- get-calculated-column-widths-autolayout-algorithm -->
3897
3868
 
3898
- <!-- ============================= -->
3899
- <!-- mode: determine_cell_widths-if -->
3900
- <!-- ============================= -->
3901
- <xsl:template match="@*|node()" mode="determine_cell_widths-if">
3902
- <xsl:copy>
3903
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
3904
- </xsl:copy>
3905
- </xsl:template>
3906
-
3907
- <xsl:template match="td | th" mode="determine_cell_widths-if">
3908
- <xsl:copy>
3909
- <xsl:copy-of select="@*"/>
3910
-
3911
- <!-- The maximum width is given by the widest line. -->
3912
- <xsl:attribute name="width_max">
3913
- <xsl:for-each select="p_len">
3914
- <xsl:sort select="." data-type="number" order="descending"/>
3915
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3916
- </xsl:for-each>
3917
- </xsl:attribute>
3918
-
3919
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
3920
- <xsl:variable name="width_min">
3921
- <xsl:for-each select="word_len">
3922
- <xsl:sort select="." data-type="number" order="descending"/>
3923
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
3924
- </xsl:for-each>
3925
- </xsl:variable>
3926
- <xsl:attribute name="width_min">
3927
- <xsl:value-of select="$width_min"/>
3928
- </xsl:attribute>
3929
-
3930
- <xsl:if test="$width_min = 0">
3931
- <xsl:attribute name="width_min">1</xsl:attribute>
3932
- </xsl:if>
3933
-
3934
- <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3935
-
3936
- </xsl:copy>
3937
- </xsl:template>
3938
- <!-- ============================= -->
3939
- <!-- END mode: determine_cell_widths-if -->
3940
- <!-- ============================= -->
3941
-
3942
3869
  <!-- ================================================== -->
3943
3870
  <!-- Calculate column's width based on HTML4 algorithm -->
3944
3871
  <!-- ================================================== -->
@@ -4183,6 +4110,7 @@
4183
4110
  <xsl:when test="$table_or_dl = 'table'">
4184
4111
  <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
4185
4112
  <fo:table-row number-columns-spanned="{$col_count}">
4113
+ <xsl:copy-of select="../@font-weight"/>
4186
4114
  <!-- <test_table><xsl:copy-of select="."/></test_table> -->
4187
4115
  <xsl:call-template name="td"/>
4188
4116
  </fo:table-row>
@@ -4347,7 +4275,7 @@
4347
4275
 
4348
4276
  <xsl:apply-templates/>
4349
4277
 
4350
- <xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
4278
+ <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
4351
4279
 
4352
4280
  </fo:block>
4353
4281
  </fo:table-cell>
@@ -4678,6 +4606,7 @@
4678
4606
  <xsl:template match="*[local-name()='dl']">
4679
4607
  <xsl:variable name="isAdded" select="@added"/>
4680
4608
  <xsl:variable name="isDeleted" select="@deleted"/>
4609
+ <!-- <dl><xsl:copy-of select="."/></dl> -->
4681
4610
  <fo:block-container>
4682
4611
 
4683
4612
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -5225,21 +5154,16 @@
5225
5154
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
5226
5155
  <xsl:template match="*[local-name()='dt']" mode="dl_if">
5227
5156
  <xsl:param name="id"/>
5228
- <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
5229
5157
  <tr>
5230
5158
  <td>
5231
5159
  <xsl:copy-of select="node()"/>
5232
5160
  </td>
5233
5161
  <td>
5234
-
5235
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5236
-
5237
- <!-- get paragraphs from nested 'dl' -->
5238
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5239
-
5162
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5163
+ <!-- get paragraphs from nested 'dl' -->
5164
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5240
5165
  </td>
5241
5166
  </tr>
5242
-
5243
5167
  </xsl:template>
5244
5168
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
5245
5169
 
@@ -5893,6 +5817,9 @@
5893
5817
  <xsl:variable name="td">
5894
5818
  <xsl:element name="td">
5895
5819
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
5820
+ <xsl:if test="local-name()='th'">
5821
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5822
+ </xsl:if>
5896
5823
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
5897
5824
  <xsl:apply-templates mode="simple-table-colspan"/>
5898
5825
  </xsl:element>
@@ -5905,6 +5832,9 @@
5905
5832
  <xsl:otherwise>
5906
5833
  <xsl:element name="td">
5907
5834
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
5835
+ <xsl:if test="local-name()='th'">
5836
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5837
+ </xsl:if>
5908
5838
  <xsl:apply-templates mode="simple-table-colspan"/>
5909
5839
  </xsl:element>
5910
5840
  </xsl:otherwise>
@@ -6034,8 +5964,14 @@
6034
5964
  <xsl:copy-of select="@*"/>
6035
5965
  <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
6036
5966
  <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
5967
+ <xsl:variable name="divide">
5968
+ <xsl:choose>
5969
+ <xsl:when test="@divide"><xsl:value-of select="@divide"/></xsl:when>
5970
+ <xsl:otherwise>1</xsl:otherwise>
5971
+ </xsl:choose>
5972
+ </xsl:variable>
6037
5973
  <xsl:attribute name="id">
6038
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
5974
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
6039
5975
  </xsl:attribute>
6040
5976
 
6041
5977
  <xsl:for-each select="*[local-name() = 'p']">
@@ -6043,10 +5979,12 @@
6043
5979
  <xsl:copy-of select="@*"/>
6044
5980
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
6045
5981
  <xsl:attribute name="id">
6046
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
5982
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
6047
5983
  </xsl:attribute>
6048
5984
 
6049
- <xsl:copy-of select="node()"/>
5985
+ <!-- <xsl:copy-of select="node()" /> -->
5986
+ <xsl:apply-templates mode="simple-table-noid"/>
5987
+
6050
5988
  </xsl:copy>
6051
5989
  </xsl:for-each>
6052
5990
 
@@ -6075,7 +6013,7 @@
6075
6013
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
6076
6014
  <xsl:copy>
6077
6015
  <xsl:attribute name="id">
6078
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
6016
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
6079
6017
  </xsl:attribute>
6080
6018
  <xsl:copy-of select="node()"/>
6081
6019
  </xsl:copy>
@@ -6084,6 +6022,24 @@
6084
6022
  </xsl:copy>
6085
6023
 
6086
6024
  </xsl:template>
6025
+
6026
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p']//*" mode="simple-table-noid">
6027
+ <xsl:copy>
6028
+ <xsl:choose>
6029
+ <xsl:when test="$isGenerateTableIF = 'true'">
6030
+ <xsl:copy-of select="@*[local-name() != 'id']"/> <!-- to prevent repeat id in colspan/rowspan cells -->
6031
+ <!-- <xsl:if test="local-name() = 'dl' or local-name() = 'table'">
6032
+ <xsl:copy-of select="@id"/>
6033
+ </xsl:if> -->
6034
+ </xsl:when>
6035
+ <xsl:otherwise>
6036
+ <xsl:copy-of select="@*"/>
6037
+ </xsl:otherwise>
6038
+ </xsl:choose>
6039
+ <xsl:apply-templates select="node()" mode="simple-table-noid"/>
6040
+ </xsl:copy>
6041
+ </xsl:template>
6042
+
6087
6043
  <!-- End mode: simple-table-id -->
6088
6044
  <!-- ===================== -->
6089
6045
  <!-- ===================== -->
@@ -6093,7 +6049,7 @@
6093
6049
  <!-- =============================== -->
6094
6050
  <xsl:template match="@*|node()" mode="td_text_with_formatting">
6095
6051
  <xsl:copy>
6096
- <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
6052
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
6097
6053
  </xsl:copy>
6098
6054
  </xsl:template>
6099
6055
 
@@ -6207,6 +6163,10 @@
6207
6163
 
6208
6164
  <fo:inline xsl:use-attribute-sets="mathml-style">
6209
6165
 
6166
+ <xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element -->
6167
+ <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
6168
+ </xsl:if>
6169
+
6210
6170
  <xsl:call-template name="setTrackChangesStyles">
6211
6171
  <xsl:with-param name="isAdded" select="$isAdded"/>
6212
6172
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
@@ -8091,41 +8051,47 @@
8091
8051
  </fo:block>
8092
8052
  </xsl:template>
8093
8053
 
8094
- <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
8054
+ <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
8095
8055
  <fo:block xsl:use-attribute-sets="inherit-style">
8096
8056
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
8097
8057
  </fo:block>
8098
8058
  </xsl:template>
8099
8059
 
8100
- <xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
8060
+ <xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description'] | *[local-name() = 'div'][@type = 'requirement-description'] | *[local-name() = 'div'][@type = 'recommendation-description'] | *[local-name() = 'div'][@type = 'permission-description']">
8101
8061
  <fo:block xsl:use-attribute-sets="description-style">
8102
8062
  <xsl:apply-templates/>
8103
8063
  </fo:block>
8104
8064
  </xsl:template>
8105
8065
 
8106
- <xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
8066
+ <xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification'] | *[local-name() = 'div'][@type = 'requirement-specification'] | *[local-name() = 'div'][@type = 'recommendation-specification'] | *[local-name() = 'div'][@type = 'permission-specification']">
8107
8067
  <fo:block xsl:use-attribute-sets="specification-style">
8108
8068
  <xsl:apply-templates/>
8109
8069
  </fo:block>
8110
8070
  </xsl:template>
8111
8071
 
8112
- <xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
8072
+ <xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target'] | *[local-name() = 'div'][@type = 'requirement-measurement-target'] | *[local-name() = 'div'][@type = 'recommendation-measurement-target'] | *[local-name() = 'div'][@type = 'permission-measurement-target']">
8113
8073
  <fo:block xsl:use-attribute-sets="measurement-target-style">
8114
8074
  <xsl:apply-templates/>
8115
8075
  </fo:block>
8116
8076
  </xsl:template>
8117
8077
 
8118
- <xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
8078
+ <xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification'] | *[local-name() = 'div'][@type = 'requirement-verification'] | *[local-name() = 'div'][@type = 'recommendation-verification'] | *[local-name() = 'div'][@type = 'permission-verification']">
8119
8079
  <fo:block xsl:use-attribute-sets="verification-style">
8120
8080
  <xsl:apply-templates/>
8121
8081
  </fo:block>
8122
8082
  </xsl:template>
8123
8083
 
8124
- <xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
8084
+ <xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import'] | *[local-name() = 'div'][@type = 'requirement-import'] | *[local-name() = 'div'][@type = 'recommendation-import'] | *[local-name() = 'div'][@type = 'permission-import']">
8125
8085
  <fo:block xsl:use-attribute-sets="import-style">
8126
8086
  <xsl:apply-templates/>
8127
8087
  </fo:block>
8128
8088
  </xsl:template>
8089
+
8090
+ <xsl:template match="*[local-name() = 'div'][starts-with(@type, 'requirement-component')] | *[local-name() = 'div'][starts-with(@type, 'recommendation-component')] | *[local-name() = 'div'][starts-with(@type, 'permission-component')]">
8091
+ <fo:block xsl:use-attribute-sets="component-style">
8092
+ <xsl:apply-templates/>
8093
+ </fo:block>
8094
+ </xsl:template>
8129
8095
  <!-- ========== -->
8130
8096
  <!-- END -->
8131
8097
  <!-- ========== -->
@@ -8181,15 +8147,12 @@
8181
8147
 
8182
8148
  <xsl:template match="*[local-name()='tr']" mode="requirement">
8183
8149
  <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
8184
- <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
8185
- <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
8186
- </xsl:if>
8187
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
8188
- <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
8189
- </xsl:if>
8190
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
8191
- <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
8150
+
8151
+ <xsl:if test="parent::*[local-name()='thead'] or starts-with(*[local-name()='td' or local-name()='th'][1], 'Requirement ') or starts-with(*[local-name()='td' or local-name()='th'][1], 'Recommendation ')">
8152
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
8153
+
8192
8154
  </xsl:if>
8155
+
8193
8156
  <xsl:apply-templates mode="requirement"/>
8194
8157
  </fo:table-row>
8195
8158
  </xsl:template>
@@ -9708,7 +9671,7 @@
9708
9671
  </tbody>
9709
9672
  </xsl:variable>
9710
9673
  <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
9711
- <xsl:call-template name="calculate-column-widths">
9674
+ <xsl:call-template name="calculate-column-widths-proportional">
9712
9675
  <xsl:with-param name="cols-count" select="$cols-count"/>
9713
9676
  <xsl:with-param name="table" select="$toc_table_simple"/>
9714
9677
  </xsl:call-template>
@@ -225,9 +225,9 @@
225
225
  <zeroOrMore>
226
226
  <ref name="forename"/>
227
227
  </zeroOrMore>
228
- <zeroOrMore>
229
- <ref name="initial"/>
230
- </zeroOrMore>
228
+ <optional>
229
+ <ref name="formatted-initials"/>
230
+ </optional>
231
231
  <ref name="surname"/>
232
232
  <zeroOrMore>
233
233
  <ref name="addition"/>
@@ -247,8 +247,8 @@
247
247
  <ref name="LocalizedString"/>
248
248
  </element>
249
249
  </define>
250
- <define name="initial">
251
- <element name="initial">
250
+ <define name="formatted-initials">
251
+ <element name="formatted-initials">
252
252
  <ref name="LocalizedString"/>
253
253
  </element>
254
254
  </define>
@@ -264,6 +264,9 @@
264
264
  </define>
265
265
  <define name="forename">
266
266
  <element name="forename">
267
+ <optional>
268
+ <attribute name="initial"/>
269
+ </optional>
267
270
  <ref name="LocalizedString"/>
268
271
  </element>
269
272
  </define>
@@ -10,7 +10,7 @@ module Metanorma
10
10
  def output_formats
11
11
  super.merge(
12
12
  html: "html",
13
- pdf: "pdf"
13
+ pdf: "pdf",
14
14
  ).tap { |hs| hs.delete(:doc) }
15
15
  end
16
16
 
@@ -37,14 +37,17 @@ module Metanorma
37
37
  "Metanorma::BIPM #{Metanorma::BIPM::VERSION}"
38
38
  end
39
39
 
40
- def output(isodoc_node, inname, outname, format, options={})
40
+ def output(isodoc_node, inname, outname, format, options = {})
41
41
  case format
42
42
  when :html
43
- IsoDoc::BIPM::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
43
+ IsoDoc::BIPM::HtmlConvert.new(options)
44
+ .convert(inname, isodoc_node, nil, outname)
44
45
  when :presentation
45
- IsoDoc::BIPM::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
46
+ IsoDoc::BIPM::PresentationXMLConvert.new(options)
47
+ .convert(inname, isodoc_node, nil, outname)
46
48
  when :pdf
47
- IsoDoc::BIPM::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
49
+ IsoDoc::BIPM::PdfConvert.new(options)
50
+ .convert(inname, isodoc_node, nil, outname)
48
51
  else
49
52
  super
50
53
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.1.6".freeze
3
+ VERSION = "2.1.8.1".freeze
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ require "isodoc/bipm"
5
5
 
6
6
  require "asciidoctor" unless defined? Asciidoctor::Converter
7
7
 
8
- if defined? Metanorma
8
+ if defined? Metanorma::Registry
9
9
  require_relative "metanorma/bipm"
10
10
  Metanorma::Registry.instance.register(Metanorma::BIPM::Processor)
11
11
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
28
28
 
29
29
  spec.add_dependency "metanorma-generic", "~> 2.2.0"
30
- spec.add_dependency "metanorma-iso", "~> 2.1.6"
30
+ spec.add_dependency "metanorma-iso", "~> 2.1.8"
31
31
 
32
32
  spec.add_development_dependency "debug"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"