metanorma-bipm 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,17 +2,9 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <xsl:param name="svg_images"/>
6
- <xsl:variable name="images" select="document($svg_images)"/>
7
- <xsl:param name="basepath"/>
8
-
9
5
  <xsl:param name="initial_page_number"/>
10
6
  <xsl:param name="doc_split_by_language"/>
11
7
 
12
- <!-- <item id="#">N_page</item> -->
13
- <!-- param for second pass -->
14
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
15
-
16
8
  <xsl:param name="add_math_as_text">true</xsl:param>
17
9
 
18
10
  <xsl:param name="add_math_as_attachment">true</xsl:param>
@@ -21,11 +13,6 @@
21
13
 
22
14
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
23
15
 
24
- <xsl:variable name="marginLeftRight1" select="31.7"/>
25
- <xsl:variable name="marginLeftRight2" select="40"/>
26
- <xsl:variable name="marginTop" select="25.4"/>
27
- <xsl:variable name="marginBottom" select="22"/>
28
-
29
16
 
30
17
 
31
18
  <!-- DON'T DELETE IT -->
@@ -39,13 +26,9 @@
39
26
 
40
27
  <xsl:variable name="doc_first_language" select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:language[@current = 'true']"/>
41
28
 
42
- <xsl:variable name="lang">
43
- <xsl:call-template name="getLang"/>
44
- </xsl:variable>
45
-
46
29
  <xsl:variable name="root-element" select="local-name(/*)"/>
47
30
 
48
- <xsl:variable name="contents">
31
+ <xsl:variable name="contents_">
49
32
  <xsl:choose>
50
33
  <xsl:when test="$root-element = 'metanorma-collection'">
51
34
  <xsl:choose>
@@ -97,6 +80,7 @@
97
80
  </xsl:otherwise>
98
81
  </xsl:choose>
99
82
  </xsl:variable>
83
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
100
84
 
101
85
  <xsl:variable name="indexes">
102
86
  <xsl:choose>
@@ -197,6 +181,8 @@
197
181
  <!-- Index -->
198
182
  <xsl:apply-templates select="//bipm:indexsect" mode="contents"/>
199
183
 
184
+ <xsl:call-template name="processTablesFigures_Contents"/>
185
+
200
186
  </contents>
201
187
  </xsl:template>
202
188
 
@@ -866,40 +852,7 @@
866
852
 
867
853
  <xsl:template name="setListItemLabel">
868
854
  <xsl:attribute name="label">
869
- <xsl:choose>
870
- <xsl:when test="local-name(..) = 'ul'">
871
- <xsl:call-template name="setULLabel"/>
872
- </xsl:when>
873
-
874
- <xsl:otherwise> <!-- for ordered lists -->
875
- <xsl:variable name="start_value">
876
- <xsl:choose>
877
- <xsl:when test="normalize-space(../@start) != ''">
878
- <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
879
- </xsl:when>
880
- <xsl:otherwise>0</xsl:otherwise>
881
- </xsl:choose>
882
- </xsl:variable>
883
-
884
- <xsl:variable name="curr_value">
885
- <xsl:number/>
886
- </xsl:variable>
887
-
888
- <xsl:variable name="format">
889
- <xsl:choose>
890
- <xsl:when test="../@type = 'arabic'">1.</xsl:when>
891
- <xsl:when test="../@type = 'alphabet'">a)</xsl:when>
892
- <xsl:when test="../@type = 'alphabet_upper'">A.</xsl:when>
893
- <xsl:when test="../@type = 'roman'">(i)</xsl:when>
894
- <xsl:when test="../@type = 'roman_upper'">I.</xsl:when>
895
- <xsl:otherwise>1.</xsl:otherwise>
896
- </xsl:choose>
897
- </xsl:variable>
898
-
899
- <xsl:number value="$start_value + $curr_value" format="{$format}" lang="en"/>
900
-
901
- </xsl:otherwise>
902
- </xsl:choose>
855
+ <xsl:call-template name="getListItemFormat"/>
903
856
  </xsl:attribute>
904
857
  <xsl:choose>
905
858
  <xsl:when test="local-name(..) = 'ul' and ../ancestor::bipm:ul"/> <!-- &#x2014; dash -->
@@ -973,7 +926,7 @@
973
926
  <xsl:if test="$debug = 'true'">
974
927
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
975
928
  DEBUG
976
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
929
+ contents=<xsl:copy-of select="$contents"/>
977
930
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
978
931
  </xsl:if>
979
932
 
@@ -1128,12 +1081,12 @@
1128
1081
  <fo:block role="TOC">
1129
1082
  <!-- <xsl:copy-of select="$contents"/> -->
1130
1083
 
1131
- <xsl:if test="xalan:nodeset($contents)/doc[@id = $docid]//item[@display='true']">
1084
+ <xsl:if test="$contents/doc[@id = $docid]//item[@display='true']">
1132
1085
  <fo:table table-layout="fixed" width="100%">
1133
1086
  <fo:table-column column-width="127mm"/>
1134
1087
  <fo:table-column column-width="12mm"/>
1135
1088
  <fo:table-body>
1136
- <xsl:for-each select="xalan:nodeset($contents)/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
1089
+ <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
1137
1090
  <xsl:call-template name="insertContentItem"/>
1138
1091
  </xsl:for-each>
1139
1092
  <xsl:if test="$doctype ='brochure'">
@@ -1144,12 +1097,33 @@
1144
1097
  </fo:table-cell>
1145
1098
  </fo:table-row>
1146
1099
  </xsl:if>
1147
- <xsl:for-each select="xalan:nodeset($contents)/doc[@id = $docid]//item[@display='true' and (@type = 'annex')]"> <!-- or (@level = 2 and @parent = 'annex') -->
1100
+ <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'annex')]"> <!-- or (@level = 2 and @parent = 'annex') -->
1148
1101
  <xsl:call-template name="insertContentItem"/>
1149
1102
  </xsl:for-each>
1150
- <xsl:for-each select="xalan:nodeset($contents)/doc[@id = $docid]//item[@display='true' and (@type = 'index')]">
1103
+ <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'index')]">
1151
1104
  <xsl:call-template name="insertContentItem"/>
1152
1105
  </xsl:for-each>
1106
+
1107
+ <!-- List of Tables -->
1108
+ <xsl:if test="$contents/doc[@id = $docid]//tables/table">
1109
+ <xsl:call-template name="insertListOf_Title">
1110
+ <xsl:with-param name="title" select="$title-list-tables"/>
1111
+ </xsl:call-template>
1112
+ <xsl:for-each select="$contents/doc[@id = $docid]//tables/table">
1113
+ <xsl:call-template name="insertListOf_Item"/>
1114
+ </xsl:for-each>
1115
+ </xsl:if>
1116
+
1117
+ <!-- List of Figures -->
1118
+ <xsl:if test="$contents/doc[@id = $docid]//figures/figure">
1119
+ <xsl:call-template name="insertListOf_Title">
1120
+ <xsl:with-param name="title" select="$title-list-figures"/>
1121
+ </xsl:call-template>
1122
+ <xsl:for-each select="$contents/doc[@id = $docid]//figures/figure">
1123
+ <xsl:call-template name="insertListOf_Item"/>
1124
+ </xsl:for-each>
1125
+ </xsl:if>
1126
+
1153
1127
  </fo:table-body>
1154
1128
  </fo:table>
1155
1129
  </xsl:if>
@@ -1911,6 +1885,57 @@
1911
1885
  </fo:table-row>
1912
1886
  </xsl:template>
1913
1887
 
1888
+ <xsl:template name="insertListOf_Title">
1889
+ <xsl:param name="title"/>
1890
+ <fo:table-row keep-with-next="always">
1891
+ <fo:table-cell font-family="Arial" font-weight="bold" font-size="10pt" padding-top="14pt" padding-bottom="6pt">
1892
+ <fo:block role="TOCI">
1893
+ <xsl:value-of select="$title"/>
1894
+ </fo:block>
1895
+ </fo:table-cell>
1896
+ <fo:table-cell>
1897
+ <fo:block/>
1898
+ </fo:table-cell>
1899
+ </fo:table-row>
1900
+ </xsl:template>
1901
+
1902
+ <xsl:template name="insertListOf_Item">
1903
+ <fo:table-row>
1904
+ <fo:table-cell>
1905
+ <fo:block role="TOCI" font-size="10.5pt" margin-left="8mm">
1906
+ <fo:list-block provisional-distance-between-starts="8mm">
1907
+ <fo:list-item>
1908
+ <fo:list-item-label end-indent="label-end()">
1909
+ <fo:block/>
1910
+ </fo:list-item-label>
1911
+ <fo:list-item-body start-indent="body-start()">
1912
+ <fo:block>
1913
+ <fo:basic-link internal-destination="{@id}">
1914
+ <xsl:call-template name="setAltText">
1915
+ <xsl:with-param name="value" select="@alt-text"/>
1916
+ </xsl:call-template>
1917
+ <fo:inline>
1918
+ <xsl:apply-templates select="." mode="contents"/>
1919
+ </fo:inline>
1920
+ </fo:basic-link>
1921
+ </fo:block>
1922
+ </fo:list-item-body>
1923
+ </fo:list-item>
1924
+ </fo:list-block>
1925
+ </fo:block>
1926
+ </fo:table-cell>
1927
+ <fo:table-cell text-align="right" font-family="Arial" font-weight="bold" font-size="10pt">
1928
+ <fo:block>
1929
+ <fo:basic-link internal-destination="{@id}">
1930
+ <xsl:call-template name="setAltText">
1931
+ <xsl:with-param name="value" select="@alt-text"/>
1932
+ </xsl:call-template>
1933
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1934
+ </fo:basic-link>
1935
+ </fo:block>
1936
+ </fo:table-cell>
1937
+ </fo:table-row>
1938
+ </xsl:template>
1914
1939
 
1915
1940
  <xsl:template match="node()">
