metanorma-iso 2.1.7 → 2.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -1
  3. data/.github/workflows/release.yml +24 -0
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -2
  5. data/lib/isodoc/iso/html/style-human.scss +35 -1
  6. data/lib/isodoc/iso/html/style-iso.scss +36 -1
  7. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  8. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  9. data/lib/isodoc/iso/i18n-ru.yaml +4 -0
  10. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  11. data/lib/isodoc/iso/init.rb +4 -0
  12. data/lib/isodoc/iso/iso.amendment.xsl +126 -162
  13. data/lib/isodoc/iso/iso.international-standard.xsl +126 -162
  14. data/lib/isodoc/iso/presentation_xml_convert.rb +18 -0
  15. data/lib/isodoc/iso/xref.rb +35 -4
  16. data/lib/metanorma/iso/base.rb +4 -0
  17. data/lib/metanorma/iso/biblio.rng +8 -5
  18. data/lib/metanorma/iso/cleanup.rb +5 -0
  19. data/lib/metanorma/iso/front_id.rb +59 -25
  20. data/lib/metanorma/iso/section.rb +5 -0
  21. data/lib/metanorma/iso/validate.rb +3 -2
  22. data/lib/metanorma/iso/version.rb +1 -1
  23. data/lib/metanorma/requirements/modspec.rb +60 -0
  24. data/lib/metanorma/requirements/requirements.rb +16 -0
  25. data/lib/metanorma-iso.rb +2 -1
  26. data/metanorma-iso.gemspec +1 -1
  27. data/spec/assets/iso.adoc +10 -0
  28. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  29. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  30. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  31. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  32. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  33. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  34. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  35. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  36. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  37. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  38. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  39. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  40. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  41. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  42. data/spec/isodoc/ref_spec.rb +9 -9
  43. data/spec/metanorma/amd_spec.rb +0 -10
  44. data/spec/metanorma/base_spec.rb +0 -10
  45. data/spec/metanorma/cleanup_spec.rb +136 -0
  46. data/spec/metanorma/macros_spec.rb +99 -0
  47. data/spec/metanorma/processor_spec.rb +86 -86
  48. data/spec/metanorma/validate_spec.rb +41 -40
  49. data/spec/requirements/requirements_spec.rb +1299 -0
  50. data/spec/requirements/xref_spec.rb +1205 -0
  51. data/spec/vcr_cassettes/docrels.yml +385 -0
  52. metadata +40 -25
  53. data/lib/isodoc/iso/html/htmlstyle.css +0 -47
  54. data/lib/isodoc/iso/html/isodoc-dis.css +0 -4493
  55. data/lib/isodoc/iso/html/isodoc.css +0 -1346
  56. data/lib/isodoc/iso/html/style-human.css +0 -1030
  57. data/lib/isodoc/iso/html/style-iso.css +0 -1056
  58. data/lib/isodoc/iso/html/wordstyle-dis.css +0 -2280
  59. data/lib/isodoc/iso/html/wordstyle.css +0 -1728
@@ -453,9 +453,12 @@
453
453
  <fo:table-body>
454
454
  <fo:table-row>
455
455
  <fo:table-cell font-size="6.5pt" text-align="justify" display-align="after" padding-bottom="8mm">
456
+ <xsl:if test="$stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
457
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
458
+ </xsl:if>
456
459
  <!-- margin-top="-30mm" -->
457
460
  <fo:block> <!-- margin-top="-100mm" -->
458
- <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
461
+ <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
459
462
  <fo:block margin-bottom="1.5mm">
460
463
  <xsl:text>THIS DOCUMENT IS A DRAFT CIRCULATED FOR COMMENT AND APPROVAL. IT IS THEREFORE SUBJECT TO CHANGE AND MAY NOT BE REFERRED TO AS AN INTERNATIONAL STANDARD UNTIL PUBLISHED AS SUCH.</xsl:text>
461
464
  </fo:block>
@@ -494,7 +497,7 @@
494
497
  </xsl:if>
495
498
 
496
499
  <fo:block>
