metanorma-un 0.9.6 → 0.9.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -832,8 +832,18 @@
832
832
 
833
833
  <xsl:param name="table_if_debug">false</xsl:param> <!-- set 'true' to put debug width data before table or dl -->
834
834
 
835
+ <xsl:variable name="isApplyAutolayoutAlgorithm_">
836
+ true
837
+ </xsl:variable>
838
+ <xsl:variable name="isApplyAutolayoutAlgorithm" select="normalize-space($isApplyAutolayoutAlgorithm_)"/>
839
+
835
840
  <xsl:variable name="isGenerateTableIF_">
836
- false
841
+ <xsl:choose>
842
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
843
+ <xsl:value-of select="normalize-space($table_if) = 'true'"/>
844
+ </xsl:when>
845
+ <xsl:otherwise>false</xsl:otherwise>
846
+ </xsl:choose>
837
847
  </xsl:variable>
838
848
  <xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/>
839
849
 
@@ -1244,6 +1254,9 @@
1244
1254
  <xsl:attribute-set name="import-style">
1245
1255
  </xsl:attribute-set>
1246
1256
 
1257
+ <xsl:attribute-set name="component-style">
1258
+ </xsl:attribute-set>
1259
+
1247
1260
  <xsl:attribute-set name="recommendation-style">
1248
1261
 
1249
1262
  </xsl:attribute-set>
@@ -1429,7 +1442,7 @@
1429
1442
  </xsl:attribute-set>
1430
1443
 
1431
1444
  <xsl:attribute-set name="dt-block-style">
1432
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
1445
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
1433
1446
 
1434
1447
  </xsl:attribute-set>
1435
1448
 
@@ -2378,6 +2391,7 @@
2378
2391
 
2379
2392
  <xsl:variable name="margin-side">
2380
2393
  <xsl:choose>
2394
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
2381
2395
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2382
2396
  <xsl:otherwise>0</xsl:otherwise>
2383
2397
  </xsl:choose>
@@ -2460,6 +2474,7 @@
2460
2474
  </td>
2461
2475
  </tr>
2462
2476
  -->
2477
+ <!-- Simple_table=<xsl:copy-of select="$simple-table"/> -->
2463
2478
  <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2464
2479
 
2465
2480
  </xsl:when>
@@ -2591,12 +2606,17 @@
2591
2606
  <xsl:template name="calculate-column-widths">
2592
2607
  <xsl:param name="table"/>
2593
2608
  <xsl:param name="cols-count"/>
2594
-
2609
+ <xsl:choose>
2610
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
2611
+ <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
2612
+ </xsl:when>
2613
+ <xsl:otherwise>
2595
2614
  <xsl:call-template name="calculate-column-widths-proportional">
2596
2615
  <xsl:with-param name="cols-count" select="$cols-count"/>
2597
2616
  <xsl:with-param name="table" select="$table"/>
2598
2617
  </xsl:call-template>
2599
-
2618
+ </xsl:otherwise>
2619
+ </xsl:choose>
2600
2620
  </xsl:template>
2601
2621
 
2602
2622
  <!-- ================================================== -->
