metanorma-ogc 2.2.1 → 2.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -659,8 +659,18 @@
659
659
 
660
660
  <xsl:param name="table_if_debug">false</xsl:param> <!-- set 'true' to put debug width data before table or dl -->
661
661
 
662
+ <xsl:variable name="isApplyAutolayoutAlgorithm_">
663
+ true
664
+ </xsl:variable>
665
+ <xsl:variable name="isApplyAutolayoutAlgorithm" select="normalize-space($isApplyAutolayoutAlgorithm_)"/>
666
+
662
667
  <xsl:variable name="isGenerateTableIF_">
663
- false
668
+ <xsl:choose>
669
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
670
+ <xsl:value-of select="normalize-space($table_if) = 'true'"/>
671
+ </xsl:when>
672
+ <xsl:otherwise>false</xsl:otherwise>
673
+ </xsl:choose>
664
674
  </xsl:variable>
665
675
  <xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/>
666
676
 
@@ -1338,9 +1348,8 @@
1338
1348
  </xsl:attribute-set>
1339
1349
 
1340
1350
  <xsl:attribute-set name="dt-block-style">
1341
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
1351
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
1342
1352
 
1343
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
1344
1353
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1345
1354
 
1346
1355
  </xsl:attribute-set>
@@ -2372,6 +2381,7 @@
2372
2381
 
2373
2382
  <xsl:variable name="margin-side">
2374
2383
  <xsl:choose>
2384
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
2375
2385
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2376
2386
  <xsl:otherwise>0</xsl:otherwise>
2377
2387
  </xsl:choose>
@@ -2439,6 +2449,7 @@
2439
2449
  </td>
2440
2450
  </tr>
2441
2451
  -->
2452
+ <!-- Simple_table=<xsl:copy-of select="$simple-table"/> -->
2442
2453
  <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2443
2454
 
2444
2455
  </xsl:when>
@@ -2572,12 +2583,17 @@
2572
2583
  <xsl:template name="calculate-column-widths">
2573
2584
  <xsl:param name="table"/>
2574
2585
  <xsl:param name="cols-count"/>
2575
-
2586
+ <xsl:choose>
2587
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
2588
+ <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
2589
+ </xsl:when>
2590
+ <xsl:otherwise>
2576
2591
  <xsl:call-template name="calculate-column-widths-proportional">
2577
2592
  <xsl:with-param name="cols-count" select="$cols-count"/>
2578
2593
  <xsl:with-param name="table" select="$table"/>
2579
2594
  </xsl:call-template>
2580
-
2595
+ </xsl:otherwise>
2596
+ </xsl:choose>
2581
2597
  </xsl:template>
2582
2598
 
2583
2599
  <!-- ================================================== -->
