metanorma-ieee 0.0.4 → 0.0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3760,10 +3760,18 @@
3760
3760
 
3761
3761
  <xsl:param name="table_if_debug">false</xsl:param> <!-- set 'true' to put debug width data before table or dl -->
3762
3762
 
3763
- <xsl:variable name="isGenerateTableIF_">
3763
+ <xsl:variable name="isApplyAutolayoutAlgorithm_">
3764
+ true
3765
+ </xsl:variable>
3766
+ <xsl:variable name="isApplyAutolayoutAlgorithm" select="normalize-space($isApplyAutolayoutAlgorithm_)"/>
3764
3767
 
3768
+ <xsl:variable name="isGenerateTableIF_">
3769
+ <xsl:choose>
3770
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
3765
3771
  <xsl:value-of select="normalize-space($table_if) = 'true'"/>
3766
-
3772
+ </xsl:when>
3773
+ <xsl:otherwise>false</xsl:otherwise>
3774
+ </xsl:choose>
3767
3775
  </xsl:variable>
3768
3776
  <xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/>
3769
3777
 
@@ -4177,6 +4185,9 @@
4177
4185
  <xsl:attribute-set name="import-style">
4178
4186
  </xsl:attribute-set>
4179
4187
 
4188
+ <xsl:attribute-set name="component-style">
4189
+ </xsl:attribute-set>
4190
+
4180
4191
  <xsl:attribute-set name="recommendation-style">
4181
4192
 
4182
4193
  </xsl:attribute-set>
@@ -4387,10 +4398,9 @@
4387
4398
  </xsl:attribute-set>
4388
4399
 
4389
4400
  <xsl:attribute-set name="dt-block-style">
4390
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
4401
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
4391
4402
 
4392
4403
  <xsl:attribute name="margin-left">2mm</xsl:attribute>
4393
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
4394
4404
  <xsl:attribute name="line-height">1.2</xsl:attribute>
4395
4405
 
4396
4406
  </xsl:attribute-set>
@@ -5344,6 +5354,7 @@
5344
5354
 
5345
5355
  <xsl:variable name="margin-side">
5346
5356
  <xsl:choose>
5357
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
5347
5358
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
5348
5359
  <xsl:otherwise>0</xsl:otherwise>
5349
5360
  </xsl:choose>
@@ -5428,6 +5439,7 @@
5428
5439
  </td>
5429
5440
  </tr>
5430
5441
  -->
5442
+ <!-- Simple_table=<xsl:copy-of select="$simple-table"/> -->
5431
5443
  <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
5432
5444
 
5433
5445
  </xsl:when>
@@ -5539,9 +5551,17 @@
5539
5551
  <xsl:template name="calculate-column-widths">
5540
5552
  <xsl:param name="table"/>
5541
5553
  <xsl:param name="cols-count"/>
5542
-
5554
+ <xsl:choose>
5555
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
5543
5556
  <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
5544
-
5557
+ </xsl:when>
5558
+ <xsl:otherwise>
5559
+ <xsl:call-template name="calculate-column-widths-proportional">
5560
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5561
+ <xsl:with-param name="table" select="$table"/>
5562
+ </xsl:call-template>
5563
+ </xsl:otherwise>
5564
+ </xsl:choose>
5545
5565
  </xsl:template>
5546
5566
 
5547
5567
  <!-- ================================================== -->