1916
1941
  <xsl:apply-templates/>
@@ -2775,12 +2800,12 @@
2775
2800
  </xsl:template>
2776
2801
 
2777
2802
 
2778
- <xsl:template match="bipm:ul | bipm:ol" mode="ul_ol">
2803
+ <xsl:template match="bipm:ul | bipm:ol" mode="list" priority="2">
2779
2804
  <xsl:apply-templates/><!-- for second level -->
2780
2805
  </xsl:template>
2781
2806
 
2782
2807
  <!-- process list item as individual list --> <!-- flat list -->
2783
- <xsl:template match="bipm:li">
2808
+ <xsl:template match="bipm:li" priority="2">
2784
2809
  <fo:block-container margin-left="0mm"> <!-- debug: border="0.5pt solid black" -->
2785
2810
  <xsl:if test="ancestor::bipm:li">
2786
2811
  <xsl:attribute name="margin-left">6.5mm</xsl:attribute><!-- 8 mm -->
@@ -2849,50 +2874,7 @@
2849
2874
 
2850
2875
  </xsl:template>
2851
2876
 
2852
- <xsl:template match="bipm:ul2/bipm:note | bipm:ol2/bipm:note" priority="2">
2853
- <fo:list-item>
2854
- <fo:list-item-label><fo:block/></fo:list-item-label>
2855
- <fo:list-item-body>
2856
- <fo:block>
2857
- <xsl:apply-templates select="bipm:name"/>
2858
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
2859
- </fo:block>
2860
- </fo:list-item-body>
2861
- </fo:list-item>
2862
- </xsl:template>
2863
-
2864
- <xsl:template match="bipm:formula/bipm:stem">
2865
- <fo:block margin-top="6pt" margin-bottom="6pt">
2866
- <xsl:choose>
2867
- <xsl:when test="../bipm:name">
2868
- <fo:table table-layout="fixed" width="100%">
2869
- <fo:table-column column-width="95%"/>
2870
- <fo:table-column column-width="5%"/>
2871
- <fo:table-body>
2872
- <fo:table-row>
2873
- <fo:table-cell display-align="center">
2874
- <fo:block text-align="center">
2875
- <xsl:apply-templates/>
2876
- </fo:block>
2877
- </fo:table-cell>
2878
- <fo:table-cell display-align="center">
2879
- <fo:block text-align="right">
2880
- <xsl:apply-templates select="../bipm:name" mode="formula_number"/>
2881
- </fo:block>
2882
- </fo:table-cell>
2883
- </fo:table-row>
2884
- </fo:table-body>
2885
- </fo:table>
2886
- </xsl:when>
2887
- <xsl:otherwise>
2888
- <fo:block text-align="center">
2889
- <xsl:apply-templates/>
2890
- </fo:block>
2891
- </xsl:otherwise>
2892
- </xsl:choose>
2893
- </fo:block>
2894
- </xsl:template>
2895
-
2877
+
2896
2878
  <xsl:template match="bipm:example" priority="2">
2897
2879
  <fo:block margin-top="6pt" margin-bottom="6pt" keep-together.within-column="1">
2898
2880
  <fo:table table-layout="fixed" width="100%">
@@ -2916,15 +2898,14 @@
2916
2898
  </fo:block>
2917
2899
  </xsl:template>
2918
2900
 
2919
- <xsl:template match="bipm:preferred">
2901
+ <xsl:template match="bipm:preferred" priority="2">
2920
2902
  <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
2921
2903
  <xsl:call-template name="setStyle_preferred"/>
2922
2904
  <xsl:if test="ancestor::bipm:term[1]/bipm:name">
2923
2905
  <xsl:variable name="level">
2924
2906
  <xsl:call-template name="getLevelTermName"/>
2925
2907
  </xsl:variable>
2926
- <fo:inline role="H{$level}" font-weight="bold">
2927
- <xsl:attribute name="padding-right">2mm</xsl:attribute>
2908
+ <fo:inline role="H{$level}" font-weight="bold" padding-right="2mm">
2928
2909
  <xsl:apply-templates select="ancestor::bipm:term[1]/bipm:name"/>
2929
2910
  </fo:inline>
2930
2911
  </xsl:if>
@@ -3238,7 +3219,7 @@
3238
3219
  <xsl:if test="$add_math_as_text = 'true'">
3239
3220
  <!-- set unique font-size (fiction) -->
3240
3221
  <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
3241
- <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal">​</fo:inline> <!-- zero width space -->
3222
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
3242
3223
  </xsl:if>
3243
3224
 
3244
3225
  <!-- <fo:wrapper role="artifact"> -->
@@ -3593,21 +3574,7 @@
3593
3574
  </fo:page-sequence>
3594
3575
  </xsl:template>
3595
3576
 
3596
- <xsl:template match="bipm:indexsect/bipm:title" priority="4">
3597
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" role="H1">
3598
- <!-- Index -->
3599
- <xsl:apply-templates/>
3600
- </fo:block>
3601
- </xsl:template>
3602
-
3603
- <xsl:template match="bipm:indexsect/bipm:clause/bipm:title" priority="4">
3604
- <!-- Letter A, B, C, ... -->
3605
- <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
3606
- <xsl:apply-templates/>
3607
- </fo:block>
3608
- </xsl:template>
3609
3577
 
3610
-
3611
3578
  <xsl:template match="*[local-name() = 'stem']/text()">
3612
3579
  <xsl:value-of select="normalize-space()"/>
3613
3580
  </xsl:template>
@@ -3949,11 +3916,21 @@
3949
3916
  </xsl:template>
3950
3917
 
3951
3918
 
3952
- <xsl:variable name="pageWidth_">
3919
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
3920
+ <xsl:call-template name="getLang"/>
3921
+ </xsl:variable><xsl:variable name="pageWidth_">
3953
3922
  210
3954
3923
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
3955
3924
  297
3956
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
3925
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
3926
+ 31.7
3927
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
3928
+ 40
3929
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
3930
+ 25.4
3931
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
3932
+ 22
3933
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
3957
3934
 
3958
3935
  <title-edition lang="en">
3959
3936
 
@@ -3965,6 +3942,10 @@
3965
3942
  <xsl:text>Édition </xsl:text>
3966
3943
  </title-edition>
3967
3944
 
3945
+ <title-edition lang="ru">
3946
+ <xsl:text>Издание </xsl:text>
3947
+ </title-edition>
3948
+
3968
3949
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
3969
3950
  <title-toc lang="en">
3970
3951
 
@@ -3979,7 +3960,7 @@
3979
3960
  <xsl:text>Contents</xsl:text>
3980
3961
 
3981
3962
  </title-toc>
3982
-
3963
+
3983
3964
  <title-descriptors lang="en">Descriptors</title-descriptors>
3984
3965
 
3985
3966
  <title-part lang="en">
@@ -3995,7 +3976,11 @@
3995
3976
 
3996
3977
  <xsl:text>Partie #</xsl:text>
3997
3978
 
3998
- </title-part>
3979
+ </title-part>
3980
+ <title-part lang="ru">
3981
+
3982
+
3983
+ </title-part>
3999
3984
  <title-part lang="zh">第 # 部分:</title-part>
4000
3985
 
4001
3986
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -4011,13 +3996,38 @@
4011
3996
 
4012
3997
  <title-summary lang="en">Summary</title-summary>
4013
3998
 
3999
+ <title-continued lang="ru">(продолжение)</title-continued>
4014
4000
  <title-continued lang="en">(continued)</title-continued>
4015
4001
  <title-continued lang="fr">(continué)</title-continued>
4016
4002
 
4017
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
4003
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
4004
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
4005
+ <xsl:value-of select="$toc_table_title"/>
4006
+ <xsl:if test="normalize-space($toc_table_title) = ''">
4007
+ <xsl:call-template name="getTitle">
4008
+ <xsl:with-param name="name" select="'title-list-tables'"/>
4009
+ </xsl:call-template>
4010
+ </xsl:if>
4011
+ </xsl:variable><xsl:variable name="title-list-figures">
4012
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
4013
+ <xsl:value-of select="$toc_figure_title"/>
4014
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
4015
+ <xsl:call-template name="getTitle">
4016
+ <xsl:with-param name="name" select="'title-list-figures'"/>
4017
+ </xsl:call-template>
4018
+ </xsl:if>
4019
+ </xsl:variable><xsl:variable name="title-list-recommendations">
4020
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
4021
+ <xsl:value-of select="$toc_requirement_title"/>
4022
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
4023
+ <xsl:call-template name="getTitle">
4024
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
4025
+ </xsl:call-template>
4026
+ </xsl:if>
4027
+ </xsl:variable><xsl:variable name="bibdata">
4018
4028
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
4019
4029
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
4020
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
4030
+ </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
4021
4031
  <xsl:param name="name"/>
4022
4032
  <xsl:param name="lang"/>
4023
4033
  <xsl:variable name="lang_">
@@ -4040,7 +4050,7 @@
4040
4050
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
4041
4051
  </xsl:otherwise>
4042
4052
  </xsl:choose>
4043
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
4053
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:attribute-set name="root-style">
4044
4054
 
4045
4055
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
4046
4056
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
@@ -4209,7 +4219,7 @@
4209
4219
 
4210
4220
 
4211
4221
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
4212
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
4222
+
4213
4223
 
4214
4224
 
4215
4225
 
@@ -4587,7 +4597,8 @@
4587
4597
 
4588
4598
 
4589
4599
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
4590
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
4600
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
4601
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
4591
4602
 
4592
4603
 
4593
4604
 
@@ -4596,9 +4607,9 @@
4596
4607
 
4597
4608
 
4598
4609
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
4610
+ <xsl:attribute name="text-align">right</xsl:attribute>
4599
4611
 
4600
4612
 
4601
-
4602
4613
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
4603
4614
 
4604
4615
 
@@ -4617,6 +4628,9 @@
4617
4628
 
4618
4629
  </xsl:attribute-set><xsl:attribute-set name="term-style">