497
- <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'FDIS'">
500
+ <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
498
501
  <xsl:variable name="text">
499
502
  <xsl:for-each select="/iso:iso-standard/iso:preface/iso:note[@coverpage='true']/iso:p">
500
503
  <fo:block>
@@ -610,7 +613,7 @@
610
613
 
611
614
  <xsl:choose>
612
615
  <!-- COVER PAGE for DIS document only -->
613
- <xsl:when test="$stage-abbreviation = 'DIS'">
616
+ <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
614
617
  <fo:flow flow-name="xsl-region-body">
615
618
  <fo:block-container>
616
619
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
@@ -635,7 +638,7 @@
635
638
  </fo:block>
636
639
  </fo:table-cell>
637
640
  <fo:table-cell>
638
- <fo:block>
641
+ <fo:block margin-bottom="3mm">
639
642
  <xsl:copy-of select="$secretariat"/>
640
643
  </fo:block>
641
644
  </fo:table-cell>
@@ -730,10 +733,10 @@
730
733
  </fo:block-container>
731
734
  </fo:flow>
732
735
 
733
- </xsl:when> <!-- END: $stage-abbreviation = 'DIS' -->
736
+ </xsl:when> <!-- END: $stage-abbreviation = 'DIS' 'DAmd' 'DAM'-->
734
737
  <xsl:otherwise>
735
738
 
736
- <!-- COVER PAGE for all documents except DIS -->
739
+ <!-- COVER PAGE for all documents except DIS, DAmd and DAM -->
737
740
  <fo:flow flow-name="xsl-region-body">
738
741
  <fo:block-container>
739
742
  <fo:table table-layout="fixed" width="100%" font-size="24pt" line-height="1"> <!-- margin-bottom="35mm" -->
@@ -769,7 +772,7 @@
769
772
  <fo:table-cell>
770
773
  <fo:block text-align="left">
771
774
  <xsl:choose>
772
- <xsl:when test="$stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'"><xsl:value-of select="$doctype_uppercased"/></xsl:when>
775
+ <xsl:when test="$stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM'"><xsl:value-of select="$doctype_uppercased"/></xsl:when>
773
776
  <xsl:when test="$doctype = 'amendment'">
774
777
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:updates-document-type,'-',' ')))"/>
775
778
  </xsl:when>
@@ -818,7 +821,7 @@
818
821
  </fo:block>
819
822
  <!-- <xsl:value-of select="$linebreak"/>
820
823
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
821
- <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM')">
824
+ <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
822
825
  <fo:block text-align="right" margin-right="0.5mm">
823
826
  <fo:block font-weight="bold" margin-top="4pt" role="H1">
824
827
  <xsl:value-of select="$doctype_uppercased"/>
@@ -876,7 +879,7 @@
876
879
  <fo:table-row> <!-- border="1pt solid black" height="150mm" -->
877
880
  <fo:table-cell font-size="11pt">
878
881
  <fo:block>
879
- <xsl:if test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
882
+ <xsl:if test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM'">
880
883
  <fo:block-container border="0.5mm solid black" width="51mm">
881
884
  <fo:block margin="2mm">
882
885
  <fo:block margin-bottom="8pt"><xsl:copy-of select="$editorialgroup"/></fo:block>
@@ -929,7 +932,7 @@
929
932
 
930
933
  </fo:block>
931
934
 
932
- <xsl:if test="not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM')">
935
+ <xsl:if test="not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
933
936
  <xsl:for-each select="xalan:nodeset($lang_other)/lang">
934
937
  <xsl:variable name="lang_other" select="."/>
935
938
 
@@ -1594,13 +1597,19 @@
1594
1597
  </xsl:if>
1595
1598
 
1596
1599
  <fo:block font-weight="normal" line-height="1.1">
1597
- <xsl:value-of select="$doctype_uppercased"/>
1600
+ <xsl:choose>
1601
+ <xsl:when test="$isMainLang = 'false' and $curr_lang = 'fr'">AMENDEMENT</xsl:when>
1602
+ <xsl:otherwise><xsl:value-of select="$doctype_uppercased"/></xsl:otherwise>
1603
+ </xsl:choose>
1598
1604
  <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1599