@@ -2755,6 +2771,7 @@
2755
2771
  <!-- (https://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2) -->
2756
2772
  <!-- ================================================== -->
2757
2773
 
2774
+ <!-- INPUT: table with columns widths, generated by table_if.xsl -->
2758
2775
  <xsl:template name="calculate-column-widths-autolayout-algorithm">
2759
2776
  <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2760
2777
 
@@ -2766,67 +2783,6 @@
2766
2783
 
2767
2784
  <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2768
2785
 
2769
- <!-- get current table id -->
2770
- <xsl:variable name="table_id" select="@id"/>
2771
- <!-- find table by id in the file 'table_widths' -->
2772
- <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2773
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2774
-
2775
- <!-- table='<xsl:copy-of select="$table"/>' -->
2776
- <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2777
- <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2778
- <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2779
-
2780
- <xsl:variable name="table_with_cell_widths_">
2781
- <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2782
- </xsl:variable>
2783
- <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2784
-
2785
- <!-- <xsl:if test="$table_if_debug = 'true'">
2786
- <xsl:copy-of select="$table_with_cell_widths"/>
2787
- </xsl:if> -->
2788
-
2789
- <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2790
-
2791
- <xsl:variable name="column_widths_">
2792
- <!-- iteration of columns -->
2793
- <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2794
- <xsl:variable name="pos" select="position()"/>
2795
- <column>
2796
- <xsl:attribute name="width_max">
2797
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2798
- <xsl:sort select="." data-type="number" order="descending"/>
2799
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2800
- </xsl:for-each>
2801
- </xsl:attribute>
2802
- <xsl:attribute name="width_min">
2803
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2804
- <xsl:sort select="." data-type="number" order="descending"/>
2805
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2806
- </xsl:for-each>
2807
- </xsl:attribute>
2808
- </column>
2809
- </xsl:for-each>
2810
- </xsl:variable>
2811
- <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2812
-
2813
- <!-- <column_widths>
2814
- <xsl:copy-of select="$column_widths"/>
2815
- </column_widths> -->
2816
-
2817
- <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2818
- <xsl:variable name="table_widths_">
2819
- <table>
2820
- <xsl:attribute name="width_max">
2821
- <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2822
- </xsl:attribute>
2823
- <xsl:attribute name="width_min">
2824
- <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2825
- </xsl:attribute>
2826
- </table>
2827
- </xsl:variable>
2828
- <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2829
-
2830
2786
  <xsl:variable name="page_width">
2831
2787
  <xsl:choose>
2832
2788
  <xsl:when test="$parent_table_page-width != ''">
@@ -2839,16 +2795,13 @@
2839
2795
  </xsl:variable>
2840
2796
 
2841
2797
  <xsl:if test="$table_if_debug = 'true'">
2842
- <table_width>
2843
- <xsl:copy-of select="$table_widths"/>
2844
- </table_width>
2845
- <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2798
+ <page_width><xsl:value-of select="$page_width"/></page_width>
2846
2799
  </xsl:if>
2847
2800
 
2848
2801
  <!-- There are three cases: -->
2849
2802
  <xsl:choose>
2850
2803
  <!-- 1. The minimum table width is equal to or wider than the available space -->
2851
- <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2804
+ <xsl:when test="@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2852
2805
  <!-- call old algorithm -->
2853
2806
  <case1/>
2854
2807
  <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
@@ -2858,10 +2811,10 @@
2858
2811
  </xsl:call-template> -->
2859
2812
  </xsl:when>
2860
2813
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2861
- <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2814
+ <xsl:when test="@width_max &lt;= $page_width">
2862
2815
  <case2/>
2863
2816
  <autolayout/>
2864
- <xsl:for-each select="$column_widths/column/@width_max">
2817
+ <xsl:for-each select="column/@width_max">
2865
2818
  <column divider="100"><xsl:value-of select="."/></column>
2866
2819
  </xsl:for-each>
2867
2820
  </xsl:when>
@@ -2871,19 +2824,19 @@
2871
2824
  For each column, let d be the difference between maximum and minimum width of that column.
2872
2825
  Now set the column's width to the minimum width plus d times W over D.
2873
2826
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2874
- <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)">
2827
+ <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2875
2828
  <!-- difference between the available space and the minimum table width -->
2876
- <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2829
+ <xsl:variable name="W" select="$page_width - @width_min"/>
2877
2830
  <W><xsl:value-of select="$W"/></W>
2878
2831
  <!-- difference between maximum and minimum width of the table -->
2879
- <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2832
+ <xsl:variable name="D" select="@width_max - @width_min"/>
2880
2833
  <D><xsl:value-of select="$D"/></D>
2881
2834
  <case3/>
2882
2835
  <autolayout/>
2883
- <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2836
+ <xsl:if test="@width_min &gt;= $page_width">
2884
2837
  <split_keep-within-line>true</split_keep-within-line>
2885
2838
  </xsl:if>
2886
- <xsl:for-each select="$column_widths/column">
2839
+ <xsl:for-each select="column">
2887
2840
  <!-- difference between maximum and minimum width of that column. -->
2888
2841
  <xsl:variable name="d" select="@width_max - @width_min"/>
2889
2842
  <d><xsl:value-of select="$d"/></d>