4619
4630
 
4631
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
4632
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4633
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4620
4634
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
4621
4635
 
4622
4636
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -4647,6 +4661,35 @@
4647
4661
 
4648
4662
 
4649
4663
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
4664
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
4665
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4666
+
4667
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4668
+
4669
+
4670
+
4671
+
4672
+
4673
+
4674
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
4675
+ <xsl:attribute name="text-align">center</xsl:attribute>
4676
+
4677
+
4678
+
4679
+
4680
+
4681
+
4682
+
4683
+
4684
+
4685
+
4686
+
4687
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
4688
+ <xsl:attribute name="text-align">right</xsl:attribute>
4689
+
4690
+
4691
+
4692
+
4650
4693
 
4651
4694
  </xsl:attribute-set><xsl:attribute-set name="image-style">
4652
4695
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -4680,6 +4723,18 @@
4680
4723
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4681
4724
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
4682
4725
 
4726
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
4727
+
4728
+
4729
+
4730
+
4731
+
4732
+
4733
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
4734
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4735
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4736
+
4737
+
4683
4738
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
4684
4739
 
4685
4740
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -4696,13 +4751,19 @@
4696
4751
  </xsl:attribute-set><xsl:variable name="color-added-text">
4697
4752
  <xsl:text>rgb(0, 255, 0)</xsl:text>
4698
4753
  </xsl:variable><xsl:attribute-set name="add-style">
4699
- <xsl:attribute name="color">red</xsl:attribute>
4700
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4701
- <!-- <xsl:attribute name="color">black</xsl:attribute>
4702
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4703
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
4704
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
4705
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
4754
+
4755
+ <xsl:attribute name="color">red</xsl:attribute>
4756
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4757
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
4758
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4759
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
4760
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
4761
+
4762
+ </xsl:attribute-set><xsl:variable name="add-style">
4763
+ <add-style xsl:use-attribute-sets="add-style"/>
4764
+ </xsl:variable><xsl:template name="append_add-style">
4765
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
4766
+ </xsl:template><xsl:variable name="color-deleted-text">
4706
4767
  <xsl:text>red</xsl:text>
4707
4768
  </xsl:variable><xsl:attribute-set name="del-style">
4708
4769
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -4713,6 +4774,33 @@
4713
4774
 
4714
4775
  </xsl:attribute-set><xsl:attribute-set name="list-style">
4715
4776
 
4777
+
4778
+
4779
+
4780
+
4781
+
4782
+
4783
+
4784
+
4785
+
4786
+
4787
+
4788
+
4789
+
4790
+
4791
+
4792
+
4793
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
4794
+
4795
+
4796
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
4797
+
4798
+
4799
+
4800
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
4801
+
4802
+
4803
+
4716
4804
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
4717
4805
  <xsl:attribute name="line-height">135%</xsl:attribute>
4718
4806
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -5006,15 +5094,157 @@
5006
5094
 
5007
5095
 
5008
5096
 
5097
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
5098
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5099
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
5100
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5101
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
5102
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5103
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
5104
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5105
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
5106
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5107
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
5108
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5109
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
5110
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
5111
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
5112
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5113
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
5114
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5115
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
5116
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5117
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
5118
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5119
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
5120
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5121
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
5122
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5123
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
5124
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5125
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
5126
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5127
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
5128
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5129
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
5130
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5131
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
5132
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5133
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
5134
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5135
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
5136
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5137
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
5138
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5139
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
5140
+ <xsl:attribute name="color">#032f62</xsl:attribute>
5141
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
5142
+ <xsl:attribute name="color">#032f62</xsl:attribute>
5143
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
5144
+ <xsl:attribute name="color">#032f62</xsl:attribute>
5145
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
5146
+ <xsl:attribute name="color">#e36209</xsl:attribute>
5147
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
5148
+ <xsl:attribute name="color">#e36209</xsl:attribute>
5149
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
5150
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
5151
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
5152
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
5153
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
5154
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
5155
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
5156
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5157
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
5158
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5159
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
5160
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5161
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
5162
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5163
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
5164
+ <xsl:attribute name="color">#24292e</xsl:attribute>
5165
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
5166
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5167
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5168
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
5169
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
5170
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
5171
+ <xsl:attribute name="color">#24292e</xsl:attribute>
5172
+ <xsl:attribute name="font-style">italic</xsl:attribute>
5173
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
5174
+ <xsl:attribute name="color">#24292e</xsl:attribute>
5175
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5176
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
5177
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5178
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
5179
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
5180
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
5181
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
5182
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
5183
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
5184
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
5185
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
5186
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
5187
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
5188
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
5189
+ <xsl:attribute name="role">H1</xsl:attribute>
5190
+
5191
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
5192
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5193
+ <xsl:attribute name="margin-bottom">84pt</xsl:attribute>
5194
+ <xsl:attribute name="margin-left">-18mm</xsl:attribute>
5195
+
5196
+
5197
+
5198
+
5199
+
5200
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
5201
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
5202
+
5203
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5204
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5205
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
5206
+
5207
+
5208
+
5209
+
5210
+
5009
5211
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
5212
+ <xsl:variable name="nodes_preface_">
5213
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5214
+ <node id="{@id}"/>
5215
+ </xsl:for-each>
5216
+ </xsl:variable>
5217
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
5218
+
5010
5219
  <xsl:for-each select="/*/*[local-name()='preface']/*">
5011
5220
  <xsl:sort select="@displayorder" data-type="number"/>
5221
+
5222
+ <!-- process Section's title -->
5223
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
5224
+ <xsl:if test="$preceding-sibling_id != ''">
5225
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
5226
+ </xsl:if>
5227
+
5012
5228
  <xsl:apply-templates select="." mode="contents"/>
5013
5229
  </xsl:for-each>
5014
5230
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5015
5231
 
5232
+ <xsl:variable name="nodes_sections_">
5233
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
5234
+ <node id="{@id}"/>
5235
+ </xsl:for-each>
5236
+ </xsl:variable>
5237
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
5238
+
5016
5239
  <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
5017
5240
  <xsl:sort select="@displayorder" data-type="number"/>
5241
+
5242
+ <!-- process Section's title -->
5243
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
5244
+ <xsl:if test="$preceding-sibling_id != ''">
5245
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
5246
+ </xsl:if>
5247
+
5018
5248
  <xsl:apply-templates select="." mode="contents"/>
5019
5249
  </xsl:for-each>
5020
5250
 
@@ -5027,6 +5257,30 @@
5027
5257
  <xsl:sort select="@displayorder" data-type="number"/>
5028
5258
  <xsl:apply-templates select="." mode="contents"/>
5029
5259
  </xsl:for-each>
5260
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
5261
+ <xsl:param name="always"/>
5262
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5263
+ <xsl:call-template name="processTables_Contents"/>
5264
+ </xsl:if>
5265
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5266
+ <xsl:call-template name="processFigures_Contents"/>
5267
+ </xsl:if>
5268
+ </xsl:template><xsl:template name="processTables_Contents">
5269
+ <tables>
5270
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
5271
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
5272
+ <xsl:copy-of select="*[local-name() = 'name']"/>
5273
+ </table>
5274
+ </xsl:for-each>
5275
+ </tables>
5276
+ </xsl:template><xsl:template name="processFigures_Contents">
5277
+ <figures>
5278
+ <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
5279
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
5280
+ <xsl:copy-of select="*[local-name() = 'name']"/>
5281
+ </figure>
5282
+ </xsl:for-each>
5283
+ </figures>
5030
5284
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5031
5285
  <xsl:for-each select="/*/*[local-name()='preface']/*">
5032
5286
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -5102,9 +5356,12 @@
5102
5356
 
5103
5357
 
5104
5358
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
5359
+ <xsl:param name="margin"/>
5105
5360
 
5106
5361
  <!-- process in the template 'paragraph' -->
5107
- <xsl:call-template name="paragraph"/>
5362
+ <xsl:call-template name="paragraph">
5363
+ <xsl:with-param name="margin" select="$margin"/>
5364
+ </xsl:call-template>
5108
5365
 
5109
5366
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
5110
5367
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -5116,9 +5373,12 @@
5116
5373
  <xsl:call-template name="title"/>
5117
5374
 
5118
5375
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
5376
+ <xsl:param name="margin"/>
5119
5377
 
5120
5378
  <!-- process in the template 'paragraph' -->
5121
- <xsl:call-template name="paragraph"/>
5379
+ <xsl:call-template name="paragraph">
5380
+ <xsl:with-param name="margin" select="$margin"/>
5381
+ </xsl:call-template>
5122
5382
 
5123
5383
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
5124
5384
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -5157,7 +5417,7 @@
5157
5417
  </xsl:call-template>
5158
5418
  </xsl:if>
5159
5419
  </xsl:variable>
5160
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
5420
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
5161
5421
 
5162
5422
 
5163
5423
  <xsl:variable name="margin-side">
@@ -5439,7 +5699,7 @@
5439
5699
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
5440
5700
  <!-- 2009 thinspace -->
5441
5701
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
5442
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
5702
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
5443
5703
  </xsl:call-template>
5444
5704
  </xsl:variable>
5445
5705
  <xsl:variable name="max_length">
@@ -5480,8 +5740,7 @@
5480
5740
  </xsl:call-template>
5481
5741
  </xsl:if>
5482
5742
  </xsl:template><xsl:template match="text()" mode="td_text">
5483
- <xsl:variable name="zero-space">​</xsl:variable>
5484
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
5743
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
5485
5744
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
5486
5745
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
5487
5746
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -5887,37 +6146,7 @@
5887
6146
 
5888
6147
  <!-- list of footnotes to calculate actual footnotes number -->
5889
6148
  <xsl:variable name="p_fn_">