1605
  <xsl:if test="normalize-space($amendment-number) != ''">
1600
1606
  <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1601
1607
  </xsl:if>
1602
- <xsl:text>: </xsl:text>
1603
- <xsl:apply-templates/>
1608
+
1609
+ <xsl:if test="not($stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM')">
1610
+ <xsl:text>: </xsl:text>
1611
+ <xsl:apply-templates/>
1612
+ </xsl:if>
1604
1613
  </fo:block>
1605
1614
 
1606
1615
  </fo:block>
@@ -2142,10 +2151,18 @@
2142
2151
 
2143
2152
  <xsl:param name="table_if_debug">false</xsl:param> <!-- set 'true' to put debug width data before table or dl -->
2144
2153
 
2145
- <xsl:variable name="isGenerateTableIF_">
2154
+ <xsl:variable name="isApplyAutolayoutAlgorithm_">
2155
+ true
2156
+ </xsl:variable>
2157
+ <xsl:variable name="isApplyAutolayoutAlgorithm" select="normalize-space($isApplyAutolayoutAlgorithm_)"/>
2146
2158
 
2159
+ <xsl:variable name="isGenerateTableIF_">
2160
+ <xsl:choose>
2161
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
2147
2162
  <xsl:value-of select="normalize-space($table_if) = 'true'"/>
2148
-
2163
+ </xsl:when>
2164
+ <xsl:otherwise>false</xsl:otherwise>
2165
+ </xsl:choose>
2149
2166
  </xsl:variable>
2150
2167
  <xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/>
2151
2168
 
@@ -2793,9 +2810,7 @@
2793
2810
  </xsl:attribute-set>
2794
2811
 
2795
2812
  <xsl:attribute-set name="dt-block-style">
2796
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
2797
-
2798
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
2813
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
2799
2814
 
2800
2815
  </xsl:attribute-set>
2801
2816
 
@@ -3764,6 +3779,7 @@
3764
3779
 
3765
3780
  <xsl:variable name="margin-side">
3766
3781
  <xsl:choose>
3782
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
3767
3783
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3768
3784
  <xsl:otherwise>0</xsl:otherwise>
3769
3785
  </xsl:choose>
@@ -3834,6 +3850,7 @@
3834
3850
  </td>
3835
3851
  </tr>
3836
3852
  -->
3853
+ <!-- Simple_table=<xsl:copy-of select="$simple-table"/> -->
3837
3854
  <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
3838
3855
 
3839
3856
  </xsl:when>
@@ -3970,9 +3987,17 @@
3970
3987
  <xsl:template name="calculate-column-widths">
3971
3988
  <xsl:param name="table"/>
3972
3989
  <xsl:param name="cols-count"/>
3973
-
3990
+ <xsl:choose>
3991
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
3974
3992
  <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
3975
-
3993
+ </xsl:when>
3994
+ <xsl:otherwise>
3995
+ <xsl:call-template name="calculate-column-widths-proportional">
3996
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3997
+ <xsl:with-param name="table" select="$table"/>
3998
+ </xsl:call-template>
3999
+ </xsl:otherwise>
4000
+ </xsl:choose>
3976
4001
  </xsl:template>
3977
4002
 
3978
4003
  <!-- ================================================== -->