@@ -2774,6 +2794,7 @@
2774
2794
  <!-- (https://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2) -->
2775
2795
  <!-- ================================================== -->
2776
2796
 
2797
+ <!-- INPUT: table with columns widths, generated by table_if.xsl -->
2777
2798
  <xsl:template name="calculate-column-widths-autolayout-algorithm">
2778
2799
  <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2779
2800
 
@@ -2785,67 +2806,6 @@
2785
2806
 
2786
2807
  <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2787
2808
 
2788
- <!-- get current table id -->
2789
- <xsl:variable name="table_id" select="@id"/>
2790
- <!-- find table by id in the file 'table_widths' -->
2791
- <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2792
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2793
-
2794
- <!-- table='<xsl:copy-of select="$table"/>' -->
2795
- <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2796
- <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2797
- <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2798
-
2799
- <xsl:variable name="table_with_cell_widths_">
2800
- <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2801
- </xsl:variable>
2802
- <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2803
-
2804
- <!-- <xsl:if test="$table_if_debug = 'true'">
2805
- <xsl:copy-of select="$table_with_cell_widths"/>
2806
- </xsl:if> -->
2807
-
2808
- <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2809
-
2810
- <xsl:variable name="column_widths_">
2811
- <!-- iteration of columns -->
2812
- <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2813
- <xsl:variable name="pos" select="position()"/>
2814
- <column>
2815
- <xsl:attribute name="width_max">
2816
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2817
- <xsl:sort select="." data-type="number" order="descending"/>
2818
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2819
- </xsl:for-each>
2820
- </xsl:attribute>
2821
- <xsl:attribute name="width_min">
2822
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2823
- <xsl:sort select="." data-type="number" order="descending"/>
2824
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2825
- </xsl:for-each>
2826
- </xsl:attribute>
2827
- </column>
2828
- </xsl:for-each>
2829
- </xsl:variable>
2830
- <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2831
-
2832
- <!-- <column_widths>
2833
- <xsl:copy-of select="$column_widths"/>
2834
- </column_widths> -->
2835
-
2836
- <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2837
- <xsl:variable name="table_widths_">
2838
- <table>
2839
- <xsl:attribute name="width_max">
2840
- <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2841
- </xsl:attribute>
2842
- <xsl:attribute name="width_min">
2843
- <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2844
- </xsl:attribute>
2845
- </table>
2846
- </xsl:variable>
2847
- <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2848
-
2849
2809
  <xsl:variable name="page_width">
2850
2810
  <xsl:choose>
2851
2811
  <xsl:when test="$parent_table_page-width != ''">
@@ -2858,16 +2818,13 @@
2858
2818
  </xsl:variable>
2859
2819
 
2860
2820
  <xsl:if test="$table_if_debug = 'true'">
2861
- <table_width>
2862
- <xsl:copy-of select="$table_widths"/>
2863
- </table_width>
2864
- <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2821
+ <page_width><xsl:value-of select="$page_width"/></page_width>
2865
2822
  </xsl:if>
2866
2823
 
2867
2824
  <!-- There are three cases: -->
2868
2825
  <xsl:choose>
2869
2826
  <!-- 1. The minimum table width is equal to or wider than the available space -->
2870
- <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2827
+ <xsl:when test="@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2871
2828
  <!-- call old algorithm -->
2872
2829
  <case1/>
2873
2830
  <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
@@ -2877,10 +2834,10 @@
2877
2834
  </xsl:call-template> -->
2878
2835
  </xsl:when>
2879
2836
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2880
- <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2837
+ <xsl:when test="@width_max &lt;= $page_width">
2881
2838
  <case2/>
2882
2839
  <autolayout/>
2883
- <xsl:for-each select="$column_widths/column/@width_max">
2840
+ <xsl:for-each select="column/@width_max">
2884
2841
  <column divider="100"><xsl:value-of select="."/></column>
2885
2842
  </xsl:for-each>
2886
2843
  </xsl:when>
@@ -2890,19 +2847,19 @@
2890
2847
  For each column, let d be the difference between maximum and minimum width of that column.
2891
2848
  Now set the column's width to the minimum width plus d times W over D.
2892
2849
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2893
- <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)">
2850
+ <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2894
2851
  <!-- difference between the available space and the minimum table width -->
2895
- <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2852
+ <xsl:variable name="W" select="$page_width - @width_min"/>
2896
2853
  <W><xsl:value-of select="$W"/></W>
2897
2854
  <!-- difference between maximum and minimum width of the table -->
2898
- <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2855
+ <xsl:variable name="D" select="@width_max - @width_min"/>
2899
2856
  <D><xsl:value-of select="$D"/></D>
2900
2857
  <case3/>
2901
2858
  <autolayout/>
2902
- <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2859
+ <xsl:if test="@width_min &gt;= $page_width">
2903
2860
  <split_keep-within-line>true</split_keep-within-line>