5890
- <xsl:choose>
5891
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
5892
- <fn gen_id="{generate-id(.)}">
5893
- <xsl:copy-of select="@*"/>
5894
- <xsl:copy-of select="node()"/>
5895
- </fn>
5896
- </xsl:when>
5897
- <xsl:otherwise>
5898
- <!-- itetation for:
5899
- footnotes in bibdata/title
5900
- footnotes in bibliography
5901
- footnotes in document's body (except table's head/body/foot and figure text)
5902
- -->
5903
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
5904
- <fn gen_id="{generate-id(.)}">
5905
- <xsl:copy-of select="@*"/>
5906
- <xsl:copy-of select="node()"/>
5907
- </fn>
5908
- </xsl:for-each>
5909
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
5910
- <xsl:sort select="@displayorder" data-type="number"/>
5911
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
5912
- <!-- copy unique fn -->
5913
- <fn gen_id="{generate-id(.)}">
5914
- <xsl:copy-of select="@*"/>
5915
- <xsl:copy-of select="node()"/>
5916
- </fn>
5917
- </xsl:for-each>
5918
- </xsl:for-each>
5919
- </xsl:otherwise>
5920
- </xsl:choose>
6149
+ <xsl:call-template name="get_fn_list"/>
5921
6150
  </xsl:variable>
5922
6151
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
5923
6152
 
@@ -5978,6 +6207,38 @@
5978
6207
  <xsl:copy-of select="$footnote_inline"/>
5979
6208
  </xsl:otherwise>
5980
6209
  </xsl:choose>
6210
+ </xsl:template><xsl:template name="get_fn_list">
6211
+ <xsl:choose>
6212
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
6213
+ <fn gen_id="{generate-id(.)}">
6214
+ <xsl:copy-of select="@*"/>
6215
+ <xsl:copy-of select="node()"/>
6216
+ </fn>
6217
+ </xsl:when>
6218
+ <xsl:otherwise>
6219
+ <!-- itetation for:
6220
+ footnotes in bibdata/title
6221
+ footnotes in bibliography
6222
+ footnotes in document's body (except table's head/body/foot and figure text)
6223
+ -->
6224
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
6225
+ <fn gen_id="{generate-id(.)}">
6226
+ <xsl:copy-of select="@*"/>
6227
+ <xsl:copy-of select="node()"/>
6228
+ </fn>
6229
+ </xsl:for-each>
6230
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
6231
+ <xsl:sort select="@displayorder" data-type="number"/>
6232
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6233
+ <!-- copy unique fn -->
6234
+ <fn gen_id="{generate-id(.)}">
6235
+ <xsl:copy-of select="@*"/>
6236
+ <xsl:copy-of select="node()"/>
6237
+ </fn>
6238
+ </xsl:for-each>
6239
+ </xsl:for-each>
6240
+ </xsl:otherwise>
6241
+ </xsl:choose>
5981
6242
  </xsl:template><xsl:template name="table_fn_display">
5982
6243
  <xsl:variable name="references">
5983
6244
 
@@ -6157,7 +6418,7 @@
6157
6418
  </fo:inline>
6158
6419
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
6159
6420
  <fo:inline><xsl:value-of select="."/></fo:inline>
6160
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
6421
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
6161
6422
  <fo:inline>
6162
6423
  <xsl:apply-templates/>
6163
6424
  </fo:inline>
@@ -6521,20 +6782,44 @@
6521
6782
  <fo:inline text-decoration="underline">
6522
6783
  <xsl:apply-templates/>
6523
6784
  </fo:inline>
6524
- </xsl:template><xsl:template match="*[local-name()='add']">
6785
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
6525
6786
  <xsl:param name="skip">true</xsl:param>
6787
+ <xsl:param name="block">false</xsl:param>
6788
+ <xsl:param name="type"/>
6789
+ <xsl:param name="text-align"/>
6526
6790
  <xsl:choose>
6527
6791
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
6528
6792
  <xsl:choose>
6529
- <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab'])) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
6793
+ <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
6530
6794
  <xsl:otherwise>
6531
- <fo:inline>
6795
+ <xsl:variable name="tag">
6532
6796
  <xsl:call-template name="insertTag">
6533
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
6797
+ <xsl:with-param name="type">
6798
+ <xsl:choose>
6799
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
6800
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
6801
+ </xsl:choose>
6802
+ </xsl:with-param>
6534
6803
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
6535
6804
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
6536
6805
  </xsl:call-template>
6537
- </fo:inline>
6806
+ </xsl:variable>
6807
+ <xsl:choose>
6808
+ <xsl:when test="$block = 'false'">
6809
+ <fo:inline>
6810
+ <xsl:copy-of select="$tag"/>
6811
+ </fo:inline>
6812
+ </xsl:when>
6813
+ <xsl:otherwise>
6814
+ <fo:block> <!-- for around figures -->
6815
+ <xsl:if test="$text-align != ''">
6816
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
6817
+ </xsl:if>
6818
+ <xsl:copy-of select="$tag"/>
6819
+ </fo:block>
6820
+ </xsl:otherwise>
6821
+ </xsl:choose>
6822
+
6538
6823
  </xsl:otherwise>
6539
6824
  </xsl:choose>
6540
6825
  </xsl:when>
@@ -6893,17 +7178,21 @@
6893
7178
  </xsl:apply-templates>
6894
7179
  </xsl:template><xsl:template name="getLang">
6895
7180
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6896
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6897
7181
  <xsl:variable name="language">
6898
7182
  <xsl:choose>
6899
7183
  <xsl:when test="$language_current != ''">
6900
7184
  <xsl:value-of select="$language_current"/>
6901
7185
  </xsl:when>
6902
- <xsl:when test="$language_current_2 != ''">
6903
- <xsl:value-of select="$language_current_2"/>
6904
- </xsl:when>
6905
7186
  <xsl:otherwise>
6906
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7187
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
7188
+ <xsl:choose>
7189
+ <xsl:when test="$language_current_2 != ''">
7190
+ <xsl:value-of select="$language_current_2"/>
7191
+ </xsl:when>
7192
+ <xsl:otherwise>
7193
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7194
+ </xsl:otherwise>
7195
+ </xsl:choose>
6907
7196
  </xsl:otherwise>
6908
7197
  </xsl:choose>
6909
7198
  </xsl:variable>
@@ -7132,6 +7421,9 @@
7132
7421
  </fo:inline>
7133
7422
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
7134
7423
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7424
+ <xsl:if test="parent::*[local-name() = 'add']">
7425
+ <xsl:call-template name="append_add-style"/>
7426
+ </xsl:if>
7135
7427
  <xsl:apply-templates/>
7136
7428
  </fo:basic-link>
7137
7429
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -7146,8 +7438,8 @@
7146
7438
 
7147
7439
  </xsl:if>
7148
7440
  <fo:block-container margin-left="0mm">
7149
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
7150
- <xsl:apply-templates/>
7441
+ <fo:block id="{@id}">
7442
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
7151
7443
  </fo:block>
7152
7444
  </fo:block-container>
7153
7445
  </fo:block-container>
@@ -7159,10 +7451,43 @@
7159
7451
  <fo:inline>
7160
7452
  <xsl:apply-templates/>
7161
7453
  </fo:inline>
7162
- </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']" mode="formula_number"> <!-- show by demand -->
7454
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
7163
7455
  <xsl:if test="normalize-space() != ''">
7164
7456
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
7165
7457
  </xsl:if>
7458
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
7459
+ <fo:block xsl:use-attribute-sets="formula-style">
7460
+
7461
+
7462
+
7463
+ <fo:table table-layout="fixed" width="100%">
7464
+ <fo:table-column column-width="95%"/>
7465
+ <fo:table-column column-width="5%"/>
7466
+ <fo:table-body>
7467
+ <fo:table-row>
7468
+ <fo:table-cell display-align="center">
7469
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7470
+
7471
+
7472
+
7473
+ <xsl:apply-templates/>
7474
+ </fo:block>
7475
+ </fo:table-cell>
7476
+ <fo:table-cell display-align="center">
7477
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
7478
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
7479
+ </fo:block>
7480
+ </fo:table-cell>
7481
+ </fo:table-row>
7482
+ </fo:table-body>
7483
+ </fo:table>
7484
+ </fo:block>
7485
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
7486
+ <fo:block xsl:use-attribute-sets="formula-style">
7487
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7488
+ <xsl:apply-templates/>
7489
+ </fo:block>
7490
+ </fo:block>
7166
7491
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
7167
7492
 
7168
7493
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -7208,6 +7533,13 @@
7208
7533
 
7209
7534
 
7210
7535
 
7536
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7537
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7538
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7539
+ <xsl:call-template name="append_add-style"/>
7540
+ </xsl:if>
7541
+
7542
+
7211
7543
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
7212
7544
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
7213
7545
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -7246,6 +7578,12 @@
7246
7578
 
7247
7579
 
7248
7580
 
7581
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7582
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7583
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7584
+ <xsl:call-template name="append_add-style"/>
7585
+ </xsl:if>
7586
+
7249
7587
  <xsl:apply-templates select="*[local-name() = 'name']"/>
7250
7588
 
7251
7589
  </fo:inline>
@@ -7299,6 +7637,7 @@
7299
7637
  </fo:block>
7300
7638
  </xsl:template><xsl:template match="*[local-name() = 'term']">
7301
7639
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
7640
+
7302
7641
 
7303
7642
 
7304
7643
 
@@ -7739,7 +8078,11 @@
7739
8078
  <xsl:value-of select="."/>
7740
8079
  </xsl:template><xsl:template match="node()" mode="contents">
7741
8080
  <xsl:apply-templates mode="contents"/>
7742
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
8081
+ </xsl:template><xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" mode="contents_no_displayorder">
8082
+ <xsl:call-template name="contents_section-title"/>
8083
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
8084
+ <xsl:call-template name="contents_section-title"/>
8085
+ </xsl:template><xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title']/@depth or ../*[local-name() = 'title']/@depth = 1)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
7743
8086
  <xsl:variable name="level">
7744
8087
  <xsl:call-template name="getLevel">
7745
8088
  <xsl:with-param name="depth" select="@depth"/>