@@ -4150,6 +4175,7 @@
4150
4175
  <!-- (https://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2) -->
4151
4176
  <!-- ================================================== -->
4152
4177
 
4178
+ <!-- INPUT: table with columns widths, generated by table_if.xsl -->
4153
4179
  <xsl:template name="calculate-column-widths-autolayout-algorithm">
4154
4180
  <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
4155
4181
 
@@ -4161,67 +4187,6 @@
4161
4187
 
4162
4188
  <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
4163
4189
 
4164
- <!-- get current table id -->
4165
- <xsl:variable name="table_id" select="@id"/>
4166
- <!-- find table by id in the file 'table_widths' -->
4167
- <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
4168
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
4169
-
4170
- <!-- table='<xsl:copy-of select="$table"/>' -->
4171
- <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
4172
- <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
4173
- <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
4174
-
4175
- <xsl:variable name="table_with_cell_widths_">
4176
- <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
4177
- </xsl:variable>
4178
- <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
4179
-
4180
- <!-- <xsl:if test="$table_if_debug = 'true'">
4181
- <xsl:copy-of select="$table_with_cell_widths"/>
4182
- </xsl:if> -->
4183
-
4184
- <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
4185
-
4186
- <xsl:variable name="column_widths_">
4187
- <!-- iteration of columns -->
4188
- <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
4189
- <xsl:variable name="pos" select="position()"/>
4190
- <column>
4191
- <xsl:attribute name="width_max">
4192
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
4193
- <xsl:sort select="." data-type="number" order="descending"/>
4194
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4195
- </xsl:for-each>
4196
- </xsl:attribute>
4197
- <xsl:attribute name="width_min">
4198
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
4199
- <xsl:sort select="." data-type="number" order="descending"/>
4200
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4201
- </xsl:for-each>
4202
- </xsl:attribute>
4203
- </column>
4204
- </xsl:for-each>
4205
- </xsl:variable>
4206
- <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
4207
-
4208
- <!-- <column_widths>
4209
- <xsl:copy-of select="$column_widths"/>
4210
- </column_widths> -->
4211
-
4212
- <!-- These in turn, are used to find the minimum and maximum width for the table. -->
4213
- <xsl:variable name="table_widths_">
4214
- <table>
4215
- <xsl:attribute name="width_max">
4216
- <xsl:value-of select="sum($column_widths/column/@width_max)"/>
4217
- </xsl:attribute>
4218
- <xsl:attribute name="width_min">
4219
- <xsl:value-of select="sum($column_widths/column/@width_min)"/>
4220
- </xsl:attribute>
4221
- </table>
4222
- </xsl:variable>
4223
- <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
4224
-
4225
4190
  <xsl:variable name="page_width">
4226
4191
  <xsl:choose>
4227
4192
  <xsl:when test="$parent_table_page-width != ''">
@@ -4234,16 +4199,13 @@
4234
4199
  </xsl:variable>
4235
4200
 
4236
4201
  <xsl:if test="$table_if_debug = 'true'">
4237
- <table_width>
4238
- <xsl:copy-of select="$table_widths"/>
4239
- </table_width>
4240
- <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
4202
+ <page_width><xsl:value-of select="$page_width"/></page_width>
4241
4203
  </xsl:if>
4242
4204
 
4243
4205
  <!-- There are three cases: -->
4244
4206
  <xsl:choose>
4245
4207
  <!-- 1. The minimum table width is equal to or wider than the available space -->
4246
- <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
4208
+ <xsl:when test="@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
4247
4209
  <!-- call old algorithm -->
4248
4210
  <case1/>
4249
4211
  <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
@@ -4253,10 +4215,10 @@
4253
4215
  </xsl:call-template> -->
4254
4216
  </xsl:when>
4255
4217
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
4256
- <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
4218
+ <xsl:when test="@width_max &lt;= $page_width">
4257
4219
  <case2/>
4258
4220
  <autolayout/>
4259
- <xsl:for-each select="$column_widths/column/@width_max">
4221
+ <xsl:for-each select="column/@width_max">
4260
4222
  <column divider="100"><xsl:value-of select="."/></column>
4261
4223
  </xsl:for-each>
4262
4224
  </xsl:when>
@@ -4266,19 +4228,19 @@
4266
4228
  For each column, let d be the difference between maximum and minimum width of that column.
4267
4229
  Now set the column's width to the minimum width plus d times W over D.
4268
4230
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
4269
- <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)">
4231
+ <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
4270
4232
  <!-- difference between the available space and the minimum table width -->
4271
- <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
4233
+ <xsl:variable name="W" select="$page_width - @width_min"/>
4272
4234
  <W><xsl:value-of select="$W"/></W>
4273
4235
  <!-- difference between maximum and minimum width of the table -->
