metanorma-itu 2.4.1 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2703,6 +2703,10 @@
2703
2703
 
2704
2704
  </xsl:attribute-set>
2705
2705
 
2706
+ <xsl:template name="refine_termexample-style">
2707
+
2708
+ </xsl:template>
2709
+
2706
2710
  <xsl:attribute-set name="example-style">
2707
2711
 
2708
2712
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3845,6 +3849,36 @@
3845
3849
  </xsl:for-each>
3846
3850
  </xsl:template>
3847
3851
 
3852
+ <xsl:template name="processMainSectionsDefault_flatxml">
3853
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3854
+ <xsl:sort select="@displayorder" data-type="number"/>
3855
+ <xsl:variable name="flatxml">
3856
+ <xsl:apply-templates select="." mode="flatxml"/>
3857
+ </xsl:variable>
3858
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3859
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3860
+
3861
+ </xsl:for-each>
3862
+
3863
+ <xsl:for-each select="/*/*[local-name()='annex']">
3864
+ <xsl:sort select="@displayorder" data-type="number"/>
3865
+ <xsl:variable name="flatxml">
3866
+ <xsl:apply-templates select="." mode="flatxml"/>
3867
+ </xsl:variable>
3868
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3869
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3870
+ </xsl:for-each>
3871
+
3872
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3873
+ <xsl:sort select="@displayorder" data-type="number"/>
3874
+ <xsl:variable name="flatxml">
3875
+ <xsl:apply-templates select="." mode="flatxml"/>
3876
+ </xsl:variable>
3877
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3878
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3879
+ </xsl:for-each>
3880
+ </xsl:template>
3881
+
3848
3882
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3849
3883
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3850
3884
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -5959,13 +5993,13 @@
5959
5993
  <tr>
5960
5994
  <td>
5961
5995
  <xsl:attribute name="id">
5962
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5996
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
5963
5997
  </xsl:attribute>
5964
5998
  <xsl:apply-templates/>
5965
5999
  </td>
5966
6000
  <td>
5967
6001
  <xsl:attribute name="id">
5968
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
6002
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
5969
6003
  </xsl:attribute>
5970
6004
 
5971
6005
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -6580,6 +6614,10 @@
6580
6614
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6581
6615
  </xsl:template>
6582
6616
 
6617
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
6618
+ <xsl:value-of select="."/>
6619
+ </xsl:template>
6620
+
6583
6621
  <!-- ========================= -->
6584
6622
  <!-- END Rich text formatting -->
6585
6623
  <!-- ========================= -->
@@ -7210,7 +7248,7 @@
7210
7248
  </xsl:choose>
7211
7249
  </xsl:variable>
7212
7250
  <xsl:attribute name="id">
7213
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
7251
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
7214
7252
  </xsl:attribute>
7215
7253
 
7216
7254
  <xsl:for-each select="*[local-name() = 'p']">
@@ -7218,7 +7256,7 @@
7218
7256
  <xsl:copy-of select="@*"/>
7219
7257
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
7220
7258
  <xsl:attribute name="id">
7221
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7259
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7222
7260
  </xsl:attribute>
7223
7261
 
7224
7262
  <!-- <xsl:copy-of select="node()" /> -->
@@ -7282,7 +7320,7 @@
7282
7320
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
7283
7321
  <xsl:copy>
7284
7322
  <xsl:attribute name="id">
7285
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7323
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7286
7324
  </xsl:attribute>
7287
7325
  <xsl:copy-of select="node()"/>
7288
7326
  </xsl:copy>
@@ -10091,7 +10129,7 @@
10091
10129
  <!-- ====== -->
10092
10130
  <xsl:template match="*[local-name() = 'termexample']">
10093
10131
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10094
-
10132
+ <xsl:call-template name="refine_termexample-style"/>
10095
10133
  <xsl:call-template name="setBlockSpanAll"/>
10096
10134
 
10097
10135
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -2703,6 +2703,10 @@
2703
2703
 
2704
2704
  </xsl:attribute-set>
2705
2705
 