2904
2861
  </xsl:if>
2905
- <xsl:for-each select="$column_widths/column">
2862
+ <xsl:for-each select="column">
2906
2863
  <!-- difference between maximum and minimum width of that column. -->
2907
2864
  <xsl:variable name="d" select="@width_max - @width_min"/>
2908
2865
  <d><xsl:value-of select="$d"/></d>
@@ -2928,23 +2885,39 @@
2928
2885
 
2929
2886
  <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2930
2887
 
2888
+ <ancestor_tree>
2889
+ <xsl:for-each select="ancestor::*">
2890
+ <ancestor><xsl:value-of select="local-name()"/></ancestor>
2891
+ </xsl:for-each>
2892
+ </ancestor_tree>
2893
+
2931
2894
  <xsl:variable name="parent_table_page-width_">
2932
2895
  <xsl:if test="$parent_table_id != ''">
2933
2896
  <!-- determine column number in the parent table -->
2934
2897
  <xsl:variable name="parent_table_column_number">
2935
2898
  <xsl:choose>
2936
- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2899
+ <!-- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> -->
2900
+ <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>
2937
2901
  <xsl:otherwise> <!-- parent is table -->
2938
2902
  <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2939
2903
  </xsl:otherwise>
2940
2904
  </xsl:choose>
2941
2905
  </xsl:variable>
2942
2906
  <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2943
- <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2907
+
2908
+ <xsl:variable name="parent_table_column_" select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2909
+ <xsl:variable name="parent_table_column" select="xalan:nodeset($parent_table_column_)"/>
2910
+ <!-- <xsl:variable name="divider">
2911
+ <xsl:value-of select="$parent_table_column/@divider"/>
2912
+ <xsl:if test="not($parent_table_column/@divider)">1</xsl:if>
2913
+ </xsl:variable> -->
2914
+ <xsl:value-of select="$parent_table_column/text()"/> <!-- * 10 -->
2944
2915
  </xsl:if>
2945
2916
  </xsl:variable>
2946
2917
  <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2947
2918
 
2919
+ <parent_table_page-width><xsl:value-of select="$parent_table_page-width"/></parent_table_page-width>
2920
+
2948
2921
  <!-- get current table id -->
2949
2922
  <xsl:variable name="table_id" select="@id"/>
2950
2923
 
@@ -2965,50 +2938,6 @@
2965
2938
 
2966
2939
  </xsl:template> <!-- get-calculated-column-widths-autolayout-algorithm -->
2967
2940
 
2968
- <!-- ============================= -->
2969
- <!-- mode: determine_cell_widths-if -->
2970
- <!-- ============================= -->
2971
- <xsl:template match="@*|node()" mode="determine_cell_widths-if">
2972
- <xsl:copy>
2973
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2974
- </xsl:copy>
2975
- </xsl:template>
2976
-
2977
- <xsl:template match="td | th" mode="determine_cell_widths-if">
2978
- <xsl:copy>
2979
- <xsl:copy-of select="@*"/>
2980
-
2981
- <!-- The maximum width is given by the widest line. -->
2982
- <xsl:attribute name="width_max">
2983
- <xsl:for-each select="p_len">
2984
- <xsl:sort select="." data-type="number" order="descending"/>
2985
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2986
- </xsl:for-each>
2987
- </xsl:attribute>
2988
-
2989
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2990
- <xsl:variable name="width_min">
2991
- <xsl:for-each select="word_len">
2992
- <xsl:sort select="." data-type="number" order="descending"/>
2993
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2994
- </xsl:for-each>
2995
- </xsl:variable>
2996
- <xsl:attribute name="width_min">
2997
- <xsl:value-of select="$width_min"/>
2998
- </xsl:attribute>
2999
-
3000
- <xsl:if test="$width_min = 0">
3001
- <xsl:attribute name="width_min">1</xsl:attribute>
3002
- </xsl:if>
3003
-
3004
- <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3005
-
3006
- </xsl:copy>
3007
- </xsl:template>
3008
- <!-- ============================= -->
3009
- <!-- END mode: determine_cell_widths-if -->
3010
- <!-- ============================= -->
3011
-
3012
2941
  <!-- ================================================== -->