4274
- <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
4236
+ <xsl:variable name="D" select="@width_max - @width_min"/>
4275
4237
  <D><xsl:value-of select="$D"/></D>
4276
4238
  <case3/>
4277
4239
  <autolayout/>
4278
- <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
4240
+ <xsl:if test="@width_min &gt;= $page_width">
4279
4241
  <split_keep-within-line>true</split_keep-within-line>
4280
4242
  </xsl:if>
4281
- <xsl:for-each select="$column_widths/column">
4243
+ <xsl:for-each select="column">
4282
4244
  <!-- difference between maximum and minimum width of that column. -->
4283
4245
  <xsl:variable name="d" select="@width_max - @width_min"/>
4284
4246
  <d><xsl:value-of select="$d"/></d>
@@ -4304,23 +4266,39 @@
4304
4266
 
4305
4267
  <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
4306
4268
 
4269
+ <ancestor_tree>
4270
+ <xsl:for-each select="ancestor::*">
4271
+ <ancestor><xsl:value-of select="local-name()"/></ancestor>
4272
+ </xsl:for-each>
4273
+ </ancestor_tree>
4274
+
4307
4275
  <xsl:variable name="parent_table_page-width_">
4308
4276
  <xsl:if test="$parent_table_id != ''">
4309
4277
  <!-- determine column number in the parent table -->
4310
4278
  <xsl:variable name="parent_table_column_number">
4311
4279
  <xsl:choose>
4312
- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
4280
+ <!-- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> -->
4281
+ <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>
4313
4282
  <xsl:otherwise> <!-- parent is table -->
4314
4283
  <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
4315
4284
  </xsl:otherwise>
4316
4285
  </xsl:choose>
4317
4286
  </xsl:variable>
4318
4287
  <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
4319
- <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
4288
+
4289
+ <xsl:variable name="parent_table_column_" select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
4290
+ <xsl:variable name="parent_table_column" select="xalan:nodeset($parent_table_column_)"/>
4291
+ <!-- <xsl:variable name="divider">
4292
+ <xsl:value-of select="$parent_table_column/@divider"/>
4293
+ <xsl:if test="not($parent_table_column/@divider)">1</xsl:if>
4294
+ </xsl:variable> -->
4295
+ <xsl:value-of select="$parent_table_column/text()"/> <!-- * 10 -->
4320
4296
  </xsl:if>
4321
4297
  </xsl:variable>
4322
4298
  <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
4323
4299
 
4300
+ <parent_table_page-width><xsl:value-of select="$parent_table_page-width"/></parent_table_page-width>
4301
+
4324
4302
  <!-- get current table id -->
4325
4303
  <xsl:variable name="table_id" select="@id"/>
4326
4304
 
@@ -4341,50 +4319,6 @@
4341
4319
 
4342
4320
  </xsl:template> <!-- get-calculated-column-widths-autolayout-algorithm -->
4343
4321
 
4344
- <!-- ============================= -->
4345
- <!-- mode: determine_cell_widths-if -->
4346
- <!-- ============================= -->
4347
- <xsl:template match="@*|node()" mode="determine_cell_widths-if">
4348
- <xsl:copy>
4349
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
4350
- </xsl:copy>
4351
- </xsl:template>
4352
-
4353
- <xsl:template match="td | th" mode="determine_cell_widths-if">
4354
- <xsl:copy>
4355
- <xsl:copy-of select="@*"/>
4356
-
4357
- <!-- The maximum width is given by the widest line. -->
4358
- <xsl:attribute name="width_max">
4359
- <xsl:for-each select="p_len">
4360
- <xsl:sort select="." data-type="number" order="descending"/>
4361
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4362
- </xsl:for-each>
4363
- </xsl:attribute>
4364
-
4365
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
4366
- <xsl:variable name="width_min">
4367
- <xsl:for-each select="word_len">
4368
- <xsl:sort select="." data-type="number" order="descending"/>
4369
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
4370
- </xsl:for-each>
4371
- </xsl:variable>
4372
- <xsl:attribute name="width_min">
4373
- <xsl:value-of select="$width_min"/>
4374
- </xsl:attribute>
4375
-
4376
- <xsl:if test="$width_min = 0">
4377
- <xsl:attribute name="width_min">1</xsl:attribute>
4378
- </xsl:if>
4379
-
4380
- <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
4381
-
4382
- </xsl:copy>
4383
- </xsl:template>
4384
- <!-- ============================= -->
4385
- <!-- END mode: determine_cell_widths-if -->
4386
- <!-- ============================= -->
4387
-
4388
4322
  <!-- ================================================== -->