@@ -5719,6 +5739,7 @@
5719
5739
  <!-- (https://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2) -->
5720
5740
  <!-- ================================================== -->
5721
5741
 
5742
+ <!-- INPUT: table with columns widths, generated by table_if.xsl -->
5722
5743
  <xsl:template name="calculate-column-widths-autolayout-algorithm">
5723
5744
  <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
5724
5745
 
@@ -5730,67 +5751,6 @@
5730
5751
 
5731
5752
  <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
5732
5753
 
5733
- <!-- get current table id -->
5734
- <xsl:variable name="table_id" select="@id"/>
5735
- <!-- find table by id in the file 'table_widths' -->
5736
- <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
5737
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
5738
-
5739
- <!-- table='<xsl:copy-of select="$table"/>' -->
5740
- <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
5741
- <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
5742
- <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
5743
-
5744
- <xsl:variable name="table_with_cell_widths_">
5745
- <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
5746
- </xsl:variable>
5747
- <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
5748
-
5749
- <!-- <xsl:if test="$table_if_debug = 'true'">
5750
- <xsl:copy-of select="$table_with_cell_widths"/>
5751
- </xsl:if> -->
5752
-
5753
- <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
5754
-
5755
- <xsl:variable name="column_widths_">
5756
- <!-- iteration of columns -->
5757
- <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
5758
- <xsl:variable name="pos" select="position()"/>
5759
- <column>
5760
- <xsl:attribute name="width_max">
5761
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
5762
- <xsl:sort select="." data-type="number" order="descending"/>
5763
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
5764
- </xsl:for-each>
5765
- </xsl:attribute>
5766
- <xsl:attribute name="width_min">
5767
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
5768
- <xsl:sort select="." data-type="number" order="descending"/>
5769
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
5770
- </xsl:for-each>
5771
- </xsl:attribute>
5772
- </column>
5773
- </xsl:for-each>
5774
- </xsl:variable>
5775
- <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
5776
-
5777
- <!-- <column_widths>
5778
- <xsl:copy-of select="$column_widths"/>
5779
- </column_widths> -->
5780
-
5781
- <!-- These in turn, are used to find the minimum and maximum width for the table. -->
5782
- <xsl:variable name="table_widths_">
5783
- <table>
5784
- <xsl:attribute name="width_max">
5785
- <xsl:value-of select="sum($column_widths/column/@width_max)"/>
5786
- </xsl:attribute>
5787
- <xsl:attribute name="width_min">
5788
- <xsl:value-of select="sum($column_widths/column/@width_min)"/>
5789
- </xsl:attribute>
5790
- </table>
5791
- </xsl:variable>
5792
- <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
5793
-
5794
5754
  <xsl:variable name="page_width">
5795
5755
  <xsl:choose>
5796
5756
  <xsl:when test="$parent_table_page-width != ''">
@@ -5803,16 +5763,13 @@
5803
5763
  </xsl:variable>
5804
5764
 
5805
5765
  <xsl:if test="$table_if_debug = 'true'">
5806
- <table_width>
5807
- <xsl:copy-of select="$table_widths"/>
5808
- </table_width>
5809
- <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
5766
+ <page_width><xsl:value-of select="$page_width"/></page_width>
5810
5767
  </xsl:if>
5811
5768
 
5812
5769
  <!-- There are three cases: -->
5813
5770
  <xsl:choose>
5814
5771
  <!-- 1. The minimum table width is equal to or wider than the available space -->
5815
- <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
5772
+ <xsl:when test="@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
5816
5773
  <!-- call old algorithm -->
5817
5774
  <case1/>
5818
5775
  <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
@@ -5822,10 +5779,10 @@
5822
5779
  </xsl:call-template> -->
5823
5780
  </xsl:when>
5824
5781
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
5825
- <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
5782
+ <xsl:when test="@width_max &lt;= $page_width">
5826
5783
  <case2/>
5827
5784
  <autolayout/>
5828
- <xsl:for-each select="$column_widths/column/@width_max">
5785
+ <xsl:for-each select="column/@width_max">
5829
5786
  <column divider="100"><xsl:value-of select="."/></column>
5830
5787
  </xsl:for-each>
5831
5788
  </xsl:when>
@@ -5835,19 +5792,19 @@
5835
5792
  For each column, let d be the difference between maximum and minimum width of that column.
5836
5793
  Now set the column's width to the minimum width plus d times W over D.
5837
5794
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
5838
- <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)">
5795
+ <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
5839
5796
  <!-- difference between the available space and the minimum table width -->
5840
- <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
5797
+ <xsl:variable name="W" select="$page_width - @width_min"/>
5841
5798
  <W><xsl:value-of select="$W"/></W>
5842
5799
  <!-- difference between maximum and minimum width of the table -->
5843
- <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
5800
+ <xsl:variable name="D" select="@width_max - @width_min"/>
5844
5801
  <D><xsl:value-of select="$D"/></D>
5845
5802
  <case3/>
5846
5803
  <autolayout/>