3013
2942
  <!-- Calculate column's width based on HTML4 algorithm -->
3014
2943
  <!-- ================================================== -->
@@ -3199,6 +3128,7 @@
3199
3128
  <xsl:when test="$table_or_dl = 'table'">
3200
3129
  <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3201
3130
  <fo:table-row number-columns-spanned="{$col_count}">
3131
+ <xsl:copy-of select="../@font-weight"/>
3202
3132
  <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3203
3133
  <xsl:call-template name="td"/>
3204
3134
  </fo:table-row>
@@ -3365,7 +3295,7 @@
3365
3295
 
3366
3296
  <xsl:apply-templates/>
3367
3297
 
3368
- <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"/> -->
3298
+ <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"/> -->
3369
3299
 
3370
3300
  </fo:block>
3371
3301
  </fo:table-cell>
@@ -3695,6 +3625,7 @@
3695
3625
  <xsl:template match="*[local-name()='dl']">
3696
3626
  <xsl:variable name="isAdded" select="@added"/>
3697
3627
  <xsl:variable name="isDeleted" select="@deleted"/>
3628
+ <!-- <dl><xsl:copy-of select="."/></dl> -->
3698
3629
  <fo:block-container>
3699
3630
 
3700
3631
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4228,21 +4159,16 @@
4228
4159
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
4229
4160
  <xsl:template match="*[local-name()='dt']" mode="dl_if">
4230
4161
  <xsl:param name="id"/>
4231
- <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4232
4162
  <tr>
4233
4163
  <td>
4234
4164
  <xsl:copy-of select="node()"/>
4235
4165
  </td>
4236
4166
  <td>
4237
-
4238
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4239
-
4240
- <!-- get paragraphs from nested 'dl' -->
4241
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4242
-
4167
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4168
+ <!-- get paragraphs from nested 'dl' -->
4169
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4243
4170
  </td>
4244
4171
  </tr>
4245
-
4246
4172
  </xsl:template>
4247
4173
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
4248
4174
 
@@ -4893,6 +4819,9 @@
4893
4819
  <xsl:variable name="td">
4894
4820
  <xsl:element name="td">
4895
4821
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4822
+ <xsl:if test="local-name()='th'">
4823
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4824
+ </xsl:if>
4896
4825
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4897
4826
  <xsl:apply-templates mode="simple-table-colspan"/>
4898
4827
  </xsl:element>
@@ -4905,6 +4834,9 @@
4905
4834
  <xsl:otherwise>
4906
4835
  <xsl:element name="td">
4907
4836
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4837
+ <xsl:if test="local-name()='th'">
4838
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4839
+ </xsl:if>
4908
4840
  <xsl:apply-templates mode="simple-table-colspan"/>
4909
4841
  </xsl:element>
4910
4842
  </xsl:otherwise>
@@ -5034,8 +4966,14 @@
5034
4966
  <xsl:copy-of select="@*"/>
5035
4967
  <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
5036
4968
  <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4969
+ <xsl:variable name="divide">
4970
+ <xsl:choose>
4971
+ <xsl:when test="@divide"><xsl:value-of select="@divide"/></xsl:when>
4972
+ <xsl:otherwise>1</xsl:otherwise>
4973
+ </xsl:choose>
4974
+ </xsl:variable>
5037
4975
  <xsl:attribute name="id">
5038
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4976
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5039
4977
  </xsl:attribute>
5040
4978
 
5041
4979
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5043,10 +4981,12 @@
5043
4981
  <xsl:copy-of select="@*"/>
5044
4982
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5045
4983
  <xsl:attribute name="id">
5046
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4984
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5047
4985
  </xsl:attribute>
5048
4986
 