@@ -2909,23 +2862,39 @@
2909
2862
 
2910
2863
  <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2911
2864
 
2865
+ <ancestor_tree>
2866
+ <xsl:for-each select="ancestor::*">
2867
+ <ancestor><xsl:value-of select="local-name()"/></ancestor>
2868
+ </xsl:for-each>
2869
+ </ancestor_tree>
2870
+
2912
2871
  <xsl:variable name="parent_table_page-width_">
2913
2872
  <xsl:if test="$parent_table_id != ''">
2914
2873
  <!-- determine column number in the parent table -->
2915
2874
  <xsl:variable name="parent_table_column_number">
2916
2875
  <xsl:choose>
2917
- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2876
+ <!-- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> -->
2877
+ <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>
2918
2878
  <xsl:otherwise> <!-- parent is table -->
2919
2879
  <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2920
2880
  </xsl:otherwise>
2921
2881
  </xsl:choose>
2922
2882
  </xsl:variable>
2923
2883
  <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2924
- <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2884
+
2885
+ <xsl:variable name="parent_table_column_" select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2886
+ <xsl:variable name="parent_table_column" select="xalan:nodeset($parent_table_column_)"/>
2887
+ <!-- <xsl:variable name="divider">
2888
+ <xsl:value-of select="$parent_table_column/@divider"/>
2889
+ <xsl:if test="not($parent_table_column/@divider)">1</xsl:if>
2890
+ </xsl:variable> -->
2891
+ <xsl:value-of select="$parent_table_column/text()"/> <!-- * 10 -->
2925
2892
  </xsl:if>
2926
2893
  </xsl:variable>
2927
2894
  <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2928
2895
 
2896
+ <parent_table_page-width><xsl:value-of select="$parent_table_page-width"/></parent_table_page-width>
2897
+
2929
2898
  <!-- get current table id -->
2930
2899
  <xsl:variable name="table_id" select="@id"/>
2931
2900
 
@@ -2946,50 +2915,6 @@
2946
2915
 
2947
2916
  </xsl:template> <!-- get-calculated-column-widths-autolayout-algorithm -->
2948
2917
 
2949
- <!-- ============================= -->
2950
- <!-- mode: determine_cell_widths-if -->
2951
- <!-- ============================= -->
2952
- <xsl:template match="@*|node()" mode="determine_cell_widths-if">
2953
- <xsl:copy>
2954
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2955
- </xsl:copy>
2956
- </xsl:template>
2957
-
2958
- <xsl:template match="td | th" mode="determine_cell_widths-if">
2959
- <xsl:copy>
2960
- <xsl:copy-of select="@*"/>
2961
-
2962
- <!-- The maximum width is given by the widest line. -->
2963
- <xsl:attribute name="width_max">
2964
- <xsl:for-each select="p_len">
2965
- <xsl:sort select="." data-type="number" order="descending"/>
2966
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2967
- </xsl:for-each>
2968
- </xsl:attribute>
2969
-
2970
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2971
- <xsl:variable name="width_min">
2972
- <xsl:for-each select="word_len">
2973
- <xsl:sort select="." data-type="number" order="descending"/>
2974
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2975
- </xsl:for-each>
2976
- </xsl:variable>
2977
- <xsl:attribute name="width_min">
2978
- <xsl:value-of select="$width_min"/>
2979
- </xsl:attribute>
2980
-
2981
- <xsl:if test="$width_min = 0">
2982
- <xsl:attribute name="width_min">1</xsl:attribute>
2983
- </xsl:if>
2984
-
2985
- <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
2986
-
2987
- </xsl:copy>
2988
- </xsl:template>
2989
- <!-- ============================= -->
2990
- <!-- END mode: determine_cell_widths-if -->
2991
- <!-- ============================= -->
2992
-
2993
2918
  <!-- ================================================== -->
2994
2919
  <!-- Calculate column's width based on HTML4 algorithm -->
2995
2920
  <!-- ================================================== -->