2706
+ <xsl:template name="refine_termexample-style">
2707
+
2708
+ </xsl:template>
2709
+
2706
2710
  <xsl:attribute-set name="example-style">
2707
2711
 
2708
2712
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3845,6 +3849,36 @@
3845
3849
  </xsl:for-each>
3846
3850
  </xsl:template>
3847
3851
 
3852
+ <xsl:template name="processMainSectionsDefault_flatxml">
3853
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3854
+ <xsl:sort select="@displayorder" data-type="number"/>
3855
+ <xsl:variable name="flatxml">
3856
+ <xsl:apply-templates select="." mode="flatxml"/>
3857
+ </xsl:variable>
3858
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3859
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3860
+
3861
+ </xsl:for-each>
3862
+
3863
+ <xsl:for-each select="/*/*[local-name()='annex']">
3864
+ <xsl:sort select="@displayorder" data-type="number"/>
3865
+ <xsl:variable name="flatxml">
3866
+ <xsl:apply-templates select="." mode="flatxml"/>
3867
+ </xsl:variable>
3868
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3869
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3870
+ </xsl:for-each>
3871
+
3872
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3873
+ <xsl:sort select="@displayorder" data-type="number"/>
3874
+ <xsl:variable name="flatxml">
3875
+ <xsl:apply-templates select="." mode="flatxml"/>
3876
+ </xsl:variable>
3877
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3878
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3879
+ </xsl:for-each>
3880
+ </xsl:template>
3881
+
3848
3882
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3849
3883
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3850
3884
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -5959,13 +5993,13 @@
5959
5993
  <tr>
5960
5994
  <td>
5961
5995
  <xsl:attribute name="id">
5962
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5996
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
5963
5997
  </xsl:attribute>
5964
5998
  <xsl:apply-templates/>
5965
5999
  </td>
5966
6000
  <td>
5967
6001
  <xsl:attribute name="id">
5968
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
6002
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
5969
6003
  </xsl:attribute>
5970
6004
 
5971
6005
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -6580,6 +6614,10 @@
6580
6614
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6581
6615
  </xsl:template>
6582
6616
 
6617
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
6618
+ <xsl:value-of select="."/>
6619
+ </xsl:template>
6620
+
6583
6621
  <!-- ========================= -->
6584
6622
  <!-- END Rich text formatting -->
6585
6623
  <!-- ========================= -->
@@ -7210,7 +7248,7 @@
7210
7248
  </xsl:choose>
7211
7249
  </xsl:variable>
7212
7250
  <xsl:attribute name="id">
7213
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
7251
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
7214
7252
  </xsl:attribute>
7215
7253
 
7216
7254
  <xsl:for-each select="*[local-name() = 'p']">
@@ -7218,7 +7256,7 @@
7218
7256
  <xsl:copy-of select="@*"/>
7219
7257
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
7220
7258
  <xsl:attribute name="id">
7221
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7259
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7222
7260
  </xsl:attribute>
7223
7261
 
7224
7262
  <!-- <xsl:copy-of select="node()" /> -->
@@ -7282,7 +7320,7 @@
7282
7320
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
7283
7321
  <xsl:copy>
7284
7322
  <xsl:attribute name="id">
7285
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7323
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7286
7324
  </xsl:attribute>
7287
7325
  <xsl:copy-of select="node()"/>
7288
7326
  </xsl:copy>
@@ -10091,7 +10129,7 @@
10091
10129
  <!-- ====== -->
10092
10130
  <xsl:template match="*[local-name() = 'termexample']">
10093
10131
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10094
-
10132
+ <xsl:call-template name="refine_termexample-style"/>
10095
10133
  <xsl:call-template name="setBlockSpanAll"/>
10096
10134
 
10097
10135
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -2703,6 +2703,10 @@
2703
2703
 
2704
2704
  </xsl:attribute-set>
2705
2705
 
2706
+ <xsl:template name="refine_termexample-style">
2707
+
2708
+ </xsl:template>
2709
+
2706
2710
  <xsl:attribute-set name="example-style">
2707
2711
 