5847
- <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
5804
+ <xsl:if test="@width_min &gt;= $page_width">
5848
5805
  <split_keep-within-line>true</split_keep-within-line>
5849
5806
  </xsl:if>
5850
- <xsl:for-each select="$column_widths/column">
5807
+ <xsl:for-each select="column">
5851
5808
  <!-- difference between maximum and minimum width of that column. -->
5852
5809
  <xsl:variable name="d" select="@width_max - @width_min"/>
5853
5810
  <d><xsl:value-of select="$d"/></d>
@@ -5873,23 +5830,39 @@
5873
5830
 
5874
5831
  <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
5875
5832
 
5833
+ <ancestor_tree>
5834
+ <xsl:for-each select="ancestor::*">
5835
+ <ancestor><xsl:value-of select="local-name()"/></ancestor>
5836
+ </xsl:for-each>
5837
+ </ancestor_tree>
5838
+
5876
5839
  <xsl:variable name="parent_table_page-width_">
5877
5840
  <xsl:if test="$parent_table_id != ''">
5878
5841
  <!-- determine column number in the parent table -->
5879
5842
  <xsl:variable name="parent_table_column_number">
5880
5843
  <xsl:choose>
5881
- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
5844
+ <!-- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> -->
5845
+ <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>
5882
5846
  <xsl:otherwise> <!-- parent is table -->
5883
5847
  <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
5884
5848
  </xsl:otherwise>
5885
5849
  </xsl:choose>
5886
5850
  </xsl:variable>
5887
5851
  <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
5888
- <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
5852
+
5853
+ <xsl:variable name="parent_table_column_" select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
5854
+ <xsl:variable name="parent_table_column" select="xalan:nodeset($parent_table_column_)"/>
5855
+ <!-- <xsl:variable name="divider">
5856
+ <xsl:value-of select="$parent_table_column/@divider"/>
5857
+ <xsl:if test="not($parent_table_column/@divider)">1</xsl:if>
5858
+ </xsl:variable> -->
5859
+ <xsl:value-of select="$parent_table_column/text()"/> <!-- * 10 -->
5889
5860
  </xsl:if>
5890
5861
  </xsl:variable>
5891
5862
  <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
5892
5863
 
5864
+ <parent_table_page-width><xsl:value-of select="$parent_table_page-width"/></parent_table_page-width>
5865
+
5893
5866
  <!-- get current table id -->
5894
5867
  <xsl:variable name="table_id" select="@id"/>
5895
5868
 
@@ -5910,50 +5883,6 @@
5910
5883
 
5911
5884
  </xsl:template> <!-- get-calculated-column-widths-autolayout-algorithm -->
5912
5885
 
5913
- <!-- ============================= -->
5914
- <!-- mode: determine_cell_widths-if -->
5915
- <!-- ============================= -->
5916
- <xsl:template match="@*|node()" mode="determine_cell_widths-if">
5917
- <xsl:copy>
5918
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
5919
- </xsl:copy>
5920
- </xsl:template>
5921
-
5922
- <xsl:template match="td | th" mode="determine_cell_widths-if">
5923
- <xsl:copy>
5924
- <xsl:copy-of select="@*"/>
5925
-
5926
- <!-- The maximum width is given by the widest line. -->
5927
- <xsl:attribute name="width_max">
5928
- <xsl:for-each select="p_len">
5929
- <xsl:sort select="." data-type="number" order="descending"/>
5930
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
5931
- </xsl:for-each>
5932
- </xsl:attribute>
5933
-
5934
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
5935
- <xsl:variable name="width_min">
5936
- <xsl:for-each select="word_len">
5937
- <xsl:sort select="." data-type="number" order="descending"/>
5938
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
5939
- </xsl:for-each>
5940
- </xsl:variable>
5941
- <xsl:attribute name="width_min">
5942
- <xsl:value-of select="$width_min"/>
5943
- </xsl:attribute>
5944
-
5945
- <xsl:if test="$width_min = 0">
5946
- <xsl:attribute name="width_min">1</xsl:attribute>
5947
- </xsl:if>
5948
-
5949
- <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
5950
-
5951
- </xsl:copy>
5952
- </xsl:template>
5953
- <!-- ============================= -->
5954
- <!-- END mode: determine_cell_widths-if -->
5955
- <!-- ============================= -->
5956
-
5957
5886
  <!-- ================================================== -->