@@ -3180,6 +3105,7 @@
3180
3105
  <xsl:when test="$table_or_dl = 'table'">
3181
3106
  <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3182
3107
  <fo:table-row number-columns-spanned="{$col_count}">
3108
+ <xsl:copy-of select="../@font-weight"/>
3183
3109
  <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3184
3110
  <xsl:call-template name="td"/>
3185
3111
  </fo:table-row>
@@ -3326,7 +3252,7 @@
3326
3252
 
3327
3253
  <xsl:apply-templates/>
3328
3254
 
3329
- <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"/> -->
3255
+ <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"/> -->
3330
3256
 
3331
3257
  </fo:block>
3332
3258
  </fo:table-cell>
@@ -3663,6 +3589,7 @@
3663
3589
  <xsl:template match="*[local-name()='dl']">
3664
3590
  <xsl:variable name="isAdded" select="@added"/>
3665
3591
  <xsl:variable name="isDeleted" select="@deleted"/>
3592
+ <!-- <dl><xsl:copy-of select="."/></dl> -->
3666
3593
  <fo:block-container>
3667
3594
 
3668
3595
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4196,21 +4123,16 @@
4196
4123
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
4197
4124
  <xsl:template match="*[local-name()='dt']" mode="dl_if">
4198
4125
  <xsl:param name="id"/>
4199
- <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4200
4126
  <tr>
4201
4127
  <td>
4202
4128
  <xsl:copy-of select="node()"/>
4203
4129
  </td>
4204
4130
  <td>
4205
-
4206
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4207
-
4208
- <!-- get paragraphs from nested 'dl' -->
4209
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4210
-
4131
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4132
+ <!-- get paragraphs from nested 'dl' -->
4133
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4211
4134
  </td>
4212
4135
  </tr>
4213
-
4214
4136
  </xsl:template>
4215
4137
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
4216
4138
 
@@ -4864,6 +4786,9 @@
4864
4786
  <xsl:variable name="td">
4865
4787
  <xsl:element name="td">
4866
4788
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4789
+ <xsl:if test="local-name()='th'">
4790
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4791
+ </xsl:if>
4867
4792
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4868
4793
  <xsl:apply-templates mode="simple-table-colspan"/>
4869
4794
  </xsl:element>
@@ -4876,6 +4801,9 @@
4876
4801
  <xsl:otherwise>
4877
4802
  <xsl:element name="td">
4878
4803
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4804
+ <xsl:if test="local-name()='th'">
4805
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4806
+ </xsl:if>
4879
4807
  <xsl:apply-templates mode="simple-table-colspan"/>
4880
4808
  </xsl:element>
4881
4809
  </xsl:otherwise>
@@ -5005,8 +4933,14 @@
5005
4933
  <xsl:copy-of select="@*"/>
5006
4934
  <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
5007
4935
  <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4936
+ <xsl:variable name="divide">
4937
+ <xsl:choose>
4938
+ <xsl:when test="@divide"><xsl:value-of select="@divide"/></xsl:when>
4939
+ <xsl:otherwise>1</xsl:otherwise>
4940
+ </xsl:choose>
4941
+ </xsl:variable>
5008
4942
  <xsl:attribute name="id">
5009
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4943
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5010
4944
  </xsl:attribute>
5011
4945
 
5012
4946
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5014,10 +4948,12 @@
5014
4948
  <xsl:copy-of select="@*"/>
5015
4949
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5016
4950
  <xsl:attribute name="id">
5017
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4951
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5018
4952
  </xsl:attribute>
5019
4953
 
5020
- <xsl:copy-of select="node()"/>
4954
+ <!-- <xsl:copy-of select="node()" /> -->
4955
+ <xsl:apply-templates mode="simple-table-noid"/>
4956
+
5021
4957
  </xsl:copy>
5022
4958
  </xsl:for-each>
5023
4959
 
@@ -5046,7 +4982,7 @@
5046
4982
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5047
4983
  <xsl:copy>