2708
2712
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3845,6 +3849,36 @@
3845
3849
  </xsl:for-each>
3846
3850
  </xsl:template>
3847
3851
 
3852
+ <xsl:template name="processMainSectionsDefault_flatxml">
3853
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3854
+ <xsl:sort select="@displayorder" data-type="number"/>
3855
+ <xsl:variable name="flatxml">
3856
+ <xsl:apply-templates select="." mode="flatxml"/>
3857
+ </xsl:variable>
3858
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3859
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3860
+
3861
+ </xsl:for-each>
3862
+
3863
+ <xsl:for-each select="/*/*[local-name()='annex']">
3864
+ <xsl:sort select="@displayorder" data-type="number"/>
3865
+ <xsl:variable name="flatxml">
3866
+ <xsl:apply-templates select="." mode="flatxml"/>
3867
+ </xsl:variable>
3868
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3869
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3870
+ </xsl:for-each>
3871
+
3872
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3873
+ <xsl:sort select="@displayorder" data-type="number"/>
3874
+ <xsl:variable name="flatxml">
3875
+ <xsl:apply-templates select="." mode="flatxml"/>
3876
+ </xsl:variable>
3877
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3878
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3879
+ </xsl:for-each>
3880
+ </xsl:template>
3881
+
3848
3882
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3849
3883
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3850
3884
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -5959,13 +5993,13 @@
5959
5993
  <tr>
5960
5994
  <td>
5961
5995
  <xsl:attribute name="id">
5962
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5996
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
5963
5997
  </xsl:attribute>
5964
5998
  <xsl:apply-templates/>
5965
5999
  </td>
5966
6000
  <td>
5967
6001
  <xsl:attribute name="id">
5968
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
6002
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
5969
6003
  </xsl:attribute>
5970
6004
 
5971
6005
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -6580,6 +6614,10 @@
6580
6614
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6581
6615
  </xsl:template>
6582
6616
 
6617
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
6618
+ <xsl:value-of select="."/>
6619
+ </xsl:template>
6620
+
6583
6621
  <!-- ========================= -->
6584
6622
  <!-- END Rich text formatting -->
6585
6623
  <!-- ========================= -->
@@ -7210,7 +7248,7 @@
7210
7248
  </xsl:choose>
7211
7249
  </xsl:variable>
7212
7250
  <xsl:attribute name="id">
7213
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
7251
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
7214
7252
  </xsl:attribute>
7215
7253
 
7216
7254
  <xsl:for-each select="*[local-name() = 'p']">
@@ -7218,7 +7256,7 @@
7218
7256
  <xsl:copy-of select="@*"/>
7219
7257
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
7220
7258
  <xsl:attribute name="id">
7221
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7259
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7222
7260
  </xsl:attribute>
7223
7261
 
7224
7262
  <!-- <xsl:copy-of select="node()" /> -->
@@ -7282,7 +7320,7 @@
7282
7320
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
7283
7321
  <xsl:copy>
7284
7322
  <xsl:attribute name="id">
7285
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7323
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7286
7324
  </xsl:attribute>
7287
7325
  <xsl:copy-of select="node()"/>
7288
7326
  </xsl:copy>
@@ -10091,7 +10129,7 @@
10091
10129
  <!-- ====== -->
10092
10130
  <xsl:template match="*[local-name() = 'termexample']">
10093
10131
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10094
-
10132
+ <xsl:call-template name="refine_termexample-style"/>
10095
10133
  <xsl:call-template name="setBlockSpanAll"/>
10096
10134
 
10097
10135
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -2703,6 +2703,10 @@
2703
2703
 
2704
2704
  </xsl:attribute-set>
2705
2705
 
2706
+ <xsl:template name="refine_termexample-style">
2707
+
2708
+ </xsl:template>
2709
+
2706
2710
  <xsl:attribute-set name="example-style">
2707
2711
 
2708
2712
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3845,6 +3849,36 @@
3845
3849
  </xsl:for-each>
3846
3850
  </xsl:template>
3847
3851
 