@@ -7808,13 +8151,14 @@
7808
8151
  <xsl:apply-templates mode="bookmarks"/>
7809
8152
  </xsl:template><xsl:template name="addBookmarks">
7810
8153
  <xsl:param name="contents"/>
7811
- <xsl:if test="xalan:nodeset($contents)//item">
8154
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
8155
+ <xsl:if test="$contents_nodes//item">
7812
8156
  <fo:bookmark-tree>
7813
8157
  <xsl:choose>
7814
- <xsl:when test="xalan:nodeset($contents)/doc">
8158
+ <xsl:when test="$contents_nodes/doc">
7815
8159
  <xsl:choose>
7816
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
7817
- <xsl:for-each select="xalan:nodeset($contents)/doc">
8160
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
8161
+ <xsl:for-each select="$contents_nodes/doc">
7818
8162
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7819
8163
  <xsl:if test="@bundle = 'true'">
7820
8164
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -7865,7 +8209,7 @@
7865
8209
  </xsl:for-each>
7866
8210
  </xsl:when>
7867
8211
  <xsl:otherwise>
7868
- <xsl:for-each select="xalan:nodeset($contents)/doc">
8212
+ <xsl:for-each select="$contents_nodes/doc">
7869
8213
 
7870
8214
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
7871
8215
 
@@ -7883,25 +8227,36 @@
7883
8227
  </xsl:choose>
7884
8228
  </xsl:when>
7885
8229
  <xsl:otherwise>
7886
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
8230
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
8231
+
8232
+ <xsl:call-template name="insertFigureBookmarks">
8233
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
8234
+ </xsl:call-template>
8235
+
8236
+ <xsl:call-template name="insertTableBookmarks">
8237
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
8238
+ <xsl:with-param name="lang" select="@lang"/>
8239
+ </xsl:call-template>
8240
+
7887
8241
  </xsl:otherwise>
7888
8242
  </xsl:choose>
7889
8243
 
8244
+
7890
8245
 
7891
8246
 
7892
8247
 
7893
8248
 
7894
-
7895
-
8249
+
7896
8250
 
7897
8251
  </fo:bookmark-tree>
7898
8252
  </xsl:if>
7899
8253
  </xsl:template><xsl:template name="insertFigureBookmarks">
7900
8254
  <xsl:param name="contents"/>
7901
- <xsl:if test="xalan:nodeset($contents)/figure">
7902
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
8255
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
8256
+ <xsl:if test="$contents_nodes/figure">
8257
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
7903
8258
  <fo:bookmark-title>Figures</fo:bookmark-title>
7904
- <xsl:for-each select="xalan:nodeset($contents)/figure">
8259
+ <xsl:for-each select="$contents_nodes/figure">
7905
8260
  <fo:bookmark internal-destination="{@id}">
7906
8261
  <fo:bookmark-title>
7907
8262
  <xsl:value-of select="normalize-space(title)"/>
@@ -7910,18 +8265,40 @@
7910
8265
  </xsl:for-each>
7911
8266
  </fo:bookmark>
7912
8267
  </xsl:if>
8268
+
8269
+
8270
+ <xsl:if test="$contents_nodes//figures/figure">
8271
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
8272
+
8273
+
8274
+
8275
+ <xsl:variable name="bookmark-title">
8276
+
8277
+ <xsl:value-of select="$title-list-figures"/>
8278
+
8279
+ </xsl:variable>
8280
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
8281
+ <xsl:for-each select="$contents_nodes//figures/figure">
8282
+ <fo:bookmark internal-destination="{@id}">
8283
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
8284
+ </fo:bookmark>
8285
+ </xsl:for-each>
8286
+ </fo:bookmark>
8287
+ </xsl:if>
8288
+
7913
8289
  </xsl:template><xsl:template name="insertTableBookmarks">
7914
8290
  <xsl:param name="contents"/>
7915
8291
  <xsl:param name="lang"/>
7916
- <xsl:if test="xalan:nodeset($contents)/table">
7917
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
8292
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
8293
+ <xsl:if test="$contents_nodes/table">
8294
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
7918
8295
  <fo:bookmark-title>
7919
8296
  <xsl:choose>
7920
8297
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
7921
8298
  <xsl:otherwise>Tables</xsl:otherwise>
7922
8299
  </xsl:choose>
7923
8300
  </fo:bookmark-title>
7924
- <xsl:for-each select="xalan:nodeset($contents)/table">
8301
+ <xsl:for-each select="$contents_nodes/table">
7925
8302
  <fo:bookmark internal-destination="{@id}">
7926
8303
  <fo:bookmark-title>
7927
8304
  <xsl:value-of select="normalize-space(title)"/>
@@ -7930,6 +8307,29 @@
7930
8307
  </xsl:for-each>
7931
8308
  </fo:bookmark>
7932
8309
  </xsl:if>
8310
+
8311
+
8312
+ <xsl:if test="$contents_nodes//tables/table">
8313
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
8314
+
8315
+
8316
+
8317
+ <xsl:variable name="bookmark-title">
8318
+
8319
+ <xsl:value-of select="$title-list-tables"/>
8320
+
8321
+ </xsl:variable>
8322
+
8323
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
8324
+
8325
+ <xsl:for-each select="$contents_nodes//tables/table">
8326
+ <fo:bookmark internal-destination="{@id}">
8327
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
8328
+ </fo:bookmark>
8329
+ </xsl:for-each>
8330
+ </fo:bookmark>
8331
+ </xsl:if>
8332
+
7933
8333
  </xsl:template><xsl:template name="getLangVersion">
7934
8334
  <xsl:param name="lang"/>
7935
8335
  <xsl:param name="doctype" select="''"/>
@@ -8142,12 +8542,140 @@
8142
8542
  </fo:block-container>
8143
8543
  </fo:block-container>
8144
8544
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
8145
- <xsl:variable name="text">
8545
+ <xsl:choose>
8546
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
8547
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
8548
+ <xsl:choose>
8549
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
8550
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
8551
+ </xsl:when>
8552
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
8553
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
8554
+ </xsl:otherwise>
8555
+ </xsl:choose>
8556
+ </xsl:when>
8557
+ <xsl:otherwise>
8558
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
8559
+ </xsl:otherwise>
8560
+ </xsl:choose>
8561
+
8562
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
8563
+ <xsl:variable name="text_step1">
8146
8564
  <xsl:call-template name="add-zero-spaces-equal"/>
8147
8565
  </xsl:variable>
8148
- <xsl:call-template name="add-zero-spaces-java">
8149
- <xsl:with-param name="text" select="$text"/>
8150
- </xsl:call-template>
8566
+ <xsl:variable name="text_step2">
8567
+ <xsl:call-template name="add-zero-spaces-java">
8568
+ <xsl:with-param name="text" select="$text_step1"/>
8569
+ </xsl:call-template>
8570
+ </xsl:variable>
8571
+ <xsl:value-of select="$text_step2"/>
8572
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
8573
+ <xsl:apply-templates mode="syntax_highlight"/>
8574
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
8575
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
8576
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
8577
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
8578
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
8579
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
8580
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
8581
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
8582
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
8583
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
8584
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
8585
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
8586
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
8587
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
8588
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
8589
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
8590
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
8591
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
8592
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
8593
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
8594
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
8595
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
8596
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
8597
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
8598
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
8599
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
8600
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
8601
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
8602
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
8603
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
8604
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
8605
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
8606
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
8607
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
8608
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
8609
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
8610
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
8611
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
8612
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
8613
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
8614
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
8615
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
8616
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
8617
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
8618
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
8619
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
8620
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
8621
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
8622
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
8623
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
8624
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
8625
+ <fo:inline>
8626
+ <xsl:variable name="classes_">
8627
+ <xsl:call-template name="split">
8628
+ <xsl:with-param name="pText" select="@class"/>
8629
+ <xsl:with-param name="sep" select="' '"/>
8630
+ </xsl:call-template>
8631
+ <!-- a few classes together (_and_ suffix) -->
8632
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
8633
+ <item>hljs-char_and_escape_</item>
8634
+ </xsl:if>
8635
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
8636
+ <item>hljs-title_and_class_</item>
8637
+ </xsl:if>
8638
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
8639
+ <item>hljs-title_and_class__and_inherited__</item>
8640
+ </xsl:if>
8641
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
8642
+ <item>hljs-title_and_function_</item>
8643
+ </xsl:if>
8644
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
8645
+ <item>hljs-variable_and_language_</item>
8646
+ </xsl:if>
8647
+ <!-- with parent classes (_ suffix) -->
8648
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
8649
+ <item>hljs-meta_hljs-keyword</item>
8650
+ </xsl:if>
8651
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
8652
+ <item>hljs-meta_hljs-string</item>
8653
+ </xsl:if>
8654
+ </xsl:variable>
8655
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
8656
+
8657
+ <xsl:for-each select="$classes/item">
8658
+ <xsl:variable name="class_name" select="."/>
8659
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
8660
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
8661
+ </xsl:for-each>
8662
+ </xsl:for-each>
8663
+
8664
+ <!-- <xsl:variable name="class_name">
8665
+ <xsl:choose>
8666
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
8667
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
8668
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
8669
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
8670
+ </xsl:choose>
8671
+ </xsl:variable>
8672
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
8673
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
8674
+ </xsl:for-each> -->
8675
+
8676
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
8677
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
8678
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
8151
8679
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
8152
8680
  <xsl:if test="normalize-space() != ''">
8153
8681
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -8472,6 +9000,8 @@
8472
9000
  </xsl:otherwise>
8473
9001
  </xsl:choose> -->
8474
9002
  </fo:block>
9003
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
9004
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
8475
9005
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
8476
9006
  <xsl:if test="normalize-space() != ''">
8477
9007
  <xsl:value-of select="."/>
@@ -8518,11 +9048,14 @@
8518
9048
 
8519
9049
 
8520
9050
  <fo:block-container margin-left="0mm">