5958
5887
  <!-- Calculate column's width based on HTML4 algorithm -->
5959
5888
  <!-- ================================================== -->
@@ -6201,6 +6130,7 @@
6201
6130
  <xsl:when test="$table_or_dl = 'table'">
6202
6131
  <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
6203
6132
  <fo:table-row number-columns-spanned="{$col_count}">
6133
+ <xsl:copy-of select="../@font-weight"/>
6204
6134
  <!-- <test_table><xsl:copy-of select="."/></test_table> -->
6205
6135
  <xsl:call-template name="td"/>
6206
6136
  </fo:table-row>
@@ -6365,7 +6295,7 @@
6365
6295
 
6366
6296
  <xsl:apply-templates/>
6367
6297
 
6368
- <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"/> -->
6298
+ <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"/> -->
6369
6299
 
6370
6300
  </fo:block>
6371
6301
  </fo:table-cell>
@@ -6700,6 +6630,7 @@
6700
6630
  <xsl:template match="*[local-name()='dl']">
6701
6631
  <xsl:variable name="isAdded" select="@added"/>
6702
6632
  <xsl:variable name="isDeleted" select="@deleted"/>
6633
+ <!-- <dl><xsl:copy-of select="."/></dl> -->
6703
6634
  <fo:block-container>
6704
6635
 
6705
6636
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -7233,21 +7164,16 @@
7233
7164
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
7234
7165
  <xsl:template match="*[local-name()='dt']" mode="dl_if">
7235
7166
  <xsl:param name="id"/>
7236
- <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
7237
7167
  <tr>
7238
7168
  <td>
7239
7169
  <xsl:copy-of select="node()"/>
7240
7170
  </td>
7241
7171
  <td>
7242
-
7243
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
7244
-
7245
- <!-- get paragraphs from nested 'dl' -->
7246
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7247
-
7172
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
7173
+ <!-- get paragraphs from nested 'dl' -->
7174
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7248
7175
  </td>
7249
7176
  </tr>
7250
-
7251
7177
  </xsl:template>
7252
7178
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
7253
7179
 
@@ -7898,6 +7824,9 @@
7898
7824
  <xsl:variable name="td">
7899
7825
  <xsl:element name="td">
7900
7826
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
7827
+ <xsl:if test="local-name()='th'">
7828
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
7829
+ </xsl:if>
7901
7830
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
7902
7831
  <xsl:apply-templates mode="simple-table-colspan"/>
7903
7832
  </xsl:element>
@@ -7910,6 +7839,9 @@
7910
7839
  <xsl:otherwise>
7911
7840
  <xsl:element name="td">
7912
7841
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
7842
+ <xsl:if test="local-name()='th'">
7843
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
7844
+ </xsl:if>
7913
7845
  <xsl:apply-templates mode="simple-table-colspan"/>
7914
7846
  </xsl:element>
7915
7847
  </xsl:otherwise>
@@ -8039,8 +7971,14 @@
8039
7971
  <xsl:copy-of select="@*"/>
8040
7972
  <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
8041
7973
  <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
7974
+ <xsl:variable name="divide">
7975
+ <xsl:choose>
7976
+ <xsl:when test="@divide"><xsl:value-of select="@divide"/></xsl:when>
7977
+ <xsl:otherwise>1</xsl:otherwise>
7978
+ </xsl:choose>
7979
+ </xsl:variable>
8042
7980
  <xsl:attribute name="id">
8043
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
7981
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
8044
7982
  </xsl:attribute>
8045
7983
 
8046
7984
  <xsl:for-each select="*[local-name() = 'p']">
@@ -8048,10 +7986,12 @@
8048
7986
  <xsl:copy-of select="@*"/>
8049
7987
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
8050
7988
  <xsl:attribute name="id">
8051
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
7989
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
8052
7990
  </xsl:attribute>
8053
7991
 