3852
+ <xsl:template name="processMainSectionsDefault_flatxml">
3853
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3854
+ <xsl:sort select="@displayorder" data-type="number"/>
3855
+ <xsl:variable name="flatxml">
3856
+ <xsl:apply-templates select="." mode="flatxml"/>
3857
+ </xsl:variable>
3858
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3859
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3860
+
3861
+ </xsl:for-each>
3862
+
3863
+ <xsl:for-each select="/*/*[local-name()='annex']">
3864
+ <xsl:sort select="@displayorder" data-type="number"/>
3865
+ <xsl:variable name="flatxml">
3866
+ <xsl:apply-templates select="." mode="flatxml"/>
3867
+ </xsl:variable>
3868
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3869
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3870
+ </xsl:for-each>
3871
+
3872
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3873
+ <xsl:sort select="@displayorder" data-type="number"/>
3874
+ <xsl:variable name="flatxml">
3875
+ <xsl:apply-templates select="." mode="flatxml"/>
3876
+ </xsl:variable>
3877
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3878
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3879
+ </xsl:for-each>
3880
+ </xsl:template>
3881
+
3848
3882
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3849
3883
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3850
3884
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -5959,13 +5993,13 @@
5959
5993
  <tr>
5960
5994
  <td>
5961
5995
  <xsl:attribute name="id">
5962
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5996
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
5963
5997
  </xsl:attribute>
5964
5998
  <xsl:apply-templates/>
5965
5999
  </td>
5966
6000
  <td>
5967
6001
  <xsl:attribute name="id">
5968
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
6002
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
5969
6003
  </xsl:attribute>
5970
6004
 
5971
6005
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -6580,6 +6614,10 @@
6580
6614
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6581
6615
  </xsl:template>
6582
6616
 
6617
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
6618
+ <xsl:value-of select="."/>
6619
+ </xsl:template>
6620
+
6583
6621
  <!-- ========================= -->
6584
6622
  <!-- END Rich text formatting -->
6585
6623
  <!-- ========================= -->
@@ -7210,7 +7248,7 @@
7210
7248
  </xsl:choose>
7211
7249
  </xsl:variable>
7212
7250
  <xsl:attribute name="id">
7213
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
7251
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
7214
7252
  </xsl:attribute>
7215
7253
 
7216
7254
  <xsl:for-each select="*[local-name() = 'p']">
@@ -7218,7 +7256,7 @@
7218
7256
  <xsl:copy-of select="@*"/>
7219
7257
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
7220
7258
  <xsl:attribute name="id">
7221
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7259
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
7222
7260
  </xsl:attribute>
7223
7261
 
7224
7262
  <!-- <xsl:copy-of select="node()" /> -->
@@ -7282,7 +7320,7 @@
7282
7320
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
7283
7321
  <xsl:copy>
7284
7322
  <xsl:attribute name="id">
7285
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7323
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
7286
7324
  </xsl:attribute>
7287
7325
  <xsl:copy-of select="node()"/>
7288
7326
  </xsl:copy>
@@ -10091,7 +10129,7 @@
10091
10129
  <!-- ====== -->
10092
10130
  <xsl:template match="*[local-name() = 'termexample']">
10093
10131
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10094
-
10132
+ <xsl:call-template name="refine_termexample-style"/>
10095
10133
  <xsl:call-template name="setBlockSpanAll"/>
10096
10134
 
10097
10135
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -25,19 +25,23 @@ module IsoDoc
25
25
 
26
26
  def bibdata_title_resolution(bib)
27
27
  place = bib.at(ns("./ext/meeting-place"))&.text
28
- ed = bib.at(ns("./edition"))&.text
29
- rev = ed && ed != "1" ? "#{@i18n.get['revision_abbreviation']} " : ""
30
28
  year = bib.at(ns("./ext/meeting-date/from | ./ext/meeting-date/on"))
31
29
  &.text&.gsub(/-.*$/, "")