5049
- <xsl:copy-of select="node()"/>
4987
+ <!-- <xsl:copy-of select="node()" /> -->
4988
+ <xsl:apply-templates mode="simple-table-noid"/>
4989
+
5050
4990
  </xsl:copy>
5051
4991
  </xsl:for-each>
5052
4992
 
@@ -5075,7 +5015,7 @@
5075
5015
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5076
5016
  <xsl:copy>
5077
5017
  <xsl:attribute name="id">
5078
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
5018
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5079
5019
  </xsl:attribute>
5080
5020
  <xsl:copy-of select="node()"/>
5081
5021
  </xsl:copy>
@@ -5084,6 +5024,24 @@
5084
5024
  </xsl:copy>
5085
5025
 
5086
5026
  </xsl:template>
5027
+
5028
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p']//*" mode="simple-table-noid">
5029
+ <xsl:copy>
5030
+ <xsl:choose>
5031
+ <xsl:when test="$isGenerateTableIF = 'true'">
5032
+ <xsl:copy-of select="@*[local-name() != 'id']"/> <!-- to prevent repeat id in colspan/rowspan cells -->
5033
+ <!-- <xsl:if test="local-name() = 'dl' or local-name() = 'table'">
5034
+ <xsl:copy-of select="@id"/>
5035
+ </xsl:if> -->
5036
+ </xsl:when>
5037
+ <xsl:otherwise>
5038
+ <xsl:copy-of select="@*"/>
5039
+ </xsl:otherwise>
5040
+ </xsl:choose>
5041
+ <xsl:apply-templates select="node()" mode="simple-table-noid"/>
5042
+ </xsl:copy>
5043
+ </xsl:template>
5044
+
5087
5045
  <!-- End mode: simple-table-id -->
5088
5046
  <!-- ===================== -->
5089
5047
  <!-- ===================== -->
@@ -5093,7 +5051,7 @@
5093
5051
  <!-- =============================== -->
5094
5052
  <xsl:template match="@*|node()" mode="td_text_with_formatting">
5095
5053
  <xsl:copy>
5096
- <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5054
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5097
5055
  </xsl:copy>
5098
5056
  </xsl:template>
5099
5057
 
@@ -5207,6 +5165,10 @@
5207
5165
 
5208
5166
  <fo:inline xsl:use-attribute-sets="mathml-style">
5209
5167
 
5168
+ <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 -->
5169
+ <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5170
+ </xsl:if>
5171
+
5210
5172
  <xsl:call-template name="setTrackChangesStyles">
5211
5173
  <xsl:with-param name="isAdded" select="$isAdded"/>
5212
5174
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
@@ -7109,41 +7071,47 @@
7109
7071
  </fo:block>
7110
7072
  </xsl:template>
7111
7073
 
7112
- <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
7074
+ <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']">
7113
7075
  <fo:block xsl:use-attribute-sets="inherit-style">
7114
7076
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
7115
7077
  </fo:block>
7116
7078
  </xsl:template>
7117
7079
 
7118
- <xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
7080
+ <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']">
7119
7081
  <fo:block xsl:use-attribute-sets="description-style">
7120
7082
  <xsl:apply-templates/>
7121
7083
  </fo:block>
7122
7084
  </xsl:template>
7123
7085
 
7124
- <xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
7086
+ <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']">
7125
7087
  <fo:block xsl:use-attribute-sets="specification-style">
7126
7088
  <xsl:apply-templates/>
7127
7089
  </fo:block>
7128
7090
  </xsl:template>
7129
7091
 
7130
- <xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
7092
+ <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']">
7131
7093
  <fo:block xsl:use-attribute-sets="measurement-target-style">
7132
7094
  <xsl:apply-templates/>
7133
7095
  </fo:block>
7134
7096
  </xsl:template>
7135
7097
 
7136
- <xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
7098
+ <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']">
7137
7099
  <fo:block xsl:use-attribute-sets="verification-style">
7138
7100
  <xsl:apply-templates/>