4389
4323
  <!-- Calculate column's width based on HTML4 algorithm -->
4390
4324
  <!-- ================================================== -->
@@ -4629,6 +4563,7 @@
4629
4563
  <xsl:when test="$table_or_dl = 'table'">
4630
4564
  <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
4631
4565
  <fo:table-row number-columns-spanned="{$col_count}">
4566
+ <xsl:copy-of select="../@font-weight"/>
4632
4567
  <!-- <test_table><xsl:copy-of select="."/></test_table> -->
4633
4568
  <xsl:call-template name="td"/>
4634
4569
  </fo:table-row>
@@ -4790,7 +4725,7 @@
4790
4725
 
4791
4726
  <xsl:apply-templates/>
4792
4727
 
4793
- <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"/> -->
4728
+ <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"/> -->
4794
4729
 
4795
4730
  </fo:block>
4796
4731
  </fo:table-cell>
@@ -5123,6 +5058,7 @@
5123
5058
  <xsl:template match="*[local-name()='dl']">
5124
5059
  <xsl:variable name="isAdded" select="@added"/>
5125
5060
  <xsl:variable name="isDeleted" select="@deleted"/>
5061
+ <!-- <dl><xsl:copy-of select="."/></dl> -->
5126
5062
  <fo:block-container>
5127
5063
 
5128
5064
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -5674,21 +5610,16 @@
5674
5610
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
5675
5611
  <xsl:template match="*[local-name()='dt']" mode="dl_if">
5676
5612
  <xsl:param name="id"/>
5677
- <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
5678
5613
  <tr>
5679
5614
  <td>
5680
5615
  <xsl:copy-of select="node()"/>
5681
5616
  </td>
5682
5617
  <td>
5683
-
5684
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5685
-
5686
- <!-- get paragraphs from nested 'dl' -->
5687
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5688
-
5618
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5619
+ <!-- get paragraphs from nested 'dl' -->
5620
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5689
5621
  </td>
5690
5622
  </tr>
5691
-
5692
5623
  </xsl:template>
5693
5624
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
5694
5625
 
@@ -6339,6 +6270,9 @@
6339
6270
  <xsl:variable name="td">
6340
6271
  <xsl:element name="td">
6341
6272
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
6273
+ <xsl:if test="local-name()='th'">
6274
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
6275
+ </xsl:if>
6342
6276
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
6343
6277
  <xsl:apply-templates mode="simple-table-colspan"/>
6344
6278
  </xsl:element>
@@ -6351,6 +6285,9 @@
6351
6285
  <xsl:otherwise>
6352
6286
  <xsl:element name="td">
6353
6287
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
6288
+ <xsl:if test="local-name()='th'">
6289
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
6290
+ </xsl:if>
6354
6291
  <xsl:apply-templates mode="simple-table-colspan"/>
6355
6292
  </xsl:element>
6356
6293
  </xsl:otherwise>
@@ -6480,8 +6417,14 @@
6480
6417
  <xsl:copy-of select="@*"/>
6481
6418
  <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
6482
6419
  <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
6420
+ <xsl:variable name="divide">
6421
+ <xsl:choose>
6422
+ <xsl:when test="@divide"><xsl:value-of select="@divide"/></xsl:when>
6423
+ <xsl:otherwise>1</xsl:otherwise>
6424
+ </xsl:choose>
6425
+ </xsl:variable>
6483
6426
  <xsl:attribute name="id">
6484
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
6427
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
6485
6428
  </xsl:attribute>
6486
6429
 