32
- num = bib.at(ns("./docnumber"))&.text
33
- text = @i18n.l10n("#{@i18n.get['doctype_dict']['resolution'].upcase} " \
34
- "#{num} (#{rev}#{place}, #{year})")
30
+ text = bibdata_title_resolution_name(bib, place, year)
35
31
  bib.at(ns("./title")).next = <<~INS
36
32
  <title language="#{@lang}" format="text/plain" type="resolution">#{text}</title>
37
33
  <title language="#{@lang}" format="text/plain" type="resolution-placedate">#{place}, #{year}</title>
38
34
  INS
39
35
  end
40
36
 
37
+ def bibdata_title_resolution_name(bib, place, year)
38
+ ed = bib.at(ns("./edition"))&.text
39
+ rev = ed && ed != "1" ? "#{@i18n.get['revision_abbreviation']} " : ""
40
+ num = bib.at(ns("./docnumber"))
41
+ @i18n.l10n("#{@i18n.get['doctype_dict']['resolution'].upcase} " \
42
+ "#{num&.text} (#{rev}#{place}, #{year})")
43
+ end
44
+
41
45
  def bibdata_title_service_population(bib)
42
46
  date = bib&.at(ns("./date[@type = 'published']"))&.text or return
43
47
  text = l10n(@i18n.get["position_on"].sub("%", ddmmmmyyyy(date)))
@@ -40,11 +40,9 @@ module IsoDoc
40
40
  end
41
41
 
42
42
  def get_eref_linkend(node)
43
- contents = non_locality_elems(node).select do |c|
43
+ non_locality_elems(node).select do |c|
44
44
  !c.text? || /\S/.match(c)
45
- end
46
- return unless contents.empty?
47
-
45
+ end.empty? or return
48
46
  link = anchor_linkend(node,
49
47
  docid_l10n(node["target"] || node["citeas"]))
50
48
  link && !/^\[.*\]$/.match(link) and link = "[#{link}]"
@@ -60,16 +58,66 @@ module IsoDoc
60
58
 
61
59
  def bibrender_formattedref(formattedref, _xml)
62
60
  formattedref << "." unless /\.$/.match?(formattedref.text)
61
+ id = reference_format_start(formattedref.parent) and
62
+ formattedref.children.first.previous = id
63
63
  end
64
64
 
65
65
  def bibrender_relaton(xml, renderings)
66
66
  f = renderings[xml["id"]][:formattedref]
67
- f &&= "<formattedref>#{f}</formattedref>"
67
+ ids = reference_format_start(xml)
68
+ f &&= "<formattedref>#{ids}#{f}</formattedref>"
68
69
  # retain date in order to generate reference tag
69
70
  keep = "./docidentifier | ./uri | ./note | ./date | ./biblio-tag"
70
71
  xml.children = "#{f}#{xml.xpath(ns(keep)).to_xml}"
71
72
  end
72
73
 
74
+ def multi_bibitem_ref_code(bib)
75
+ skip = IsoDoc::Function::References::SKIP_DOCID
76
+ skip1 = "@type = 'metanorma' or @type = 'metanorma-ordinal'"
77
+ prim = "[@primary = 'true']"
78
+ id = bib.xpath(ns("./docidentifier#{prim}[not(#{skip} or #{skip1})]"))
79
+ id.empty? and id = bib.xpath(ns("./docidentifier#{prim}[not(#{skip1})]"))
80
+ id.empty? and id = bib.xpath(ns("./docidentifier[not(#{skip} or #{skip1})]"))
81
+ id.empty? and id = bib.xpath(ns("./docidentifier[not(#{skip1})]"))
82
+ id.empty? and return id
83
+ id.sort_by { |i| i["type"] == "ITU" ? 0 : 1 }
84
+ end
85
+
86
+ def render_multi_identifiers(ids)
87
+ ids.map do |id|
88
+ if id["type"] == "ITU" then doctype_title(id)
89
+ else
90
+ docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
91
+ end
92
+ end.join("&#xA0;| ")
93
+ end
94
+
95
+ def reference_format_start(bib)
96
+ id = multi_bibitem_ref_code(bib)
97
+ id1 = render_multi_identifiers(id)
98
+ out = id1
99
+ date = bib.at(ns("./date[@type = 'published']/on | " \
100
+ "./date[@type = 'published']/from")) and
101
+ out << " (#{date.text.sub(/-.*$/, '')})"
102
+ out += ", " if date || !id1.empty?
103
+ out
104
+ end
105
+
106
+ def titlecase(str)
107
+ str.gsub(/ |_|-/, " ").split(/ /).map(&:capitalize).join(" ")
108
+ end
109
+
110
+ def doctype_title(id)
111
+ type = id.parent&.at(ns("./ext/doctype"))&.text || "recommendation"
112
+ if type == "recommendation" &&
113
+ /^(?<prefix>ITU-[A-Z][  ][A-Z])[  .-]Sup[a-z]*\.[  ]?(?<num>\d+)$/ =~ id.text
114
+ "#{prefix}-series Recommendations – Supplement #{num}"
115
+ else
116
+ d = docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
117
+ "#{titlecase(type)} #{d}"
118
+ end
119
+ end
120
+
73
121
  def twitter_cldr_localiser_symbols