8521
-
8522
- <fo:block xsl:use-attribute-sets="quote-style">
9051
+ <fo:block-container xsl:use-attribute-sets="quote-style">
8523
9052
 
8524
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
8525
- </fo:block>
9053
+ <fo:block-container margin-left="0mm" margin-right="0mm">
9054
+ <fo:block role="BlockQuote">
9055
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
9056
+ </fo:block>
9057
+ </fo:block-container>
9058
+ </fo:block-container>
8526
9059
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
8527
9060
  <fo:block xsl:use-attribute-sets="quote-source-style">
8528
9061
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -8543,26 +9076,11 @@
8543
9076
  </xsl:template><xsl:template match="*[local-name() = 'author']">
8544
9077
  <xsl:text>— </xsl:text>
8545
9078
  <xsl:apply-templates/>
8546
- </xsl:template><xsl:variable name="bibitem_hidden_">
8547
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
8548
- <xsl:copy-of select="."/>
8549
- </xsl:for-each>
8550
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
8551
- <xsl:copy-of select="."/>
8552
- </xsl:for-each>
8553
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
8554
-
8555
- <xsl:variable name="bibitemid">
8556
- <xsl:choose>
8557
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
8558
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
8559
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
8560
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
8561
- </xsl:choose>
8562
- </xsl:variable>
8563
-
9079
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
9080
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
9081
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
8564
9082
  <xsl:choose>
8565
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
9083
+ <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
8566
9084
  <fo:inline xsl:use-attribute-sets="eref-style">
8567
9085
  <xsl:if test="@type = 'footnote'">
8568
9086
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -8576,8 +9094,8 @@
8576
9094
  <xsl:variable name="text" select="normalize-space()"/>
8577
9095
 
8578
9096
 
8579
-
8580
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9097
+
9098
+ <fo:basic-link fox:alt-text="{@citeas}">
8581
9099
  <xsl:if test="normalize-space(@citeas) = ''">
8582
9100
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8583
9101
  </xsl:if>
@@ -8596,14 +9114,21 @@
8596
9114
 
8597
9115
  </xsl:if>
8598
9116
 
8599
-
9117
+ <xsl:choose>
9118
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9119
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9120
+ </xsl:when>
9121
+ <xsl:otherwise>
9122
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9123
+ </xsl:otherwise>
9124
+ </xsl:choose>
8600
9125
 
8601
9126
  <xsl:apply-templates/>
8602
9127
  </fo:basic-link>
8603
-
9128
+
8604
9129
  </fo:inline>
8605
9130
  </xsl:when>
8606
- <xsl:otherwise>
9131
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
8607
9132
  <fo:inline><xsl:apply-templates/></fo:inline>
8608
9133
  </xsl:otherwise>
8609
9134
  </xsl:choose>
@@ -8676,6 +9201,31 @@
8676
9201
  <xsl:with-param name="count" select="$count - 1"/>
8677
9202
  </xsl:call-template>
8678
9203
  </xsl:if>
9204
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
9205
+ <xsl:variable name="level">
9206
+ <xsl:call-template name="getLevel"/>
9207
+ </xsl:variable>
9208
+ <xsl:variable name="font-size">
9209
+ inherit
9210
+ </xsl:variable>
9211
+ <xsl:variable name="levelTerm">
9212
+ <xsl:call-template name="getLevelTermName"/>
9213
+ </xsl:variable>
9214
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
9215
+
9216
+
9217
+
9218
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
9219
+ <fo:block xsl:use-attribute-sets="term-name-style">
9220
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
9221
+ </fo:block>
9222
+ </xsl:if>
9223
+
9224
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
9225
+ <xsl:call-template name="setStyle_preferred"/>
9226
+ <xsl:apply-templates/>
9227
+ </fo:block>
9228
+ </fo:block>
8679
9229
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
8680
9230
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
8681
9231
  <xsl:text> </xsl:text>
@@ -8761,26 +9311,10 @@
8761
9311
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
8762
9312
  </xsl:template><xsl:variable name="ul_labels_">
8763
9313
 
8764
- <label level="1" font-size="15pt">•</label>
8765
- <label level="2">−</label><!-- &#x2212; - minus sign. &#x2014; - en dash -->
8766
- <label level="3" font-size="75%">o</label> <!-- white circle -->
8767
-
8768
-
8769
-
8770
-
8771
-
8772
-
8773
-
8774
-
8775
-
8776
-
8777
-
8778
-
8779
-
8780
-
8781
-
8782
-
8783
-
9314
+ <label level="1" font-size="15pt">•</label>
9315
+ <label level="2">−</label><!-- &#x2212; - minus sign. &#x2014; - en dash -->
9316
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
9317
+
8784
9318
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
8785
9319
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8786
9320
  <xsl:variable name="list_level">
@@ -8806,6 +9340,91 @@
8806
9340
  </xsl:template><xsl:template match="label" mode="ul_labels">
8807
9341
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
8808
9342
  <xsl:value-of select="."/>
9343
+ </xsl:template><xsl:template name="getListItemFormat">
9344
+ <!-- Example: for BSI <?list-type loweralpha?> -->
9345
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
9346
+ <xsl:choose>
9347
+ <xsl:when test="local-name(..) = 'ul'">
9348
+ <xsl:choose>
9349
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
9350
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
9351
+ </xsl:choose>
9352
+ </xsl:when>
9353
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
9354
+
9355
+ <!-- Example: for BSI <?list-start 2?> -->
9356
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
9357
+
9358
+ <xsl:variable name="start_value">
9359
+ <xsl:choose>
9360
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
9361
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
9362
+ </xsl:when>
9363
+ <xsl:when test="normalize-space(../@start) != ''">
9364
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
9365
+ </xsl:when>
9366
+ <xsl:otherwise>0</xsl:otherwise>
9367
+ </xsl:choose>
9368
+ </xsl:variable>
9369
+
9370
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
9371
+
9372
+ <xsl:variable name="type">
9373
+ <xsl:choose>
9374
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
9375
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
9376
+
9377
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
9378
+
9379
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9380
+ <xsl:variable name="list_level">
9381
+ <xsl:choose>
9382
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
9383
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
9384
+ </xsl:choose>
9385
+ </xsl:variable>
9386
+
9387
+ <xsl:choose>
9388
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
9389
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
9390
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
9391
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
9392
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
9393
+ <xsl:otherwise> <!-- level 1 -->
9394
+ <xsl:choose>
9395
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
9396
+ <xsl:otherwise>alphabet</xsl:otherwise>
9397
+ </xsl:choose>
9398
+ </xsl:otherwise>
9399
+ </xsl:choose>
9400
+
9401
+ </xsl:otherwise>
9402
+ </xsl:choose>
9403
+ </xsl:variable>
9404
+
9405
+ <xsl:variable name="format">
9406
+ <xsl:choose>
9407
+ <xsl:when test="$type = 'arabic'">
9408
+ 1.
9409
+ </xsl:when>
9410
+ <xsl:when test="$type = 'alphabet'">
9411
+ a)
9412
+ </xsl:when>
9413
+ <xsl:when test="$type = 'alphabet_upper'">
9414
+ A.
9415
+ </xsl:when>
9416
+ <xsl:when test="$type = 'roman'">
9417
+ (i)
9418
+ </xsl:when>
9419
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
9420
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
9421
+ </xsl:choose>
9422
+ </xsl:variable>
9423
+
9424
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
9425
+
9426
+ </xsl:otherwise>
9427
+ </xsl:choose>
8809
9428
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
8810
9429
  <xsl:choose>
8811
9430
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -8823,18 +9442,71 @@
8823
9442
 
8824
9443
  <fo:block-container margin-left="0mm">
8825
9444
  <fo:block>
8826
- <xsl:apply-templates select="." mode="ul_ol"/>
9445
+ <xsl:apply-templates select="." mode="list"/>
8827
9446
  </fo:block>
8828
9447
  </fo:block-container>
8829
9448
  </fo:block-container>
8830
9449
  </xsl:when>
8831
9450
  <xsl:otherwise>
8832
9451
  <fo:block>
8833
- <xsl:apply-templates select="." mode="ul_ol"/>
9452
+ <xsl:apply-templates select="." mode="list"/>
8834
9453
  </fo:block>
8835
9454
  </xsl:otherwise>
8836
9455
  </xsl:choose>
8837
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
9456
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
9457
+ <fo:list-block xsl:use-attribute-sets="list-style">
9458
+
9459
+
9460
+
9461
+
9462
+
9463
+
9464
+
9465
+
9466
+
9467
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
9468
+ </fo:list-block>
9469
+ <!-- <xsl:for-each select="./iho:note">
9470
+ <xsl:call-template name="note"/>
9471
+ </xsl:for-each> -->
9472
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
9473
+ </xsl:template><xsl:template match="*[local-name()='li']">
9474
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
9475
+ <xsl:copy-of select="@id"/>
9476
+
9477
+
9478
+
9479
+ <fo:list-item-label end-indent="label-end()">
9480
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
9481
+
9482
+
9483
+
9484
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9485
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
9486
+ <xsl:call-template name="append_add-style"/>
9487
+ </xsl:if>
9488
+
9489
+ <xsl:call-template name="getListItemFormat"/>
9490
+ </fo:block>
9491
+ </fo:list-item-label>
9492
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9493
+ <fo:block>
9494
+
9495
+
9496
+
9497
+
9498
+
9499
+ <xsl:apply-templates/>
9500
+
9501
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
9502
+
9503
+ <xsl:for-each select="./bsi:note">
9504
+ <xsl:call-template name="note"/>
9505
+ </xsl:for-each> -->
9506
+ </fo:block>
9507
+ </fo:list-item-body>
9508
+ </fo:list-item>
9509
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
8838
9510
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
8839
9511
  <bookmark><xsl:value-of select="@id"/></bookmark>
8840
9512
  </xsl:for-each>
@@ -8856,7 +9528,7 @@
8856
9528
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8857
9529
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
8858
9530
  <xsl:if test="@to">