7139
7101
  </fo:block>
7140
7102
  </xsl:template>
7141
7103
 
7142
- <xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
7104
+ <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']">
7143
7105
  <fo:block xsl:use-attribute-sets="import-style">
7144
7106
  <xsl:apply-templates/>
7145
7107
  </fo:block>
7146
7108
  </xsl:template>
7109
+
7110
+ <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')]">
7111
+ <fo:block xsl:use-attribute-sets="component-style">
7112
+ <xsl:apply-templates/>
7113
+ </fo:block>
7114
+ </xsl:template>
7147
7115
  <!-- ========== -->
7148
7116
  <!-- END -->
7149
7117
  <!-- ========== -->
@@ -7199,15 +7167,12 @@
7199
7167
 
7200
7168
  <xsl:template match="*[local-name()='tr']" mode="requirement">
7201
7169
  <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
7202
- <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
7203
- <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
7204
- </xsl:if>
7205
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
7206
- <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
7207
- </xsl:if>
7208
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
7209
- <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
7170
+
7171
+ <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 ')">
7172
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
7173
+
7210
7174
  </xsl:if>
7175
+
7211
7176
  <xsl:apply-templates mode="requirement"/>
7212
7177
  </fo:table-row>
7213
7178
  </xsl:template>
@@ -8685,7 +8650,7 @@
8685
8650
  </tbody>
8686
8651
  </xsl:variable>
8687
8652
  <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
8688
- <xsl:call-template name="calculate-column-widths">
8653
+ <xsl:call-template name="calculate-column-widths-proportional">
8689
8654
  <xsl:with-param name="cols-count" select="$cols-count"/>
8690
8655
  <xsl:with-param name="table" select="$toc_table_simple"/>
8691
8656
  </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>
@@ -212,6 +212,9 @@ module Metanorma
212
212
  subsequence: node.attr("subsequence")))
213
213
  end
214
214
 
215
+ PREFACE_CLAUSE_NAMES = %w(donotrecognise-foreword
216
+ acknowledgements).freeze
217
+
215
218
  def sectiontype_streamline(ret)
216
219
  case ret
217
220
  when "foreword", "introduction" then "donotrecognise-foreword"
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.9.6".freeze
3
+ VERSION = "0.9.8.1".freeze
4
4
  end
5
5
  end
data/lib/metanorma-un.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require "metanorma/un"
2
2
  require "asciidoctor"
3
3
  require "isodoc/un"
4
+ require "metanorma"
4
5
 
5
- if defined? Metanorma
6
+ if defined? Metanorma::Registry
6
7
  Metanorma::Registry.instance.register(Metanorma::UN::Processor)
7
8
  end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-08 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -217,6 +217,7 @@ extensions: []
217
217
  extra_rdoc_files: []
218
218
  files:
219
219
  - ".github/workflows/rake.yml"
220
+ - ".github/workflows/release.yml"
220
221
  - ".gitignore"
221
222
  - ".hound.yml"
222
223
  - ".rubocop.yml"
@@ -271,12 +272,12 @@ files:
271
272
  - lib/metanorma/un/un.rng
272
273
  - lib/metanorma/un/validate.rb
273
274
  - lib/metanorma/un/version.rb
274
- - metanorma-unece.gemspec
275
+ - metanorma-un.gemspec
275
276
  homepage: https://github.com/metanorma/metanorma-un
276
277
  licenses:
277
278
  - BSD-2-Clause
278
279
  metadata: {}
279
- post_install_message:
280
+ post_install_message:
280
281
  rdoc_options: []
281
282
  require_paths:
282
283
  - lib
@@ -291,8 +292,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
292
  - !ruby/object:Gem::Version
292
293
  version: '0'
293
294
  requirements: []
294
- rubygems_version: 3.3.16
295
- signing_key:
295
+ rubygems_version: 3.1.6
296
+ signing_key:
296
297
  specification_version: 4
297
298
  summary: Metanorma for UN.
298
299
  test_files: []