74
122
  { group: "'" }
75
123
  end
@@ -100,9 +148,8 @@ module IsoDoc
100
148
  end
101
149
 
102
150
  def ol_depth(node)
103
- return super unless node["class"] == "steps" ||
104
- node.at(".//ancestor::xmlns:ol[@class = 'steps']")
105
-
151
+ node["class"] == "steps" ||
152
+ node.at(".//ancestor::xmlns:ol[@class = 'steps']") or return super
106
153
  depth = node.ancestors("ul, ol").size + 1
107
154
  type = :arabic
108
155
  type = :alphabet if [2, 7].include? depth
@@ -118,17 +165,34 @@ module IsoDoc
118
165
  super
119
166
  end
120
167
 
168
+ def bibliography_bibitem_number1(bib, idx)
169
+ mn = bib.at(ns(".//docidentifier[@type = 'metanorma']")) and
170
+ /^\[?\d+\]?$/.match?(mn.text) and
171
+ mn["type"] = "metanorma-ordinal"
172
+ if (mn = bib.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))) &&
173
+ !bibliography_bibitem_number_skip(bib)
174
+ idx += 1
175
+ mn.children = "[#{idx}]"
176
+ end
177
+ idx
178
+ end
179
+
180
+ def bibliography_bibitem_number_skip(bibitem)
181
+ @xrefs.klass.implicit_reference(bibitem) ||
182
+ bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
183
+ end
184
+
121
185
  def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, _bib)
122
- ret = (idents[:metanorma] || idents[:sdo] || idents[:ordinal]).to_s
123
- !idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
186
+ ret = (idents[:metanorma] || idents[:ordinal] || idents[:sdo]).to_s
187
+ /^\[.+\]$/.match?(ret) or ret = "[#{ret}]"
124
188
  ret += datefn
125
189
  ret.empty? and return ret
126
190
  ret.gsub("-", "&#x2011;").gsub(/ /, "&#xa0;")
127
191
  end
128
192
 
129
193
  def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn, _bib)
130
- ret = (idents[:metanorma] || idents[:sdo] || idents[:ordinal]).to_s
131
- !idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
194
+ ret = (idents[:metanorma] || idents[:ordinal] || idents[:sdo]).to_s
195
+ /^\[.+\]$/.match?(ret) or ret = "[#{ret}]"
132
196
  ret += datefn
133
197
  ret.empty? and return ret
134
198
  ret.gsub("-", "&#x2011;").gsub(/ /, "&#xa0;")
@@ -192,8 +256,8 @@ module IsoDoc
192
256
  ret = ""
193
257
  isoxml.xpath(ns("//note[@type = 'title-footnote']"))
194
258
  .each_with_index do |f, i|
195
- ret += "<fn reference='H#{i}'>#{f.remove.children.to_xml}</fn>"
196
- end
259
+ ret += "<fn reference='H#{i}'>#{f.remove.children.to_xml}</fn>"
260
+ end
197
261
  ret
198
262
  end
199
263