5048
4984
  <xsl:attribute name="id">
5049
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4985
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5050
4986
  </xsl:attribute>
5051
4987
  <xsl:copy-of select="node()"/>
5052
4988
  </xsl:copy>
@@ -5055,6 +4991,24 @@
5055
4991
  </xsl:copy>
5056
4992
 
5057
4993
  </xsl:template>
4994
+
4995
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p']//*" mode="simple-table-noid">
4996
+ <xsl:copy>
4997
+ <xsl:choose>
4998
+ <xsl:when test="$isGenerateTableIF = 'true'">
4999
+ <xsl:copy-of select="@*[local-name() != 'id']"/> <!-- to prevent repeat id in colspan/rowspan cells -->
5000
+ <!-- <xsl:if test="local-name() = 'dl' or local-name() = 'table'">
5001
+ <xsl:copy-of select="@id"/>
5002
+ </xsl:if> -->
5003
+ </xsl:when>
5004
+ <xsl:otherwise>
5005
+ <xsl:copy-of select="@*"/>
5006
+ </xsl:otherwise>
5007
+ </xsl:choose>
5008
+ <xsl:apply-templates select="node()" mode="simple-table-noid"/>
5009
+ </xsl:copy>
5010
+ </xsl:template>
5011
+
5058
5012
  <!-- End mode: simple-table-id -->
5059
5013
  <!-- ===================== -->
5060
5014
  <!-- ===================== -->
@@ -5064,7 +5018,7 @@
5064
5018
  <!-- =============================== -->
5065
5019
  <xsl:template match="@*|node()" mode="td_text_with_formatting">
5066
5020
  <xsl:copy>
5067
- <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5021
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5068
5022
  </xsl:copy>
5069
5023
  </xsl:template>
5070
5024
 
@@ -5178,6 +5132,10 @@
5178
5132
 
5179
5133
  <fo:inline xsl:use-attribute-sets="mathml-style">
5180
5134
 
5135
+ <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 -->
5136
+ <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5137
+ </xsl:if>
5138
+
5181
5139
  <xsl:call-template name="setTrackChangesStyles">
5182
5140
  <xsl:with-param name="isAdded" select="$isAdded"/>
5183
5141
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
@@ -7160,15 +7118,23 @@
7160
7118
 
7161
7119
  <xsl:template match="*[local-name()='tr']" mode="requirement">
7162
7120
  <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
7163
- <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
7164
- <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
7165
- </xsl:if>
7166
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
7167
- <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
7168
- </xsl:if>
7169
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
7170
- <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
7121
+
7122
+ <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 ')">
7123
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
7124
+
7125
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
7126
+ <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
7127
+ <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
7128
+ </xsl:if>
7129
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
7130
+ <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
7131
+ </xsl:if>
7132
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
7133
+ <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
7134
+ </xsl:if>
7135
+
7171
7136
  </xsl:if>
7137
+
7172
7138
  <xsl:apply-templates mode="requirement"/>
7173
7139
  </fo:table-row>
7174
7140
  </xsl:template>
@@ -8678,7 +8644,7 @@
8678
8644
  </tbody>
8679
8645
  </xsl:variable>
8680
8646
  <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
8681
- <xsl:call-template name="calculate-column-widths">
8647
+ <xsl:call-template name="calculate-column-widths-proportional">
8682
8648
  <xsl:with-param name="cols-count" select="$cols-count"/>
8683
8649
  <xsl:with-param name="table" select="$toc_table_simple"/>
8684
8650
  </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>
@@ -135,16 +135,6 @@ module Metanorma
135
135
  xml.hi { |s| s << text }
136
136
  end
137
137
 
138
- def example(node)
139
- role = node.role || node.attr("style")
140
- if %w(requirements_class conformance_test conformance_class
141
- abstract_test).include?(role)
142
- node.set_attr("type", role)
143
- return requirement(node, "requirement")
144
- end
145
- super
146
- end
147
-
148
138
  def set_obligation(attrs, node)