8054
- <xsl:copy-of select="node()"/>
7992
+ <!-- <xsl:copy-of select="node()" /> -->
7993
+ <xsl:apply-templates mode="simple-table-noid"/>
7994
+
8055
7995
  </xsl:copy>
8056
7996
  </xsl:for-each>
8057
7997
 
@@ -8080,7 +8020,7 @@
8080
8020
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
8081
8021
  <xsl:copy>
8082
8022
  <xsl:attribute name="id">
8083
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
8023
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
8084
8024
  </xsl:attribute>
8085
8025
  <xsl:copy-of select="node()"/>
8086
8026
  </xsl:copy>
@@ -8089,6 +8029,24 @@
8089
8029
  </xsl:copy>
8090
8030
 
8091
8031
  </xsl:template>
8032
+
8033
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p']//*" mode="simple-table-noid">
8034
+ <xsl:copy>
8035
+ <xsl:choose>
8036
+ <xsl:when test="$isGenerateTableIF = 'true'">
8037
+ <xsl:copy-of select="@*[local-name() != 'id']"/> <!-- to prevent repeat id in colspan/rowspan cells -->
8038
+ <!-- <xsl:if test="local-name() = 'dl' or local-name() = 'table'">
8039
+ <xsl:copy-of select="@id"/>
8040
+ </xsl:if> -->
8041
+ </xsl:when>
8042
+ <xsl:otherwise>
8043
+ <xsl:copy-of select="@*"/>
8044
+ </xsl:otherwise>
8045
+ </xsl:choose>
8046
+ <xsl:apply-templates select="node()" mode="simple-table-noid"/>
8047
+ </xsl:copy>
8048
+ </xsl:template>
8049
+
8092
8050
  <!-- End mode: simple-table-id -->
8093
8051
  <!-- ===================== -->
8094
8052
  <!-- ===================== -->
@@ -8098,7 +8056,7 @@
8098
8056
  <!-- =============================== -->
8099
8057
  <xsl:template match="@*|node()" mode="td_text_with_formatting">
8100
8058
  <xsl:copy>
8101
- <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
8059
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
8102
8060
  </xsl:copy>
8103
8061
  </xsl:template>
8104
8062
 
@@ -8212,6 +8170,10 @@
8212
8170
 
8213
8171
  <fo:inline xsl:use-attribute-sets="mathml-style">
8214
8172
 
8173
+ <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 -->
8174
+ <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
8175
+ </xsl:if>
8176
+
8215
8177
  <xsl:call-template name="setTrackChangesStyles">
8216
8178
  <xsl:with-param name="isAdded" select="$isAdded"/>
8217
8179
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
@@ -10109,41 +10071,47 @@
10109
10071
  </fo:block>
10110
10072
  </xsl:template>
10111
10073
 
10112
- <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
10074
+ <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']">
10113
10075
  <fo:block xsl:use-attribute-sets="inherit-style">
10114
10076
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
10115
10077
  </fo:block>
10116
10078
  </xsl:template>
10117
10079
 
10118
- <xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
10080
+ <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']">
10119
10081
  <fo:block xsl:use-attribute-sets="description-style">
10120
10082
  <xsl:apply-templates/>
10121
10083
  </fo:block>
10122
10084
  </xsl:template>
10123
10085
 
10124
- <xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
10086
+ <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']">
10125
10087
  <fo:block xsl:use-attribute-sets="specification-style">
10126
10088
  <xsl:apply-templates/>
10127
10089
  </fo:block>
10128
10090
  </xsl:template>
10129
10091
 
10130
- <xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
10092
+ <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']">
10131
10093
  <fo:block xsl:use-attribute-sets="measurement-target-style">
10132
10094
  <xsl:apply-templates/>
10133
10095
  </fo:block>
10134
10096
  </xsl:template>
10135
10097
 
10136
- <xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
10098
+ <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']">
10137
10099
  <fo:block xsl:use-attribute-sets="verification-style">
10138
10100
  <xsl:apply-templates/>
10139
10101
  </fo:block>
10140
10102
  </xsl:template>
10141
10103
 
10142
- <xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
10104
+ <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']">
10143
10105
  <fo:block xsl:use-attribute-sets="import-style">
10144
10106
  <xsl:apply-templates/>
10145
10107
  </fo:block>