8859
- <xsl:value-of select="$dash"/>
9531
+ <xsl:value-of select="$en_dash"/>
8860
9532
  <xsl:copy>
8861
9533
  <xsl:copy-of select="@*"/>
8862
9534
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -8881,7 +9553,7 @@
8881
9553
  <xsl:param name="target"/>
8882
9554
  <!-- <node></node> -->
8883
9555
  <xsl:choose>
8884
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
9556
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
8885
9557
  <!-- skip text (i.e. remove it) and process next element -->
8886
9558
  <!-- [removed_<xsl:value-of select="."/>] -->
8887
9559
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -8965,12 +9637,22 @@
8965
9637
  </xsl:variable>
8966
9638
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
8967
9639
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9640
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
9641
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
9642
+ <!-- Index -->
9643
+ <xsl:apply-templates/>
9644
+ </fo:block>
9645
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
9646
+ <!-- Letter A, B, C, ... -->
9647
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
9648
+ <xsl:apply-templates/>
9649
+ </fo:block>
8968
9650
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
8969
9651
  <xsl:apply-templates/>
8970
9652
  <fo:block>
8971
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
8972
- <fo:block> </fo:block>
8973
- </xsl:if>
9653
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
9654
+ <fo:block> </fo:block>
9655
+ </xsl:if>
8974
9656
  </fo:block>
8975
9657
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
8976
9658
  <xsl:apply-templates/>
@@ -8980,6 +9662,9 @@
8980
9662
 
8981
9663
  <xsl:apply-templates/>
8982
9664
  </fo:block>
9665
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
9666
+ <!-- to split by '_' and other chars -->
9667
+ <xsl:call-template name="add-zero-spaces-java"/>
8983
9668
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
8984
9669
  <fo:inline id="{@id}" font-size="1pt"/>
8985
9670
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -9178,6 +9863,24 @@
9178
9863
  <xsl:apply-templates/>
9179
9864
  </fo:inline>
9180
9865
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
9866
+
9867
+ <!-- list of footnotes to calculate actual footnotes number -->
9868
+ <xsl:variable name="p_fn_">
9869
+ <xsl:call-template name="get_fn_list"/>
9870
+ </xsl:variable>
9871
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9872
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
9873
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9874
+ <!-- fn sequence number in document -->
9875
+ <xsl:variable name="current_fn_number">
9876
+ <xsl:choose>
9877
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9878
+ <xsl:otherwise>
9879
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
9880
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
9881
+ </xsl:otherwise>
9882
+ </xsl:choose>
9883
+ </xsl:variable>
9181
9884
  <fo:footnote>
9182
9885
  <xsl:variable name="number">
9183
9886
 
@@ -9186,22 +9889,26 @@
9186
9889
  <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
9187
9890
  </xsl:when>
9188
9891
  <xsl:otherwise>
9189
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
9892
+ <xsl:value-of select="$current_fn_number"/>
9190
9893
  </xsl:otherwise>
9191
9894
  </xsl:choose>
9192
9895
 
9193
9896
  </xsl:variable>
9897
+
9898
+ <xsl:variable name="current_fn_number_text">
9899
+ <xsl:value-of select="$number"/>
9900
+
9901
+ </xsl:variable>
9902
+
9194
9903
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
9195
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
9196
- <xsl:value-of select="$number"/>
9197
-
9904
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
9905
+ <xsl:value-of select="$current_fn_number_text"/>
9198
9906
  </fo:basic-link>
9199
9907
  </fo:inline>
9200
9908
  <fo:footnote-body>
9201
9909
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
9202
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
9203
- <xsl:value-of select="$number"/>
9204
-
9910
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
9911
+ <xsl:value-of select="$current_fn_number_text"/>
9205
9912
  </fo:inline>
9206
9913
  <xsl:apply-templates/>
9207
9914
  </fo:block>
@@ -9327,7 +10034,7 @@
9327
10034
  </fo:table-body>
9328
10035
  </fo:table>
9329
10036
  </fo:block>
9330
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
10037
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
9331
10038
  <fo:table-row min-height="5mm">
9332
10039
  <xsl:apply-templates/>
9333
10040
  </fo:table-row>
@@ -9447,6 +10154,78 @@
9447
10154
  <xsl:apply-templates/>
9448
10155
  </fo:block>
9449
10156
 
10157
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
10158
+ <xsl:copy>
10159
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
10160
+ </xsl:copy>
10161
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
10162
+ <xsl:copy>
10163
+ <xsl:copy-of select="@*"/>
10164
+
10165
+ <xsl:variable name="nodes_preface_">
10166
+ <xsl:for-each select="*">
10167
+ <node id="{@id}"/>
10168
+ </xsl:for-each>
10169
+ </xsl:variable>
10170
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
10171
+
10172
+ <xsl:for-each select="*">
10173
+ <xsl:sort select="@displayorder" data-type="number"/>
10174
+
10175
+ <!-- process Section's title -->
10176
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
10177
+ <xsl:if test="$preceding-sibling_id != ''">
10178
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
10179
+ </xsl:if>
10180
+
10181
+ <xsl:choose>
10182
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
10183
+ <xsl:otherwise>
10184
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
10185
+ </xsl:otherwise>
10186
+ </xsl:choose>
10187
+
10188
+ </xsl:for-each>
10189
+ </xsl:copy>
10190
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
10191
+ <xsl:copy>
10192
+ <xsl:copy-of select="@*"/>
10193
+
10194
+ <xsl:variable name="nodes_sections_">
10195
+ <xsl:for-each select="*">
10196
+ <node id="{@id}"/>
10197
+ </xsl:for-each>
10198
+ </xsl:variable>
10199
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
10200
+
10201
+ <!-- move section 'Normative references' inside 'sections' -->
10202
+ <xsl:for-each select="* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
10203
+ <xsl:sort select="@displayorder" data-type="number"/>
10204
+
10205
+ <!-- process Section's title -->
10206
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
10207
+ <xsl:if test="$preceding-sibling_id != ''">
10208
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
10209
+ </xsl:if>
10210
+
10211
+ <xsl:choose>
10212
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
10213
+ <xsl:otherwise>
10214
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
10215
+ </xsl:otherwise>
10216
+ </xsl:choose>
10217
+
10218
+ </xsl:for-each>
10219
+ </xsl:copy>
10220
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
10221
+ <xsl:copy>
10222
+ <xsl:copy-of select="@*"/>
10223
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
10224
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
10225
+ <xsl:sort select="@displayorder" data-type="number"/>
10226
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
10227
+ </xsl:for-each>
10228
+ </xsl:copy>
9450
10229
  </xsl:template><xsl:template name="convertDate">
9451
10230
  <xsl:param name="date"/>
9452
10231
  <xsl:param name="format" select="'short'"/>
@@ -9560,9 +10339,6 @@
9560
10339
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
9561
10340
  </xsl:choose>
9562
10341
  </xsl:template><xsl:template name="addPDFUAmeta">
9563
- <xsl:variable name="lang">
9564
- <xsl:call-template name="getLang"/>
9565
- </xsl:variable>
9566
10342
  <pdf:catalog>
9567
10343
  <pdf:dictionary type="normal" key="ViewerPreferences">
9568
10344
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -9790,10 +10566,12 @@
9790
10566
  <xsl:param name="key"/>
9791
10567
  <xsl:param name="formatted">false</xsl:param>
9792
10568
  <xsl:param name="lang"/>
10569
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
9793
10570
 
9794
10571
  <xsl:variable name="curr_lang">
9795
10572
  <xsl:choose>
9796
10573
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
10574
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
9797
10575
  <xsl:otherwise>
9798
10576
  <xsl:call-template name="getLang"/>
9799
10577
  </xsl:otherwise>
@@ -9828,6 +10606,7 @@
9828
10606
  </xsl:otherwise>
9829
10607
  </xsl:choose>
9830
10608
  </xsl:when>
10609
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
9831
10610
  <xsl:otherwise>
9832
10611
  <xsl:variable name="key_">
9833
10612
  <xsl:call-template name="capitalize">
@@ -9897,53 +10676,153 @@
9897
10676
  <xsl:param name="first"/>
9898
10677
  <xsl:if test="$number != ''">
9899
10678
  <xsl:variable name="words">