6487
6430
  <xsl:for-each select="*[local-name() = 'p']">
@@ -6489,10 +6432,12 @@
6489
6432
  <xsl:copy-of select="@*"/>
6490
6433
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
6491
6434
  <xsl:attribute name="id">
6492
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
6435
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
6493
6436
  </xsl:attribute>
6494
6437
 
6495
- <xsl:copy-of select="node()"/>
6438
+ <!-- <xsl:copy-of select="node()" /> -->
6439
+ <xsl:apply-templates mode="simple-table-noid"/>
6440
+
6496
6441
  </xsl:copy>
6497
6442
  </xsl:for-each>
6498
6443
 
@@ -6521,7 +6466,7 @@
6521
6466
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
6522
6467
  <xsl:copy>
6523
6468
  <xsl:attribute name="id">
6524
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
6469
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
6525
6470
  </xsl:attribute>
6526
6471
  <xsl:copy-of select="node()"/>
6527
6472
  </xsl:copy>
@@ -6530,6 +6475,24 @@
6530
6475
  </xsl:copy>
6531
6476
 
6532
6477
  </xsl:template>
6478
+
6479
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p']//*" mode="simple-table-noid">
6480
+ <xsl:copy>
6481
+ <xsl:choose>
6482
+ <xsl:when test="$isGenerateTableIF = 'true'">
6483
+ <xsl:copy-of select="@*[local-name() != 'id']"/> <!-- to prevent repeat id in colspan/rowspan cells -->
6484
+ <!-- <xsl:if test="local-name() = 'dl' or local-name() = 'table'">
6485
+ <xsl:copy-of select="@id"/>
6486
+ </xsl:if> -->
6487
+ </xsl:when>
6488
+ <xsl:otherwise>
6489
+ <xsl:copy-of select="@*"/>
6490
+ </xsl:otherwise>
6491
+ </xsl:choose>
6492
+ <xsl:apply-templates select="node()" mode="simple-table-noid"/>
6493
+ </xsl:copy>
6494
+ </xsl:template>
6495
+
6533
6496
  <!-- End mode: simple-table-id -->
6534
6497
  <!-- ===================== -->
6535
6498
  <!-- ===================== -->
@@ -6539,7 +6502,7 @@
6539
6502
  <!-- =============================== -->
6540
6503
  <xsl:template match="@*|node()" mode="td_text_with_formatting">
6541
6504
  <xsl:copy>
6542
- <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
6505
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
6543
6506
  </xsl:copy>
6544
6507
  </xsl:template>
6545
6508
 
@@ -6653,6 +6616,10 @@
6653
6616
 
6654
6617
  <fo:inline xsl:use-attribute-sets="mathml-style">
6655
6618
 
6619
+ <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 -->
6620
+ <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
6621
+ </xsl:if>
6622
+
6656
6623
  <xsl:call-template name="setTrackChangesStyles">
6657
6624
  <xsl:with-param name="isAdded" select="$isAdded"/>
6658
6625
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
@@ -8644,15 +8611,12 @@
8644
8611
 
8645
8612
  <xsl:template match="*[local-name()='tr']" mode="requirement">
8646
8613
  <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
8647
- <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
8648
- <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
8649
- </xsl:if>
8650
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
8651
- <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
8652
- </xsl:if>
8653
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
8654
- <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
8614
+
8615
+ <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 ')">
8616
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
8617
+
8655
8618
  </xsl:if>
8619
+
8656
8620
  <xsl:apply-templates mode="requirement"/>
8657
8621
  </fo:table-row>
8658
8622
  </xsl:template>
@@ -10170,7 +10134,7 @@
10170
10134
  </tbody>
10171
10135
  </xsl:variable>
10172
10136
  <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
10173
- <xsl:call-template name="calculate-column-widths">
10137
+ <xsl:call-template name="calculate-column-widths-proportional">
10174
10138
  <xsl:with-param name="cols-count" select="$cols-count"/>
10175
10139
  <xsl:with-param name="table" select="$toc_table_simple"/>
10176
10140
  </xsl:call-template>