10146
10108
  </xsl:template>
10109
+
10110
+ <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')]">
10111
+ <fo:block xsl:use-attribute-sets="component-style">
10112
+ <xsl:apply-templates/>
10113
+ </fo:block>
10114
+ </xsl:template>
10147
10115
  <!-- ========== -->
10148
10116
  <!-- END -->
10149
10117
  <!-- ========== -->
@@ -10199,15 +10167,12 @@
10199
10167
 
10200
10168
  <xsl:template match="*[local-name()='tr']" mode="requirement">
10201
10169
  <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
10202
- <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
10203
- <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
10204
- </xsl:if>
10205
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
10206
- <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
10207
- </xsl:if>
10208
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
10209
- <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
10170
+
10171
+ <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 ')">
10172
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
10173
+
10210
10174
  </xsl:if>
10175
+
10211
10176
  <xsl:apply-templates mode="requirement"/>
10212
10177
  </fo:table-row>
10213
10178
  </xsl:template>
@@ -11755,7 +11720,7 @@
11755
11720
  </tbody>
11756
11721
  </xsl:variable>
11757
11722
  <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
11758
- <xsl:call-template name="calculate-column-widths">
11723
+ <xsl:call-template name="calculate-column-widths-proportional">
11759
11724
  <xsl:with-param name="cols-count" select="$cols-count"/>
11760
11725
  <xsl:with-param name="table" select="$toc_table_simple"/>
11761
11726
  </xsl:call-template>
@@ -14,7 +14,7 @@ module IsoDoc
14
14
  if %w(techreport standard).include?(bib[:type])
15
15
  node["citeas"] + " #{bib[:ord]}"
16
16
  else
17
- "#{bib[:title]} " + node["citeas"]
17
+ "#{bib[:author]} " + node["citeas"]
18
18
  end
19
19
  end
20
20
 
@@ -25,6 +25,8 @@ module IsoDoc
25
25
  { docid: pref_ref_code(b), type: b["type"],
26
26
  title: (b.at(ns("./title")) ||
27
27
  b.at(ns("./formattedref")))&.text,
28
+ author: @author[b["id"]] || (b.at(ns("./title")) ||
29
+ b.at(ns("./formattedref")))&.text,
28
30
  ord: b.at(ns("./docidentifier[@type = 'metanorma' or "\
29
31
  "@type = 'metanorma-ordinal']")).text }
30
32
  end
@@ -35,13 +37,22 @@ module IsoDoc
35
37
  i18nhash: @i18n.get)
36
38
  end
37
39
 
38
- def bibrender_relaton(xml)
39
- bib = xml.dup
40
- bib["suppress_identifier"] == true and
41
- bib.xpath(ns("./docidentifier")).each(&:remove)
40
+ def citestyle
41
+ "author-date"
42
+ end
43
+
44
+ def references_render(docxml)
45
+ @author = {}
46
+ super
47
+ end
48
+
49
+ def bibrender_relaton(xml, renderings)
50
+ f = renderings[xml["id"]][:formattedref]
51
+ f &&= "<formattedref>#{f}</formattedref>"
42
52
  xml.children =
43
- "#{bibrenderer.render(bib.to_xml)}"\
44
- "#{xml.xpath(ns('./docidentifier | ./uri | ./note | ./title')).to_xml}"
53
+ "#{f}#{xml.xpath(ns('./docidentifier | ./uri | ./note | ./title'))
54
+ .to_xml}"
55
+ @author[xml["id"]] = renderings[xml["id"]][:author]
45
56
  end
46
57
 
47
58
  def creatornames(bibitem)
@@ -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>
@@ -1,3 +1,5 @@
1
+ require "isoics"
2
+
1
3
  module Metanorma
2
4
  module IEEE
3
5
  class Converter < Standoc::Converter
@@ -64,7 +66,7 @@ module Metanorma
64
66
 
65
67
  def metadata_status(node, xml)
66
68
  status = node.attr("status") || node.attr("docstage") ||
67
- (node.attr("draft") ? "developing" : "active")
69
+ (node.attr("draft") ? "draft" : "approved")
68
70
  xml.status do |s|
69
71
  s.stage status
70
72
  end