9900
- <words>
9901
- <word cardinal="1">One-</word>
9902
- <word ordinal="1">First </word>
9903
- <word cardinal="2">Two-</word>
9904
- <word ordinal="2">Second </word>
9905
- <word cardinal="3">Three-</word>
9906
- <word ordinal="3">Third </word>
9907
- <word cardinal="4">Four-</word>
9908
- <word ordinal="4">Fourth </word>
9909
- <word cardinal="5">Five-</word>
9910
- <word ordinal="5">Fifth </word>
9911
- <word cardinal="6">Six-</word>
9912
- <word ordinal="6">Sixth </word>
9913
- <word cardinal="7">Seven-</word>
9914
- <word ordinal="7">Seventh </word>
9915
- <word cardinal="8">Eight-</word>
9916
- <word ordinal="8">Eighth </word>
9917
- <word cardinal="9">Nine-</word>
9918
- <word ordinal="9">Ninth </word>
9919
- <word ordinal="10">Tenth </word>
9920
- <word ordinal="11">Eleventh </word>
9921
- <word ordinal="12">Twelfth </word>
9922
- <word ordinal="13">Thirteenth </word>
9923
- <word ordinal="14">Fourteenth </word>
9924
- <word ordinal="15">Fifteenth </word>
9925
- <word ordinal="16">Sixteenth </word>
9926
- <word ordinal="17">Seventeenth </word>
9927
- <word ordinal="18">Eighteenth </word>
9928
- <word ordinal="19">Nineteenth </word>
9929
- <word cardinal="20">Twenty-</word>
9930
- <word ordinal="20">Twentieth </word>
9931
- <word cardinal="30">Thirty-</word>
9932
- <word ordinal="30">Thirtieth </word>
9933
- <word cardinal="40">Forty-</word>
9934
- <word ordinal="40">Fortieth </word>
9935
- <word cardinal="50">Fifty-</word>
9936
- <word ordinal="50">Fiftieth </word>
9937
- <word cardinal="60">Sixty-</word>
9938
- <word ordinal="60">Sixtieth </word>
9939
- <word cardinal="70">Seventy-</word>
9940
- <word ordinal="70">Seventieth </word>
9941
- <word cardinal="80">Eighty-</word>
9942
- <word ordinal="80">Eightieth </word>
9943
- <word cardinal="90">Ninety-</word>
9944
- <word ordinal="90">Ninetieth </word>
9945
- <word cardinal="100">Hundred-</word>
9946
- <word ordinal="100">Hundredth </word>
10679
+ <words>
10680
+ <xsl:choose>
10681
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
10682
+ <word cardinal="1">Une-</word>
10683
+ <word ordinal="1">Première </word>
10684
+ <word cardinal="2">Deux-</word>
10685
+ <word ordinal="2">Seconde </word>
10686
+ <word cardinal="3">Trois-</word>
10687
+ <word ordinal="3">Tierce </word>
10688
+ <word cardinal="4">Quatre-</word>
10689
+ <word ordinal="4">Quatrième </word>
10690
+ <word cardinal="5">Cinq-</word>
10691
+ <word ordinal="5">Cinquième </word>
10692
+ <word cardinal="6">Six-</word>
10693
+ <word ordinal="6">Sixième </word>
10694
+ <word cardinal="7">Sept-</word>
10695
+ <word ordinal="7">Septième </word>
10696
+ <word cardinal="8">Huit-</word>
10697
+ <word ordinal="8">Huitième </word>
10698
+ <word cardinal="9">Neuf-</word>
10699
+ <word ordinal="9">Neuvième </word>
10700
+ <word ordinal="10">Dixième </word>
10701
+ <word ordinal="11">Onzième </word>
10702
+ <word ordinal="12">Douzième </word>
10703
+ <word ordinal="13">Treizième </word>
10704
+ <word ordinal="14">Quatorzième </word>
10705
+ <word ordinal="15">Quinzième </word>
10706
+ <word ordinal="16">Seizième </word>
10707
+ <word ordinal="17">Dix-septième </word>
10708
+ <word ordinal="18">Dix-huitième </word>
10709
+ <word ordinal="19">Dix-neuvième </word>
10710
+ <word cardinal="20">Vingt-</word>
10711
+ <word ordinal="20">Vingtième </word>
10712
+ <word cardinal="30">Trente-</word>
10713
+ <word ordinal="30">Trentième </word>
10714
+ <word cardinal="40">Quarante-</word>
10715
+ <word ordinal="40">Quarantième </word>
10716
+ <word cardinal="50">Cinquante-</word>
10717
+ <word ordinal="50">Cinquantième </word>
10718
+ <word cardinal="60">Soixante-</word>
10719
+ <word ordinal="60">Soixantième </word>
10720
+ <word cardinal="70">Septante-</word>
10721
+ <word ordinal="70">Septantième </word>
10722
+ <word cardinal="80">Huitante-</word>
10723
+ <word ordinal="80">Huitantième </word>
10724
+ <word cardinal="90">Nonante-</word>
10725
+ <word ordinal="90">Nonantième </word>
10726
+ <word cardinal="100">Cent-</word>
10727
+ <word ordinal="100">Centième </word>
10728
+ </xsl:when>
10729
+ <xsl:when test="$lang = 'ru'">
10730
+ <word cardinal="1">Одна-</word>
10731
+ <word ordinal="1">Первое </word>
10732
+ <word cardinal="2">Две-</word>
10733
+ <word ordinal="2">Второе </word>
10734
+ <word cardinal="3">Три-</word>
10735
+ <word ordinal="3">Третье </word>
10736
+ <word cardinal="4">Четыре-</word>
10737
+ <word ordinal="4">Четвертое </word>
10738
+ <word cardinal="5">Пять-</word>
10739
+ <word ordinal="5">Пятое </word>
10740
+ <word cardinal="6">Шесть-</word>
10741
+ <word ordinal="6">Шестое </word>
10742
+ <word cardinal="7">Семь-</word>
10743
+ <word ordinal="7">Седьмое </word>
10744
+ <word cardinal="8">Восемь-</word>
10745
+ <word ordinal="8">Восьмое </word>
10746
+ <word cardinal="9">Девять-</word>
10747
+ <word ordinal="9">Девятое </word>
10748
+ <word ordinal="10">Десятое </word>
10749
+ <word ordinal="11">Одиннадцатое </word>
10750
+ <word ordinal="12">Двенадцатое </word>
10751
+ <word ordinal="13">Тринадцатое </word>
10752
+ <word ordinal="14">Четырнадцатое </word>
10753
+ <word ordinal="15">Пятнадцатое </word>
10754
+ <word ordinal="16">Шестнадцатое </word>
10755
+ <word ordinal="17">Семнадцатое </word>
10756
+ <word ordinal="18">Восемнадцатое </word>
10757
+ <word ordinal="19">Девятнадцатое </word>
10758
+ <word cardinal="20">Двадцать-</word>
10759
+ <word ordinal="20">Двадцатое </word>
10760
+ <word cardinal="30">Тридцать-</word>
10761
+ <word ordinal="30">Тридцатое </word>
10762
+ <word cardinal="40">Сорок-</word>
10763
+ <word ordinal="40">Сороковое </word>
10764
+ <word cardinal="50">Пятьдесят-</word>
10765
+ <word ordinal="50">Пятидесятое </word>
10766
+ <word cardinal="60">Шестьдесят-</word>
10767
+ <word ordinal="60">Шестидесятое </word>
10768
+ <word cardinal="70">Семьдесят-</word>
10769
+ <word ordinal="70">Семидесятое </word>
10770
+ <word cardinal="80">Восемьдесят-</word>
10771
+ <word ordinal="80">Восьмидесятое </word>
10772
+ <word cardinal="90">Девяносто-</word>
10773
+ <word ordinal="90">Девяностое </word>
10774
+ <word cardinal="100">Сто-</word>
10775
+ <word ordinal="100">Сотое </word>
10776
+ </xsl:when>
10777
+ <xsl:otherwise> <!-- default english -->
10778
+ <word cardinal="1">One-</word>
10779
+ <word ordinal="1">First </word>
10780
+ <word cardinal="2">Two-</word>
10781
+ <word ordinal="2">Second </word>
10782
+ <word cardinal="3">Three-</word>
10783
+ <word ordinal="3">Third </word>
10784
+ <word cardinal="4">Four-</word>
10785
+ <word ordinal="4">Fourth </word>
10786
+ <word cardinal="5">Five-</word>
10787
+ <word ordinal="5">Fifth </word>
10788
+ <word cardinal="6">Six-</word>
10789
+ <word ordinal="6">Sixth </word>
10790
+ <word cardinal="7">Seven-</word>
10791
+ <word ordinal="7">Seventh </word>
10792
+ <word cardinal="8">Eight-</word>
10793
+ <word ordinal="8">Eighth </word>
10794
+ <word cardinal="9">Nine-</word>
10795
+ <word ordinal="9">Ninth </word>
10796
+ <word ordinal="10">Tenth </word>
10797
+ <word ordinal="11">Eleventh </word>
10798
+ <word ordinal="12">Twelfth </word>
10799
+ <word ordinal="13">Thirteenth </word>
10800
+ <word ordinal="14">Fourteenth </word>
10801
+ <word ordinal="15">Fifteenth </word>
10802
+ <word ordinal="16">Sixteenth </word>
10803
+ <word ordinal="17">Seventeenth </word>
10804
+ <word ordinal="18">Eighteenth </word>
10805
+ <word ordinal="19">Nineteenth </word>
10806
+ <word cardinal="20">Twenty-</word>
10807
+ <word ordinal="20">Twentieth </word>
10808
+ <word cardinal="30">Thirty-</word>
10809
+ <word ordinal="30">Thirtieth </word>
10810
+ <word cardinal="40">Forty-</word>
10811
+ <word ordinal="40">Fortieth </word>
10812
+ <word cardinal="50">Fifty-</word>
10813
+ <word ordinal="50">Fiftieth </word>
10814
+ <word cardinal="60">Sixty-</word>
10815
+ <word ordinal="60">Sixtieth </word>
10816
+ <word cardinal="70">Seventy-</word>
10817
+ <word ordinal="70">Seventieth </word>
10818
+ <word cardinal="80">Eighty-</word>
10819
+ <word ordinal="80">Eightieth </word>
10820
+ <word cardinal="90">Ninety-</word>
10821
+ <word ordinal="90">Ninetieth </word>
10822
+ <word cardinal="100">Hundred-</word>
10823
+ <word ordinal="100">Hundredth </word>
10824
+ </xsl:otherwise>
10825
+ </xsl:choose>
9947
10826
  </words>
9948
10827
  </xsl:variable>
9949
10828
 
@@ -10017,4 +10896,18 @@
10017
10896
  <xsl:otherwise>_</xsl:otherwise>
10018
10897
  </xsl:choose>
10019
10898
  </xsl:attribute>
10899
+ </xsl:template><xsl:template name="substring-after-last">
10900
+ <xsl:param name="value"/>
10901
+ <xsl:param name="delimiter"/>
10902
+ <xsl:choose>
10903
+ <xsl:when test="contains($value, $delimiter)">
10904
+ <xsl:call-template name="substring-after-last">
10905
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
10906
+ <xsl:with-param name="delimiter" select="$delimiter"/>
10907
+ </xsl:call-template>
10908
+ </xsl:when>
10909
+ <xsl:otherwise>
10910
+ <xsl:value-of select="$value"/>
10911
+ </xsl:otherwise>
10912
+ </xsl:choose>
10020
10913
  </xsl:template></xsl:stylesheet>