149
139
  if node.attr("style") == "appendix" && node.level == 1
150
140
  attrs[:obligation] = if node.attributes.has_key?("obligation")
@@ -14,52 +14,6 @@ module Metanorma
14
14
  def content_validate(doc)
15
15
  super
16
16
  bibdata_validate(doc.root)
17
- reqt_link_validate(doc.root)
18
- end
19
-
20
- def reqt_link_validate(docxml)
21
- ids = reqt_links(docxml)
22
- reqt_to_conformance(ids, "general", "verification", "Requirement",
23
- "Conformance test")
24
- reqt_to_conformance(ids, "class", "conformanceclass",
25
- "Requirement class", "Conformance class test")
26
- conformance_to_reqt(ids, "general", "verification", "Requirement",
27
- "Conformance test")
28
- conformance_to_reqt(ids, "class", "conformanceclass",
29
- "Requirement class", "Conformance class test")
30
- end
31
-
32
- def reqt_to_conformance(ids, reqtclass, confclass, reqtlabel, conflabel)
33
- ids[reqtclass]&.each do |r|
34
- (r[:label] && ids[confclass]&.any? do |x|
35
- x[:subject] == r[:label]
36
- end) and next
37
- @log.add("Requirements", r[:elem],
38
- "#{reqtlabel} #{r[:label] || r[:id]} "\
39
- "has no corresponding #{conflabel}")
40
- end
41
- end
42
-
43
- def conformance_to_reqt(ids, reqtclass, confclass, reqtlabel, conflabel)
44
- ids[confclass]&.each do |x|
45
- (x[:subject] && ids[reqtclass]&.any? do |r|
46
- x[:subject] == r[:label]
47
- end) and next
48
- @log.add("Requirements", x[:elem],
49
- "#{conflabel} #{x[:label] || x[:id]} "\
50
- "has no corresponding #{reqtlabel}")
51
- end
52
- end
53
-
54
- def reqt_links(docxml)
55
- docxml.xpath("//requirement | //recommendation | //permission")
56
- .each_with_object({}) do |r, m|
57
- type = r["type"]
58
- type.empty? and type = "general"
59
- m[type] ||= []
60
- m[type] << { id: r["id"], elem: r, label: r.at("./identifier")&.text,
61
- subject: r.at("./classification[tag = 'target']/value")&.text }
62
- end
63
17
  end
64
18
 
65
19
  def bibdata_validate(doc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.2.1".freeze
3
+ VERSION = "2.2.2.1".freeze
4
4
  end
5
5
  end
data/lib/metanorma-ogc.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require "metanorma/ogc"
2
2
  require "asciidoctor"
3
3
  require "isodoc/ogc"
4
+ require "metanorma"
4
5
 
5
- if defined? Metanorma
6
+ if defined? Metanorma::Registry
6
7
  Metanorma::Registry.instance.register(Metanorma::Ogc::Processor)
7
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2.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-23 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
@@ -216,6 +216,7 @@ extensions: []
216
216
  extra_rdoc_files: []
217
217
  files:
218
218
  - ".github/workflows/rake.yml"
219
+ - ".github/workflows/release.yml"
219
220
  - ".gitignore"
220
221
  - ".hound.yml"
221
222
  - ".rubocop.yml"
@@ -302,7 +303,7 @@ homepage: https://github.com/metanorma/metanorma-ogc
302
303
  licenses:
303
304
  - BSD-2-Clause
304
305
  metadata: {}
305
- post_install_message:
306
+ post_install_message:
306
307
  rdoc_options: []
307
308
  require_paths:
308
309
  - lib
@@ -317,8 +318,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
318
  - !ruby/object:Gem::Version
318
319
  version: '0'
319
320
  requirements: []
320
- rubygems_version: 3.3.16
321
- signing_key:
321
+ rubygems_version: 3.1.6
322
+ signing_key:
322
323
  specification_version: 4
323
324
  summary: Metanorma for the Open Geospatial Consortium.
324
325
  test_files: []