metanorma-itu 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
-
5
- <xsl:param name="svg_images"/>
6
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
- <xsl:variable name="images" select="document($svg_images)"/>
8
- <xsl:param name="basepath"/>
9
4
 
10
5
 
11
6
 
@@ -15,11 +10,6 @@
15
10
 
16
11
  <xsl:variable name="debug">false</xsl:variable>
17
12
 
18
- <xsl:variable name="marginLeftRight1" select="20"/>
19
- <xsl:variable name="marginLeftRight2" select="20"/>
20
- <xsl:variable name="marginTop" select="20"/>
21
- <xsl:variable name="marginBottom" select="20"/>
22
-
23
13
  <!-- Rec. ITU-T G.650.1 (03/2018) -->
24
14
  <xsl:variable name="footerprefix" select="'Rec. '"/>
25
15
  <xsl:variable name="docname">
@@ -46,7 +36,7 @@
46
36
  <item level="1" id="Foreword" display="true">Foreword</item>
47
37
  <item id="term-script" display="false">3.2</item>
48
38
  -->
49
- <xsl:variable name="contents">
39
+ <xsl:variable name="contents_">
50
40
  <contents>
51
41
  <!-- <xsl:apply-templates select="/itu:itu-standard/itu:preface/node()" mode="contents"/> -->
52
42
  <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" mode="contents"/> <!-- @id = 'scope' -->
@@ -63,12 +53,12 @@
63
53
 
64
54
  <xsl:apply-templates select="//itu:table" mode="contents"/>
65
55
 
56
+ <xsl:call-template name="processTablesFigures_Contents">
57
+ <xsl:with-param name="always" select="$doctype = 'technical-report' or $doctype = 'technical-paper'"/>
58
+ </xsl:call-template>
66
59
  </contents>
67
60
  </xsl:variable>
68
-
69
- <xsl:variable name="lang">
70
- <xsl:call-template name="getLang"/>
71
- </xsl:variable>
61
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
72
62
 
73
63
  <xsl:variable name="doctypeTitle">
74
64
  <xsl:choose>
@@ -987,11 +977,11 @@
987
977
  <xsl:if test="$debug = 'true'">
988
978
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
989
979
  DEBUG
990
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
980
+ contents=<xsl:copy-of select="$contents"/>
991
981
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
992
982
  </xsl:if>
993
983
 
994
- <xsl:if test="xalan:nodeset($contents)//item[@display = 'true'] and $doctype != 'resolution' and $doctype != 'service-publication'">
984
+ <xsl:if test="$contents//item[@display = 'true'] and $doctype != 'resolution' and $doctype != 'service-publication'">
995
985
  <fo:block break-after="page"/>
996
986
  <fo:block-container>
997
987
  <fo:block role="TOC">
@@ -1006,7 +996,7 @@
1006
996
  </xsl:call-template>
1007
997
  </fo:block>
1008
998
 
1009
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
999
+ <xsl:for-each select="$contents//item[@display = 'true']">
1010
1000
  <fo:block role="TOCI">
1011
1001
  <xsl:if test="@level = 1">
1012
1002
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1059,72 +1049,42 @@
1059
1049
  </fo:block>
1060
1050
  </xsl:for-each>
1061
1051
 
1062
-
1063
- <xsl:if test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
1064
- <xsl:if test="//itu:table[@id and itu:name]">
1065
- <xsl:variable name="title-list-tables">
1066
- <xsl:call-template name="getTitle">
1067
- <xsl:with-param name="name" select="'title-list-tables'"/>
1068
- </xsl:call-template>
1069
- </xsl:variable>
1070
-
1071
- <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
1072
- <xsl:value-of select="$title-list-tables"/>
1073
- </fo:block>
1052
+
1053
+ <!-- List of Tables -->
1054
+ <xsl:if test="$contents//tables/table">
1055
+ <xsl:call-template name="insertListOf_Title">
1056
+ <xsl:with-param name="title" select="$title-list-tables"/>
1057
+ </xsl:call-template>
1074
1058
  <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
1075
1059
  <xsl:call-template name="getLocalizedString">
1076
1060
  <xsl:with-param name="key">Page.sg</xsl:with-param>
1077
1061
  </xsl:call-template>
1078
1062
  </fo:block>
1079
-
1080
1063
  <fo:block-container>
1081
- <xsl:for-each select="//itu:table[@id and itu:name]">
1082
- <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
1083
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{itu:name}">
1084
- <xsl:apply-templates select="itu:name" mode="contents"/>
1085
- <fo:inline keep-together.within-line="always">
1086
- <fo:leader leader-pattern="dots"/>
1087
- <fo:page-number-citation ref-id="{@id}"/>
1088
- </fo:inline>
1089
- </fo:basic-link>
1090
- </fo:block>
1064
+ <xsl:for-each select="$contents//tables/table">
1065
+ <xsl:call-template name="insertListOf_Item"/>
1091
1066
  </xsl:for-each>
1092
- </fo:block-container>
1067
+ </fo:block-container>
1093
1068
  </xsl:if>
1094
-
1095
- <xsl:if test="//itu:figure[@id and itu:name]">
1096
- <xsl:variable name="title-list-figures">
1097
- <xsl:call-template name="getTitle">
1098
- <xsl:with-param name="name" select="'title-list-figures'"/>
1099
- </xsl:call-template>
1100
- </xsl:variable>
1101
-
1102
-
1103
- <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
1104
- <xsl:value-of select="$title-list-figures"/>
1105
- </fo:block>
1069
+
1070
+ <!-- List of Figures -->
1071
+ <xsl:if test="$contents//figures/figure">
1072
+ <xsl:call-template name="insertListOf_Title">
1073
+ <xsl:with-param name="title" select="$title-list-figures"/>
1074
+ </xsl:call-template>
1106
1075
  <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
1107
1076
  <xsl:call-template name="getLocalizedString">
1108
1077
  <xsl:with-param name="key">Page.sg</xsl:with-param>
1109
1078
  </xsl:call-template>
1110
1079
  </fo:block>
1111
-
1112
1080
  <fo:block-container>
1113
- <xsl:for-each select="//itu:figure[@id and itu:name]">
1114
- <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
1115
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{itu:name}">
1116
- <xsl:apply-templates select="itu:name" mode="contents"/>
1117
- <fo:inline keep-together.within-line="always">
1118
- <fo:leader leader-pattern="dots"/>
1119
- <fo:page-number-citation ref-id="{@id}"/>
1120
- </fo:inline>
1121
- </fo:basic-link>
1122
- </fo:block>
1081
+ <xsl:for-each select="$contents//figures/figure">
1082
+ <xsl:call-template name="insertListOf_Item"/>
1123
1083
  </xsl:for-each>
1124
- </fo:block-container>
1084
+ </fo:block-container>
1125
1085
  </xsl:if>
1126
- </xsl:if>
1127
- </fo:block>
1086
+
1087
+ </fo:block>
1128
1088
  </fo:block-container>
1129
1089
  </xsl:if>
1130
1090
 
@@ -1222,6 +1182,28 @@
1222
1182
  </fo:root>
1223
1183
  </xsl:template>
1224
1184
 
1185
+ <xsl:template name="insertListOf_Title">
1186
+ <xsl:param name="title"/>
1187
+ <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
1188
+ <xsl:value-of select="$title"/>
1189
+ </fo:block>
1190
+ </xsl:template>
1191
+
1192
+ <xsl:template name="insertListOf_Item">
1193
+ <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
1194
+ <fo:basic-link internal-destination="{@id}">
1195
+ <xsl:call-template name="setAltText">
1196
+ <xsl:with-param name="value" select="@alt-text"/>
1197
+ </xsl:call-template>
1198
+ <xsl:apply-templates select="." mode="contents"/>
1199
+ <fo:inline keep-together.within-line="always">
1200
+ <fo:leader leader-pattern="dots"/>
1201
+ <fo:page-number-citation ref-id="{@id}"/>
1202
+ </fo:inline>
1203
+ </fo:basic-link>
1204
+ </fo:block>
1205
+ </xsl:template>
1206
+
1225
1207
  <xsl:template match="node()">
1226
1208
  <xsl:apply-templates/>
1227
1209
  </xsl:template>
@@ -1296,46 +1278,6 @@
1296
1278
  <xsl:template match="itu:references" mode="contents">
1297
1279
  <xsl:apply-templates mode="contents"/>
1298
1280
  </xsl:template>
1299
-
1300
-
1301
-
1302
- <xsl:template name="getListItemFormat">
1303
- <xsl:variable name="level">
1304
- <xsl:variable name="numtmp">
1305
- <xsl:number level="multiple" count="itu:ol"/>
1306
- </xsl:variable>
1307
- <!-- level example: 1.1
1308
- calculate counts of '.' in numtmp value - level of nested lists
1309
- -->
1310
- <xsl:value-of select="string-length($numtmp) - string-length(translate($numtmp, '.', '')) + 1"/>
1311
- </xsl:variable>
1312
- <xsl:choose>
1313
- <xsl:when test="local-name(..) = 'ul' and itu:ul and local-name(../../..) != 'ul'">•</xsl:when> <!-- dash &#x2014; -->
1314
- <xsl:when test="local-name(..) = 'ul'">–</xsl:when> <!-- dash &#x2014; -->
1315
- <xsl:otherwise>
1316
- <!-- for Ordered Lists -->
1317
- <xsl:choose>
1318
- <xsl:when test="../@type = 'arabic'">
1319
- <xsl:number format="a)" lang="en"/>
1320
- </xsl:when>
1321
- <xsl:when test="../@class = 'steps'">
1322
- <xsl:number format="1)"/>
1323
- </xsl:when>
1324
- <xsl:when test="$level = 1">
1325
- <xsl:number format="a)" lang="en"/>
1326
- </xsl:when>
1327
- <xsl:when test="$level = 2">
1328
- <xsl:number format="i)"/>
1329
- </xsl:when>
1330
- <xsl:otherwise>
1331
- <!-- <xsl:number format="1.)"/> -->
1332
- <!-- https://github.com/metanorma/mn-native-pdf/issues/156 -->
1333
- <xsl:number format="1)"/>
1334
- </xsl:otherwise>
1335
- </xsl:choose>
1336
- </xsl:otherwise>
1337
- </xsl:choose>
1338
- </xsl:template>
1339
1281
 
1340
1282
 
1341
1283
  <!-- ============================= -->
@@ -1622,7 +1564,7 @@
1622
1564
  </xsl:template>
1623
1565
 
1624
1566
 
1625
- <xsl:template match="itu:preferred">
1567
+ <xsl:template match="itu:preferred" priority="2">
1626
1568
  <!-- DEBUG need -->
1627
1569
  <xsl:variable name="level">
1628
1570
  <xsl:call-template name="getLevel"/>
@@ -1768,7 +1710,7 @@
1768
1710
  <xsl:template match="itu:docidentifier"/>
1769
1711
 
1770
1712
 
1771
- <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol" mode="ul_ol">
1713
+ <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol" mode="list" priority="2">
1772
1714
  <xsl:if test="preceding-sibling::*[1][local-name() = 'title'] and $doctype != 'service-publication'">
1773
1715
  <fo:block padding-top="-8pt" font-size="1pt"> </fo:block>
1774
1716
  </xsl:if>
@@ -1804,7 +1746,7 @@
1804
1746
  </fo:block>
1805
1747
  </xsl:template>
1806
1748
 
1807
- <xsl:template match="itu:li">
1749
+ <xsl:template match="itu:li" priority="2">
1808
1750
  <xsl:choose>
1809
1751
  <xsl:when test="$doctype = 'service-publication'">
1810
1752
  <fo:block id="{@id}">
@@ -1838,24 +1780,15 @@
1838
1780
  <xsl:attribute name="{$attribute-margin}">18mm</xsl:attribute>
1839
1781
  </xsl:if>
1840
1782
  <xsl:if test="local-name(..) = 'ul'">
1841
- <xsl:attribute name="{$attribute-margin}">7mm</xsl:attribute><!-- 15mm -->
1783
+ <xsl:attribute name="{$attribute-margin}">7mm</xsl:attribute>
1842
1784
  <xsl:if test="ancestor::itu:table">
1843
1785
  <xsl:attribute name="{$attribute-margin}">4.5mm</xsl:attribute>
1844
1786
  </xsl:if>
1845
- <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1846
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
1847
- </xsl:if> -->
1848
1787
  </xsl:if>
1849
- <!-- <xsl:if test="$doctype = 'service-publication'">
1850
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1851
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1852
- </xsl:if> -->
1788
+
1853
1789
  <fo:block-container margin-left="0mm" margin-right="0mm">
1854
1790
  <fo:block>
1855
- <!-- <xsl:if test="$doctype = 'service-publication'">
1856
- <xsl:attribute name="start-indent">7mm</xsl:attribute>
1857
- <xsl:attribute name="text-indent">7mm</xsl:attribute>
1858
- </xsl:if> -->
1791
+
1859
1792
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
1860
1793
  <xsl:apply-templates select="./itu:note"/>
1861
1794
  </fo:block>
@@ -1921,27 +1854,7 @@
1921
1854
  <xsl:apply-templates />
1922
1855
  </xsl:template> -->
1923
1856
 
1924
-
1925
- <xsl:template match="itu:formula/itu:stem">
1926
- <fo:table table-layout="fixed" width="100%">
1927
- <fo:table-column column-width="95%"/>
1928
- <fo:table-column column-width="5%"/>
1929
- <fo:table-body>
1930
- <fo:table-row>
1931
- <fo:table-cell display-align="center">
1932
- <fo:block text-align="center" margin-left="0mm">
1933
- <xsl:apply-templates/>
1934
- </fo:block>
1935
- </fo:table-cell>
1936
- <fo:table-cell display-align="center">
1937
- <fo:block text-align="right" margin-left="0mm">
1938
- <xsl:apply-templates select="../itu:name" mode="formula_number"/>
1939
- </fo:block>
1940
- </fo:table-cell>
1941
- </fo:table-row>
1942
- </fo:table-body>
1943
- </fo:table>
1944
- </xsl:template>
1857
+
1945
1858
 
1946
1859
 
1947
1860
  <xsl:template name="insertHeaderFooter">
@@ -2147,11 +2060,21 @@
2147
2060
  </xsl:if>
2148
2061
  </xsl:template>
2149
2062
 
2150
- <xsl:variable name="pageWidth_">
2063
+ <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">
2064
+ <xsl:call-template name="getLang"/>
2065
+ </xsl:variable><xsl:variable name="pageWidth_">
2151
2066
  210
2152
2067
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
2153
2068
  297
2154
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
2069
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
2070
+ 20
2071
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
2072
+ 20
2073
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
2074
+ 20
2075
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
2076
+ 20
2077
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
2155
2078
 
2156
2079
  <title-edition lang="en">
2157
2080
 
@@ -2163,6 +2086,10 @@
2163
2086
  <xsl:text>Édition </xsl:text>
2164
2087
  </title-edition>
2165
2088
 
2089
+ <title-edition lang="ru">
2090
+ <xsl:text>Издание </xsl:text>
2091
+ </title-edition>
2092
+
2166
2093
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
2167
2094
  <title-toc lang="en">
2168
2095
 
@@ -2177,7 +2104,7 @@
2177
2104
  <xsl:text>Contents</xsl:text>
2178
2105
 
2179
2106
  </title-toc>
2180
-
2107
+
2181
2108
  <title-descriptors lang="en">Descriptors</title-descriptors>
2182
2109
 
2183
2110
  <title-part lang="en">
@@ -2189,7 +2116,11 @@
2189
2116
 
2190
2117
 
2191
2118
 
2192
- </title-part>
2119
+ </title-part>
2120
+ <title-part lang="ru">
2121
+
2122
+
2123
+ </title-part>
2193
2124
  <title-part lang="zh">第 # 部分:</title-part>
2194
2125
 
2195
2126
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -2205,13 +2136,38 @@
2205
2136
 
2206
2137
  <title-summary lang="en">Summary</title-summary>
2207
2138
 
2139
+ <title-continued lang="ru">(продолжение)</title-continued>
2208
2140
  <title-continued lang="en">(continued)</title-continued>
2209
2141
  <title-continued lang="fr">(continué)</title-continued>
2210
2142
 
2211
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
2143
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
2144
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
2145
+ <xsl:value-of select="$toc_table_title"/>
2146
+ <xsl:if test="normalize-space($toc_table_title) = ''">
2147
+ <xsl:call-template name="getTitle">
2148
+ <xsl:with-param name="name" select="'title-list-tables'"/>
2149
+ </xsl:call-template>
2150
+ </xsl:if>
2151
+ </xsl:variable><xsl:variable name="title-list-figures">
2152
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
2153
+ <xsl:value-of select="$toc_figure_title"/>
2154
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
2155
+ <xsl:call-template name="getTitle">
2156
+ <xsl:with-param name="name" select="'title-list-figures'"/>
2157
+ </xsl:call-template>
2158
+ </xsl:if>
2159
+ </xsl:variable><xsl:variable name="title-list-recommendations">
2160
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
2161
+ <xsl:value-of select="$toc_requirement_title"/>
2162
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
2163
+ <xsl:call-template name="getTitle">
2164
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
2165
+ </xsl:call-template>
2166
+ </xsl:if>
2167
+ </xsl:variable><xsl:variable name="bibdata">
2212
2168
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2213
2169
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2214
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2170
+ </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">
2215
2171
  <xsl:param name="name"/>
2216
2172
  <xsl:param name="lang"/>
2217
2173
  <xsl:variable name="lang_">
@@ -2234,7 +2190,7 @@
2234
2190
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2235
2191
  </xsl:otherwise>
2236
2192
  </xsl:choose>
2237
- </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">
2193
+ </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">
2238
2194
 
2239
2195
 
2240
2196
 
@@ -2398,13 +2354,14 @@
2398
2354
 
2399
2355
 
2400
2356
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2401
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2402
2357
 
2403
2358
 
2404
2359
 
2405
2360
 
2406
2361
 
2407
2362
 
2363
+
2364
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2408
2365
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2409
2366
 
2410
2367
 
@@ -2769,7 +2726,8 @@
2769
2726
 
2770
2727
 
2771
2728
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2772
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
2729
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
2730
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
2773
2731
 
2774
2732
 
2775
2733
 
@@ -2777,15 +2735,11 @@
2777
2735
 
2778
2736
 
2779
2737
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2780
- <xsl:attribute name="margin-left">12mm</xsl:attribute>
2781
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
2782
2738
 
2783
2739
 
2784
2740
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2741
+ <xsl:attribute name="text-align">right</xsl:attribute>
2785
2742
 
2786
-
2787
- <xsl:attribute name="text-align">right</xsl:attribute>
2788
-
2789
2743
 
2790
2744
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
2791
2745
 
@@ -2805,6 +2759,9 @@
2805
2759
 
2806
2760
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2807
2761
 
2762
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
2763
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2764
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2808
2765
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
2809
2766
 
2810
2767
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -2835,9 +2792,39 @@
2835
2792
 
2836
2793
 
2837
2794
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
2795
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2796
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2797
+
2798
+
2799
+
2800
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2801
+
2802
+
2803
+
2804
+
2805
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
2806
+ <xsl:attribute name="text-align">center</xsl:attribute>
2807
+
2808
+
2809
+
2810
+
2811
+
2812
+
2813
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2814
+
2815
+
2816
+
2817
+
2818
+
2819
+
2820
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2821
+ <xsl:attribute name="text-align">right</xsl:attribute>
2822
+
2823
+
2824
+
2825
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2826
+
2838
2827
 
2839
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
2840
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2841
2828
 
2842
2829
  </xsl:attribute-set><xsl:attribute-set name="image-style">
2843
2830
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -2876,6 +2863,18 @@
2876
2863
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2877
2864
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2878
2865
 
2866
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
2867
+
2868
+
2869
+
2870
+
2871
+
2872
+
2873
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
2874
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2875
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2876
+
2877
+
2879
2878
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
2880
2879
 
2881
2880
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -2892,13 +2891,19 @@
2892
2891
  </xsl:attribute-set><xsl:variable name="color-added-text">
2893
2892
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2894
2893
  </xsl:variable><xsl:attribute-set name="add-style">
2895
- <xsl:attribute name="color">red</xsl:attribute>
2896
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2897
- <!-- <xsl:attribute name="color">black</xsl:attribute>
2898
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2899
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
2900
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2901
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2894
+
2895
+ <xsl:attribute name="color">red</xsl:attribute>
2896
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2897
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2898
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2899
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2900
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2901
+
2902
+ </xsl:attribute-set><xsl:variable name="add-style">
2903
+ <add-style xsl:use-attribute-sets="add-style"/>
2904
+ </xsl:variable><xsl:template name="append_add-style">
2905
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2906
+ </xsl:template><xsl:variable name="color-deleted-text">
2902
2907
  <xsl:text>red</xsl:text>
2903
2908
  </xsl:variable><xsl:attribute-set name="del-style">
2904
2909
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -2911,6 +2916,33 @@
2911
2916
 
2912
2917
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2913
2918
 
2919
+
2920
+
2921
+
2922
+
2923
+
2924
+
2925
+
2926
+
2927
+
2928
+
2929
+
2930
+
2931
+
2932
+
2933
+
2934
+
2935
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2936
+
2937
+
2938
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
2939
+
2940
+
2941
+
2942
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
2943
+
2944
+
2945
+
2914
2946
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2915
2947
  <xsl:attribute name="line-height">135%</xsl:attribute>
2916
2948
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -3192,15 +3224,148 @@
3192
3224
 
3193
3225
 
3194
3226
 
3227
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
3228
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3229
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
3230
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3231
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
3232
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3233
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
3234
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3235
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
3236
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3237
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
3238
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3239
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
3240
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3241
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
3242
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3243
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
3244
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3245
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
3246
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3247
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
3248
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3249
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
3250
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3251
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
3252
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3253
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
3254
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3255
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
3256
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3257
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
3258
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3259
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
3260
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3261
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
3262
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3263
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
3264
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3265
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
3266
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3267
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
3268
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3269
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
3270
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3271
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
3272
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3273
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
3274
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3275
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
3276
+ <xsl:attribute name="color">#e36209</xsl:attribute>
3277
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
3278
+ <xsl:attribute name="color">#e36209</xsl:attribute>
3279
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
3280
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3281
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
3282
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3283
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
3284
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3285
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
3286
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3287
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
3288
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3289
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
3290
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3291
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
3292
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3293
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
3294
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3295
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
3296
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3297
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3298
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
3299
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
3300
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
3301
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3302
+ <xsl:attribute name="font-style">italic</xsl:attribute>
3303
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
3304
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3305
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3306
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
3307
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3308
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
3309
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
3310
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
3311
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
3312
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
3313
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
3314
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
3315
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
3316
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
3317
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
3318
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
3319
+ <xsl:attribute name="role">H1</xsl:attribute>
3320
+
3321
+
3322
+
3323
+
3324
+
3325
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
3326
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3327
+
3328
+
3329
+
3330
+
3331
+
3195
3332
  </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">
3333
+ <xsl:variable name="nodes_preface_">
3334
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
3335
+ <node id="{@id}"/>
3336
+ </xsl:for-each>
3337
+ </xsl:variable>
3338
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3339
+
3196
3340
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3197
3341
  <xsl:sort select="@displayorder" data-type="number"/>
3342
+
3343
+ <!-- process Section's title -->
3344
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3345
+ <xsl:if test="$preceding-sibling_id != ''">
3346
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3347
+ </xsl:if>
3348
+
3198
3349
  <xsl:apply-templates select="." mode="contents"/>
3199
3350
  </xsl:for-each>
3200
3351
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
3201
3352
 
3353
+ <xsl:variable name="nodes_sections_">
3354
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
3355
+ <node id="{@id}"/>
3356
+ </xsl:for-each>
3357
+ </xsl:variable>
3358
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
3359
+
3202
3360
  <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']]">
3203
3361
  <xsl:sort select="@displayorder" data-type="number"/>
3362
+
3363
+ <!-- process Section's title -->
3364
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3365
+ <xsl:if test="$preceding-sibling_id != ''">
3366
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3367
+ </xsl:if>
3368
+
3204
3369
  <xsl:apply-templates select="." mode="contents"/>
3205
3370
  </xsl:for-each>
3206
3371
 
@@ -3213,6 +3378,30 @@
3213
3378
  <xsl:sort select="@displayorder" data-type="number"/>
3214
3379
  <xsl:apply-templates select="." mode="contents"/>
3215
3380
  </xsl:for-each>
3381
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
3382
+ <xsl:param name="always"/>
3383
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3384
+ <xsl:call-template name="processTables_Contents"/>
3385
+ </xsl:if>
3386
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3387
+ <xsl:call-template name="processFigures_Contents"/>
3388
+ </xsl:if>
3389
+ </xsl:template><xsl:template name="processTables_Contents">
3390
+ <tables>
3391
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3392
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3393
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3394
+ </table>
3395
+ </xsl:for-each>
3396
+ </tables>
3397
+ </xsl:template><xsl:template name="processFigures_Contents">
3398
+ <figures>
3399
+ <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) != '']">
3400
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3401
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3402
+ </figure>
3403
+ </xsl:for-each>
3404
+ </figures>
3216
3405
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3217
3406
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3218
3407
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -3287,9 +3476,12 @@
3287
3476
 
3288
3477
 
3289
3478
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
3479
+ <xsl:param name="margin"/>
3290
3480
 
3291
3481
  <!-- process in the template 'paragraph' -->
3292
- <xsl:call-template name="paragraph"/>
3482
+ <xsl:call-template name="paragraph">
3483
+ <xsl:with-param name="margin" select="$margin"/>
3484
+ </xsl:call-template>
3293
3485
 
3294
3486
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
3295
3487
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -3301,9 +3493,12 @@
3301
3493
  <xsl:call-template name="title"/>
3302
3494
 
3303
3495
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
3496
+ <xsl:param name="margin"/>
3304
3497
 
3305
3498
  <!-- process in the template 'paragraph' -->
3306
- <xsl:call-template name="paragraph"/>
3499
+ <xsl:call-template name="paragraph">
3500
+ <xsl:with-param name="margin" select="$margin"/>
3501
+ </xsl:call-template>
3307
3502
 
3308
3503
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3309
3504
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -3346,7 +3541,7 @@
3346
3541
  </xsl:call-template>
3347
3542
  </xsl:if>
3348
3543
  </xsl:variable>
3349
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3544
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3350
3545
 
3351
3546
 
3352
3547
  <xsl:variable name="margin-side">
@@ -3614,7 +3809,7 @@
3614
3809
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3615
3810
  <!-- 2009 thinspace -->
3616
3811
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3617
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3812
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3618
3813
  </xsl:call-template>
3619
3814
  </xsl:variable>
3620
3815
  <xsl:variable name="max_length">
@@ -3655,8 +3850,7 @@
3655
3850
  </xsl:call-template>
3656
3851
  </xsl:if>
3657
3852
  </xsl:template><xsl:template match="text()" mode="td_text">
3658
- <xsl:variable name="zero-space">​</xsl:variable>
3659
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3853
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3660
3854
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3661
3855
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3662
3856
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -4047,37 +4241,7 @@
4047
4241
 
4048
4242
  <!-- list of footnotes to calculate actual footnotes number -->
4049
4243
  <xsl:variable name="p_fn_">
4050
- <xsl:choose>
4051
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4052
- <fn gen_id="{generate-id(.)}">
4053
- <xsl:copy-of select="@*"/>
4054
- <xsl:copy-of select="node()"/>
4055
- </fn>
4056
- </xsl:when>
4057
- <xsl:otherwise>
4058
- <!-- itetation for:
4059
- footnotes in bibdata/title
4060
- footnotes in bibliography
4061
- footnotes in document's body (except table's head/body/foot and figure text)
4062
- -->
4063
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4064
- <fn gen_id="{generate-id(.)}">
4065
- <xsl:copy-of select="@*"/>
4066
- <xsl:copy-of select="node()"/>
4067
- </fn>
4068
- </xsl:for-each>
4069
- <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']/*">
4070
- <xsl:sort select="@displayorder" data-type="number"/>
4071
- <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])]">
4072
- <!-- copy unique fn -->
4073
- <fn gen_id="{generate-id(.)}">
4074
- <xsl:copy-of select="@*"/>
4075
- <xsl:copy-of select="node()"/>
4076
- </fn>
4077
- </xsl:for-each>
4078
- </xsl:for-each>
4079
- </xsl:otherwise>
4080
- </xsl:choose>
4244
+ <xsl:call-template name="get_fn_list"/>
4081
4245
  </xsl:variable>
4082
4246
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4083
4247
 
@@ -4142,6 +4306,38 @@
4142
4306
  <xsl:copy-of select="$footnote_inline"/>
4143
4307
  </xsl:otherwise>
4144
4308
  </xsl:choose>
4309
+ </xsl:template><xsl:template name="get_fn_list">
4310
+ <xsl:choose>
4311
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4312
+ <fn gen_id="{generate-id(.)}">
4313
+ <xsl:copy-of select="@*"/>
4314
+ <xsl:copy-of select="node()"/>
4315
+ </fn>
4316
+ </xsl:when>
4317
+ <xsl:otherwise>
4318
+ <!-- itetation for:
4319
+ footnotes in bibdata/title
4320
+ footnotes in bibliography
4321
+ footnotes in document's body (except table's head/body/foot and figure text)
4322
+ -->
4323
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4324
+ <fn gen_id="{generate-id(.)}">
4325
+ <xsl:copy-of select="@*"/>
4326
+ <xsl:copy-of select="node()"/>
4327
+ </fn>
4328
+ </xsl:for-each>
4329
+ <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']/*">
4330
+ <xsl:sort select="@displayorder" data-type="number"/>
4331
+ <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])]">
4332
+ <!-- copy unique fn -->
4333
+ <fn gen_id="{generate-id(.)}">
4334
+ <xsl:copy-of select="@*"/>
4335
+ <xsl:copy-of select="node()"/>
4336
+ </fn>
4337
+ </xsl:for-each>
4338
+ </xsl:for-each>
4339
+ </xsl:otherwise>
4340
+ </xsl:choose>
4145
4341
  </xsl:template><xsl:template name="table_fn_display">
4146
4342
  <xsl:variable name="references">
4147
4343
 
@@ -4319,7 +4515,7 @@
4319
4515
  </fo:inline>
4320
4516
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4321
4517
  <fo:inline><xsl:value-of select="."/></fo:inline>
4322
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4518
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4323
4519
  <fo:inline>
4324
4520
  <xsl:apply-templates/>
4325
4521
  </fo:inline>
@@ -4698,20 +4894,44 @@
4698
4894
  <fo:inline text-decoration="underline">
4699
4895
  <xsl:apply-templates/>
4700
4896
  </fo:inline>
4701
- </xsl:template><xsl:template match="*[local-name()='add']">
4897
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
4702
4898
  <xsl:param name="skip">true</xsl:param>
4899
+ <xsl:param name="block">false</xsl:param>
4900
+ <xsl:param name="type"/>
4901
+ <xsl:param name="text-align"/>
4703
4902
  <xsl:choose>
4704
4903
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4705
4904
  <xsl:choose>
4706
- <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>
4905
+ <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>
4707
4906
  <xsl:otherwise>
4708
- <fo:inline>
4907
+ <xsl:variable name="tag">
4709
4908
  <xsl:call-template name="insertTag">
4710
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4909
+ <xsl:with-param name="type">
4910
+ <xsl:choose>
4911
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4912
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4913
+ </xsl:choose>
4914
+ </xsl:with-param>
4711
4915
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4712
4916
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4713
4917
  </xsl:call-template>
4714
- </fo:inline>
4918
+ </xsl:variable>
4919
+ <xsl:choose>
4920
+ <xsl:when test="$block = 'false'">
4921
+ <fo:inline>
4922
+ <xsl:copy-of select="$tag"/>
4923
+ </fo:inline>
4924
+ </xsl:when>
4925
+ <xsl:otherwise>
4926
+ <fo:block> <!-- for around figures -->
4927
+ <xsl:if test="$text-align != ''">
4928
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
4929
+ </xsl:if>
4930
+ <xsl:copy-of select="$tag"/>
4931
+ </fo:block>
4932
+ </xsl:otherwise>
4933
+ </xsl:choose>
4934
+
4715
4935
  </xsl:otherwise>
4716
4936
  </xsl:choose>
4717
4937
  </xsl:when>
@@ -5070,17 +5290,21 @@
5070
5290
  </xsl:apply-templates>
5071
5291
  </xsl:template><xsl:template name="getLang">
5072
5292
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5073
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5074
5293
  <xsl:variable name="language">
5075
5294
  <xsl:choose>
5076
5295
  <xsl:when test="$language_current != ''">
5077
5296
  <xsl:value-of select="$language_current"/>
5078
5297
  </xsl:when>
5079
- <xsl:when test="$language_current_2 != ''">
5080
- <xsl:value-of select="$language_current_2"/>
5081
- </xsl:when>
5082
5298
  <xsl:otherwise>
5083
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5299
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5300
+ <xsl:choose>
5301
+ <xsl:when test="$language_current_2 != ''">
5302
+ <xsl:value-of select="$language_current_2"/>
5303
+ </xsl:when>
5304
+ <xsl:otherwise>
5305
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5306
+ </xsl:otherwise>
5307
+ </xsl:choose>
5084
5308
  </xsl:otherwise>
5085
5309
  </xsl:choose>
5086
5310
  </xsl:variable>
@@ -5283,6 +5507,9 @@
5283
5507
  </fo:inline>
5284
5508
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5285
5509
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5510
+ <xsl:if test="parent::*[local-name() = 'add']">
5511
+ <xsl:call-template name="append_add-style"/>
5512
+ </xsl:if>
5286
5513
  <xsl:apply-templates/>
5287
5514
  </fo:basic-link>
5288
5515
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -5297,8 +5524,8 @@
5297
5524
 
5298
5525
  </xsl:if>
5299
5526
  <fo:block-container margin-left="0mm">
5300
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
5301
- <xsl:apply-templates/>
5527
+ <fo:block id="{@id}">
5528
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
5302
5529
  </fo:block>
5303
5530
  </fo:block-container>
5304
5531
  </fo:block-container>
@@ -5310,23 +5537,56 @@
5310
5537
  <fo:inline>
5311
5538
  <xsl:apply-templates/>
5312
5539
  </fo:inline>
5313
- </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 -->
5540
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
5314
5541
  <xsl:if test="normalize-space() != ''">
5315
5542
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
5316
5543
  </xsl:if>
5317
- </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
5318
-
5319
- <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5544
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
5545
+ <fo:block xsl:use-attribute-sets="formula-style">
5320
5546
 
5321
5547
 
5322
-
5323
-
5324
-
5325
-
5326
-
5327
-
5328
5548
 
5329
-
5549
+ <fo:table table-layout="fixed" width="100%">
5550
+ <fo:table-column column-width="95%"/>
5551
+ <fo:table-column column-width="5%"/>
5552
+ <fo:table-body>
5553
+ <fo:table-row>
5554
+ <fo:table-cell display-align="center">
5555
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5556
+
5557
+
5558
+
5559
+ <xsl:apply-templates/>
5560
+ </fo:block>
5561
+ </fo:table-cell>
5562
+ <fo:table-cell display-align="center">
5563
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
5564
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
5565
+ </fo:block>
5566
+ </fo:table-cell>
5567
+ </fo:table-row>
5568
+ </fo:table-body>
5569
+ </fo:table>
5570
+ </fo:block>
5571
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
5572
+ <fo:block xsl:use-attribute-sets="formula-style">
5573
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5574
+ <xsl:apply-templates/>
5575
+ </fo:block>
5576
+ </fo:block>
5577
+ </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
5578
+
5579
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5580
+
5581
+
5582
+
5583
+
5584
+
5585
+
5586
+
5587
+
5588
+
5589
+
5330
5590
 
5331
5591
  <fo:block-container margin-left="0mm">
5332
5592
 
@@ -5351,6 +5611,13 @@
5351
5611
 
5352
5612
 
5353
5613
 
5614
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5615
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5616
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5617
+ <xsl:call-template name="append_add-style"/>
5618
+ </xsl:if>
5619
+
5620
+
5354
5621
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
5355
5622
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
5356
5623
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -5389,6 +5656,12 @@
5389
5656
 
5390
5657
 
5391
5658
 
5659
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5660
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5661
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5662
+ <xsl:call-template name="append_add-style"/>
5663
+ </xsl:if>
5664
+
5392
5665
  <xsl:apply-templates select="*[local-name() = 'name']"/>
5393
5666
 
5394
5667
  </fo:inline>
@@ -5442,6 +5715,7 @@
5442
5715
  </fo:block>
5443
5716
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5444
5717
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5718
+
5445
5719
 
5446
5720
 
5447
5721
 
@@ -5878,7 +6152,11 @@
5878
6152
  <xsl:value-of select="."/>
5879
6153
  </xsl:template><xsl:template match="node()" mode="contents">
5880
6154
  <xsl:apply-templates mode="contents"/>
5881
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
6155
+ </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">
6156
+ <xsl:call-template name="contents_section-title"/>
6157
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
6158
+ <xsl:call-template name="contents_section-title"/>
6159
+ </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">
5882
6160
  <xsl:variable name="level">
5883
6161
  <xsl:call-template name="getLevel">
5884
6162
  <xsl:with-param name="depth" select="@depth"/>
@@ -5947,13 +6225,14 @@
5947
6225
  <xsl:apply-templates mode="bookmarks"/>
5948
6226
  </xsl:template><xsl:template name="addBookmarks">
5949
6227
  <xsl:param name="contents"/>
5950
- <xsl:if test="xalan:nodeset($contents)//item">
6228
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6229
+ <xsl:if test="$contents_nodes//item">
5951
6230
  <fo:bookmark-tree>
5952
6231
  <xsl:choose>
5953
- <xsl:when test="xalan:nodeset($contents)/doc">
6232
+ <xsl:when test="$contents_nodes/doc">
5954
6233
  <xsl:choose>
5955
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5956
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6234
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
6235
+ <xsl:for-each select="$contents_nodes/doc">
5957
6236
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5958
6237
  <xsl:if test="@bundle = 'true'">
5959
6238
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -6004,7 +6283,7 @@
6004
6283
  </xsl:for-each>
6005
6284
  </xsl:when>
6006
6285
  <xsl:otherwise>
6007
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6286
+ <xsl:for-each select="$contents_nodes/doc">
6008
6287
 
6009
6288
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
6010
6289
 
@@ -6022,25 +6301,36 @@
6022
6301
  </xsl:choose>
6023
6302
  </xsl:when>
6024
6303
  <xsl:otherwise>
6025
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
6304
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
6305
+
6306
+ <xsl:call-template name="insertFigureBookmarks">
6307
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6308
+ </xsl:call-template>
6309
+
6310
+ <xsl:call-template name="insertTableBookmarks">
6311
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6312
+ <xsl:with-param name="lang" select="@lang"/>
6313
+ </xsl:call-template>
6314
+
6026
6315
  </xsl:otherwise>
6027
6316
  </xsl:choose>
6028
6317
 
6318
+
6029
6319
 
6030
6320
 
6031
6321
 
6032
6322
 
6033
-
6034
-
6323
+
6035
6324
 
6036
6325
  </fo:bookmark-tree>
6037
6326
  </xsl:if>
6038
6327
  </xsl:template><xsl:template name="insertFigureBookmarks">
6039
6328
  <xsl:param name="contents"/>
6040
- <xsl:if test="xalan:nodeset($contents)/figure">
6041
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
6329
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6330
+ <xsl:if test="$contents_nodes/figure">
6331
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
6042
6332
  <fo:bookmark-title>Figures</fo:bookmark-title>
6043
- <xsl:for-each select="xalan:nodeset($contents)/figure">
6333
+ <xsl:for-each select="$contents_nodes/figure">
6044
6334
  <fo:bookmark internal-destination="{@id}">
6045
6335
  <fo:bookmark-title>
6046
6336
  <xsl:value-of select="normalize-space(title)"/>
@@ -6049,18 +6339,40 @@
6049
6339
  </xsl:for-each>
6050
6340
  </fo:bookmark>
6051
6341
  </xsl:if>
6342
+
6343
+
6344
+ <xsl:if test="$contents_nodes//figures/figure">
6345
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6346
+
6347
+
6348
+
6349
+ <xsl:variable name="bookmark-title">
6350
+
6351
+ <xsl:value-of select="$title-list-figures"/>
6352
+
6353
+ </xsl:variable>
6354
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
6355
+ <xsl:for-each select="$contents_nodes//figures/figure">
6356
+ <fo:bookmark internal-destination="{@id}">
6357
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6358
+ </fo:bookmark>
6359
+ </xsl:for-each>
6360
+ </fo:bookmark>
6361
+ </xsl:if>
6362
+
6052
6363
  </xsl:template><xsl:template name="insertTableBookmarks">
6053
6364
  <xsl:param name="contents"/>
6054
6365
  <xsl:param name="lang"/>
6055
- <xsl:if test="xalan:nodeset($contents)/table">
6056
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
6366
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6367
+ <xsl:if test="$contents_nodes/table">
6368
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
6057
6369
  <fo:bookmark-title>
6058
6370
  <xsl:choose>
6059
6371
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
6060
6372
  <xsl:otherwise>Tables</xsl:otherwise>
6061
6373
  </xsl:choose>
6062
6374
  </fo:bookmark-title>
6063
- <xsl:for-each select="xalan:nodeset($contents)/table">
6375
+ <xsl:for-each select="$contents_nodes/table">
6064
6376
  <fo:bookmark internal-destination="{@id}">
6065
6377
  <fo:bookmark-title>
6066
6378
  <xsl:value-of select="normalize-space(title)"/>
@@ -6069,6 +6381,29 @@
6069
6381
  </xsl:for-each>
6070
6382
  </fo:bookmark>
6071
6383
  </xsl:if>
6384
+
6385
+
6386
+ <xsl:if test="$contents_nodes//tables/table">
6387
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6388
+
6389
+
6390
+
6391
+ <xsl:variable name="bookmark-title">
6392
+
6393
+ <xsl:value-of select="$title-list-tables"/>
6394
+
6395
+ </xsl:variable>
6396
+
6397
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
6398
+
6399
+ <xsl:for-each select="$contents_nodes//tables/table">
6400
+ <fo:bookmark internal-destination="{@id}">
6401
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6402
+ </fo:bookmark>
6403
+ </xsl:for-each>
6404
+ </fo:bookmark>
6405
+ </xsl:if>
6406
+
6072
6407
  </xsl:template><xsl:template name="getLangVersion">
6073
6408
  <xsl:param name="lang"/>
6074
6409
  <xsl:param name="doctype" select="''"/>
@@ -6267,12 +6602,140 @@
6267
6602
  </fo:block-container>
6268
6603
  </fo:block-container>
6269
6604
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
6270
- <xsl:variable name="text">
6605
+ <xsl:choose>
6606
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6607
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6608
+ <xsl:choose>
6609
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
6610
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
6611
+ </xsl:when>
6612
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
6613
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6614
+ </xsl:otherwise>
6615
+ </xsl:choose>
6616
+ </xsl:when>
6617
+ <xsl:otherwise>
6618
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6619
+ </xsl:otherwise>
6620
+ </xsl:choose>
6621
+
6622
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
6623
+ <xsl:variable name="text_step1">
6271
6624
  <xsl:call-template name="add-zero-spaces-equal"/>
6272
6625
  </xsl:variable>
6273
- <xsl:call-template name="add-zero-spaces-java">
6274
- <xsl:with-param name="text" select="$text"/>
6275
- </xsl:call-template>
6626
+ <xsl:variable name="text_step2">
6627
+ <xsl:call-template name="add-zero-spaces-java">
6628
+ <xsl:with-param name="text" select="$text_step1"/>
6629
+ </xsl:call-template>
6630
+ </xsl:variable>
6631
+ <xsl:value-of select="$text_step2"/>
6632
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
6633
+ <xsl:apply-templates mode="syntax_highlight"/>
6634
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
6635
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
6636
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
6637
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
6638
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
6639
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
6640
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
6641
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
6642
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
6643
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
6644
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
6645
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
6646
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
6647
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
6648
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
6649
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
6650
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
6651
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
6652
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
6653
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
6654
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
6655
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
6656
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
6657
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
6658
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
6659
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
6660
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
6661
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
6662
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
6663
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
6664
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
6665
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
6666
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
6667
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
6668
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
6669
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
6670
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
6671
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
6672
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
6673
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
6674
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
6675
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
6676
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
6677
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
6678
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
6679
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
6680
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
6681
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
6682
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
6683
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
6684
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
6685
+ <fo:inline>
6686
+ <xsl:variable name="classes_">
6687
+ <xsl:call-template name="split">
6688
+ <xsl:with-param name="pText" select="@class"/>
6689
+ <xsl:with-param name="sep" select="' '"/>
6690
+ </xsl:call-template>
6691
+ <!-- a few classes together (_and_ suffix) -->
6692
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
6693
+ <item>hljs-char_and_escape_</item>
6694
+ </xsl:if>
6695
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
6696
+ <item>hljs-title_and_class_</item>
6697
+ </xsl:if>
6698
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
6699
+ <item>hljs-title_and_class__and_inherited__</item>
6700
+ </xsl:if>
6701
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
6702
+ <item>hljs-title_and_function_</item>
6703
+ </xsl:if>
6704
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
6705
+ <item>hljs-variable_and_language_</item>
6706
+ </xsl:if>
6707
+ <!-- with parent classes (_ suffix) -->
6708
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
6709
+ <item>hljs-meta_hljs-keyword</item>
6710
+ </xsl:if>
6711
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
6712
+ <item>hljs-meta_hljs-string</item>
6713
+ </xsl:if>
6714
+ </xsl:variable>
6715
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
6716
+
6717
+ <xsl:for-each select="$classes/item">
6718
+ <xsl:variable name="class_name" select="."/>
6719
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6720
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6721
+ </xsl:for-each>
6722
+ </xsl:for-each>
6723
+
6724
+ <!-- <xsl:variable name="class_name">
6725
+ <xsl:choose>
6726
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
6727
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
6728
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
6729
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
6730
+ </xsl:choose>
6731
+ </xsl:variable>
6732
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6733
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6734
+ </xsl:for-each> -->
6735
+
6736
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
6737
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
6738
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6276
6739
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
6277
6740
  <xsl:if test="normalize-space() != ''">
6278
6741
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -6597,6 +7060,8 @@
6597
7060
  </xsl:otherwise>
6598
7061
  </xsl:choose> -->
6599
7062
  </fo:block>
7063
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7064
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6600
7065
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6601
7066
  <xsl:if test="normalize-space() != ''">
6602
7067
  <xsl:value-of select="."/>
@@ -6643,11 +7108,14 @@
6643
7108
 
6644
7109
 
6645
7110
  <fo:block-container margin-left="0mm">
6646
-
6647
- <fo:block xsl:use-attribute-sets="quote-style">
7111
+ <fo:block-container xsl:use-attribute-sets="quote-style">
6648
7112
 
6649
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6650
- </fo:block>
7113
+ <fo:block-container margin-left="0mm" margin-right="0mm">
7114
+ <fo:block role="BlockQuote">
7115
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
7116
+ </fo:block>
7117
+ </fo:block-container>
7118
+ </fo:block-container>
6651
7119
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
6652
7120
  <fo:block xsl:use-attribute-sets="quote-source-style">
6653
7121
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -6668,26 +7136,11 @@
6668
7136
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6669
7137
  <xsl:text>— </xsl:text>
6670
7138
  <xsl:apply-templates/>
6671
- </xsl:template><xsl:variable name="bibitem_hidden_">
6672
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6673
- <xsl:copy-of select="."/>
6674
- </xsl:for-each>
6675
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6676
- <xsl:copy-of select="."/>
6677
- </xsl:for-each>
6678
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6679
-
6680
- <xsl:variable name="bibitemid">
6681
- <xsl:choose>
6682
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6683
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6684
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6685
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6686
- </xsl:choose>
6687
- </xsl:variable>
6688
-
7139
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
7140
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7141
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
6689
7142
  <xsl:choose>
6690
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
7143
+ <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) -->
6691
7144
  <fo:inline xsl:use-attribute-sets="eref-style">
6692
7145
  <xsl:if test="@type = 'footnote'">
6693
7146
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6701,8 +7154,8 @@
6701
7154
  <xsl:variable name="text" select="normalize-space()"/>
6702
7155
 
6703
7156
 
6704
-
6705
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7157
+
7158
+ <fo:basic-link fox:alt-text="{@citeas}">
6706
7159
  <xsl:if test="normalize-space(@citeas) = ''">
6707
7160
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6708
7161
  </xsl:if>
@@ -6712,14 +7165,21 @@
6712
7165
 
6713
7166
  </xsl:if>
6714
7167
 
6715
-
7168
+ <xsl:choose>
7169
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
7170
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
7171
+ </xsl:when>
7172
+ <xsl:otherwise>
7173
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7174
+ </xsl:otherwise>
7175
+ </xsl:choose>
6716
7176
 
6717
7177
  <xsl:apply-templates/>
6718
7178
  </fo:basic-link>
6719
-
7179
+
6720
7180
  </fo:inline>
6721
7181
  </xsl:when>
6722
- <xsl:otherwise>
7182
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6723
7183
  <fo:inline><xsl:apply-templates/></fo:inline>
6724
7184
  </xsl:otherwise>
6725
7185
  </xsl:choose>
@@ -6795,6 +7255,31 @@
6795
7255
  <xsl:with-param name="count" select="$count - 1"/>
6796
7256
  </xsl:call-template>
6797
7257
  </xsl:if>
7258
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
7259
+ <xsl:variable name="level">
7260
+ <xsl:call-template name="getLevel"/>
7261
+ </xsl:variable>
7262
+ <xsl:variable name="font-size">
7263
+ inherit
7264
+ </xsl:variable>
7265
+ <xsl:variable name="levelTerm">
7266
+ <xsl:call-template name="getLevelTermName"/>
7267
+ </xsl:variable>
7268
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
7269
+
7270
+
7271
+
7272
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
7273
+ <fo:block xsl:use-attribute-sets="term-name-style">
7274
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
7275
+ </fo:block>
7276
+ </xsl:if>
7277
+
7278
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
7279
+ <xsl:call-template name="setStyle_preferred"/>
7280
+ <xsl:apply-templates/>
7281
+ </fo:block>
7282
+ </fo:block>
6798
7283
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
6799
7284
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
6800
7285
  <xsl:text> </xsl:text>
@@ -6889,22 +7374,10 @@
6889
7374
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6890
7375
  </xsl:template><xsl:variable name="ul_labels_">
6891
7376
 
6892
-
6893
-
6894
-
6895
-
6896
-
6897
-
6898
-
6899
-
6900
-
6901
-
6902
-
6903
-
6904
-
6905
-
6906
-
6907
-
7377
+ <label level="1">–</label>
7378
+ <label level="2">•</label>
7379
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
7380
+
6908
7381
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6909
7382
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6910
7383
  <xsl:variable name="list_level">
@@ -6930,6 +7403,91 @@
6930
7403
  </xsl:template><xsl:template match="label" mode="ul_labels">
6931
7404
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6932
7405
  <xsl:value-of select="."/>
7406
+ </xsl:template><xsl:template name="getListItemFormat">
7407
+ <!-- Example: for BSI <?list-type loweralpha?> -->
7408
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
7409
+ <xsl:choose>
7410
+ <xsl:when test="local-name(..) = 'ul'">
7411
+ <xsl:choose>
7412
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
7413
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
7414
+ </xsl:choose>
7415
+ </xsl:when>
7416
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
7417
+
7418
+ <!-- Example: for BSI <?list-start 2?> -->
7419
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
7420
+
7421
+ <xsl:variable name="start_value">
7422
+ <xsl:choose>
7423
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
7424
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
7425
+ </xsl:when>
7426
+ <xsl:when test="normalize-space(../@start) != ''">
7427
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
7428
+ </xsl:when>
7429
+ <xsl:otherwise>0</xsl:otherwise>
7430
+ </xsl:choose>
7431
+ </xsl:variable>
7432
+
7433
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
7434
+
7435
+ <xsl:variable name="type">
7436
+ <xsl:choose>
7437
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
7438
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
7439
+
7440
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
7441
+
7442
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
7443
+ <xsl:variable name="list_level">
7444
+ <xsl:choose>
7445
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
7446
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
7447
+ </xsl:choose>
7448
+ </xsl:variable>
7449
+
7450
+ <xsl:choose>
7451
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
7452
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
7453
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
7454
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
7455
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
7456
+ <xsl:otherwise> <!-- level 1 -->
7457
+ <xsl:choose>
7458
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
7459
+ <xsl:otherwise>alphabet</xsl:otherwise>
7460
+ </xsl:choose>
7461
+ </xsl:otherwise>
7462
+ </xsl:choose>
7463
+
7464
+ </xsl:otherwise>
7465
+ </xsl:choose>
7466
+ </xsl:variable>
7467
+
7468
+ <xsl:variable name="format">
7469
+ <xsl:choose>
7470
+ <xsl:when test="$type = 'arabic'">
7471
+ 1)
7472
+ </xsl:when>
7473
+ <xsl:when test="$type = 'alphabet'">
7474
+ a)
7475
+ </xsl:when>
7476
+ <xsl:when test="$type = 'alphabet_upper'">
7477
+ A.
7478
+ </xsl:when>
7479
+ <xsl:when test="$type = 'roman'">
7480
+ i)
7481
+ </xsl:when>
7482
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
7483
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
7484
+ </xsl:choose>
7485
+ </xsl:variable>
7486
+
7487
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
7488
+
7489
+ </xsl:otherwise>
7490
+ </xsl:choose>
6933
7491
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6934
7492
  <xsl:choose>
6935
7493
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6945,18 +7503,71 @@
6945
7503
 
6946
7504
  <fo:block-container margin-left="0mm">
6947
7505
  <fo:block>
6948
- <xsl:apply-templates select="." mode="ul_ol"/>
7506
+ <xsl:apply-templates select="." mode="list"/>
6949
7507
  </fo:block>
6950
7508
  </fo:block-container>
6951
7509
  </fo:block-container>
6952
7510
  </xsl:when>
6953
7511
  <xsl:otherwise>
6954
7512
  <fo:block>
6955
- <xsl:apply-templates select="." mode="ul_ol"/>
7513
+ <xsl:apply-templates select="." mode="list"/>
6956
7514
  </fo:block>
6957
7515
  </xsl:otherwise>
6958
7516
  </xsl:choose>
6959
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
7517
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7518
+ <fo:list-block xsl:use-attribute-sets="list-style">
7519
+
7520
+
7521
+
7522
+
7523
+
7524
+
7525
+
7526
+
7527
+
7528
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7529
+ </fo:list-block>
7530
+ <!-- <xsl:for-each select="./iho:note">
7531
+ <xsl:call-template name="note"/>
7532
+ </xsl:for-each> -->
7533
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
7534
+ </xsl:template><xsl:template match="*[local-name()='li']">
7535
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
7536
+ <xsl:copy-of select="@id"/>
7537
+
7538
+
7539
+
7540
+ <fo:list-item-label end-indent="label-end()">
7541
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
7542
+
7543
+
7544
+
7545
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7546
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7547
+ <xsl:call-template name="append_add-style"/>
7548
+ </xsl:if>
7549
+
7550
+ <xsl:call-template name="getListItemFormat"/>
7551
+ </fo:block>
7552
+ </fo:list-item-label>
7553
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
7554
+ <fo:block>
7555
+
7556
+
7557
+
7558
+
7559
+
7560
+ <xsl:apply-templates/>
7561
+
7562
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
7563
+
7564
+ <xsl:for-each select="./bsi:note">
7565
+ <xsl:call-template name="note"/>
7566
+ </xsl:for-each> -->
7567
+ </fo:block>
7568
+ </fo:list-item-body>
7569
+ </fo:list-item>
7570
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
6960
7571
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6961
7572
  <bookmark><xsl:value-of select="@id"/></bookmark>
6962
7573
  </xsl:for-each>
@@ -6978,7 +7589,7 @@
6978
7589
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6979
7590
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6980
7591
  <xsl:if test="@to">
6981
- <xsl:value-of select="$dash"/>
7592
+ <xsl:value-of select="$en_dash"/>
6982
7593
  <xsl:copy>
6983
7594
  <xsl:copy-of select="@*"/>
6984
7595
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -7003,7 +7614,7 @@
7003
7614
  <xsl:param name="target"/>
7004
7615
  <!-- <node></node> -->
7005
7616
  <xsl:choose>
7006
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7617
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
7007
7618
  <!-- skip text (i.e. remove it) and process next element -->
7008
7619
  <!-- [removed_<xsl:value-of select="."/>] -->
7009
7620
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -7087,12 +7698,22 @@
7087
7698
  </xsl:variable>
7088
7699
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
7089
7700
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7701
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
7702
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
7703
+ <!-- Index -->
7704
+ <xsl:apply-templates/>
7705
+ </fo:block>
7706
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
7707
+ <!-- Letter A, B, C, ... -->
7708
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
7709
+ <xsl:apply-templates/>
7710
+ </fo:block>
7090
7711
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
7091
7712
  <xsl:apply-templates/>
7092
7713
  <fo:block>
7093
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
7094
- <fo:block> </fo:block>
7095
- </xsl:if>
7714
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7715
+ <fo:block> </fo:block>
7716
+ </xsl:if>
7096
7717
  </fo:block>
7097
7718
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
7098
7719
  <xsl:apply-templates/>
@@ -7102,6 +7723,9 @@
7102
7723
 
7103
7724
  <xsl:apply-templates/>
7104
7725
  </fo:block>
7726
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
7727
+ <!-- to split by '_' and other chars -->
7728
+ <xsl:call-template name="add-zero-spaces-java"/>
7105
7729
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
7106
7730
  <fo:inline id="{@id}" font-size="1pt"/>
7107
7731
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -7316,23 +7940,45 @@
7316
7940
  <xsl:apply-templates/>
7317
7941
  </fo:inline>
7318
7942
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7943
+
7944
+ <!-- list of footnotes to calculate actual footnotes number -->
7945
+ <xsl:variable name="p_fn_">
7946
+ <xsl:call-template name="get_fn_list"/>
7947
+ </xsl:variable>
7948
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7949
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7950
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7951
+ <!-- fn sequence number in document -->
7952
+ <xsl:variable name="current_fn_number">
7953
+ <xsl:choose>
7954
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7955
+ <xsl:otherwise>
7956
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7957
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7958
+ </xsl:otherwise>
7959
+ </xsl:choose>
7960
+ </xsl:variable>
7319
7961
  <fo:footnote>
7320
7962
  <xsl:variable name="number">
7321
7963
 
7322
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7964
+ <xsl:value-of select="$current_fn_number"/>
7323
7965
 
7324
7966
  </xsl:variable>
7967
+
7968
+ <xsl:variable name="current_fn_number_text">
7969
+ <xsl:value-of select="$number"/>
7970
+
7971
+ </xsl:variable>
7972
+
7325
7973
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7326
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
7327
- <xsl:value-of select="$number"/>
7328
-
7974
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7975
+ <xsl:value-of select="$current_fn_number_text"/>
7329
7976
  </fo:basic-link>
7330
7977
  </fo:inline>
7331
7978
  <fo:footnote-body>
7332
7979
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
7333
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7334
- <xsl:value-of select="$number"/>
7335
-
7980
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7981
+ <xsl:value-of select="$current_fn_number_text"/>
7336
7982
  </fo:inline>
7337
7983
  <xsl:apply-templates/>
7338
7984
  </fo:block>
@@ -7458,7 +8104,7 @@
7458
8104
  </fo:table-body>
7459
8105
  </fo:table>
7460
8106
  </fo:block>
7461
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
8107
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
7462
8108
  <fo:table-row min-height="5mm">
7463
8109
  <xsl:apply-templates/>
7464
8110
  </fo:table-row>
@@ -7578,6 +8224,78 @@
7578
8224
  <xsl:apply-templates/>
7579
8225
  </fo:block>
7580
8226
 
8227
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
8228
+ <xsl:copy>
8229
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
8230
+ </xsl:copy>
8231
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
8232
+ <xsl:copy>
8233
+ <xsl:copy-of select="@*"/>
8234
+
8235
+ <xsl:variable name="nodes_preface_">
8236
+ <xsl:for-each select="*">
8237
+ <node id="{@id}"/>
8238
+ </xsl:for-each>
8239
+ </xsl:variable>
8240
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
8241
+
8242
+ <xsl:for-each select="*">
8243
+ <xsl:sort select="@displayorder" data-type="number"/>
8244
+
8245
+ <!-- process Section's title -->
8246
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8247
+ <xsl:if test="$preceding-sibling_id != ''">
8248
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8249
+ </xsl:if>
8250
+
8251
+ <xsl:choose>
8252
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8253
+ <xsl:otherwise>
8254
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8255
+ </xsl:otherwise>
8256
+ </xsl:choose>
8257
+
8258
+ </xsl:for-each>
8259
+ </xsl:copy>
8260
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
8261
+ <xsl:copy>
8262
+ <xsl:copy-of select="@*"/>
8263
+
8264
+ <xsl:variable name="nodes_sections_">
8265
+ <xsl:for-each select="*">
8266
+ <node id="{@id}"/>
8267
+ </xsl:for-each>
8268
+ </xsl:variable>
8269
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
8270
+
8271
+ <!-- move section 'Normative references' inside 'sections' -->
8272
+ <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']]">
8273
+ <xsl:sort select="@displayorder" data-type="number"/>
8274
+
8275
+ <!-- process Section's title -->
8276
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8277
+ <xsl:if test="$preceding-sibling_id != ''">
8278
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8279
+ </xsl:if>
8280
+
8281
+ <xsl:choose>
8282
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8283
+ <xsl:otherwise>
8284
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8285
+ </xsl:otherwise>
8286
+ </xsl:choose>
8287
+
8288
+ </xsl:for-each>
8289
+ </xsl:copy>
8290
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
8291
+ <xsl:copy>
8292
+ <xsl:copy-of select="@*"/>
8293
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8294
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8295
+ <xsl:sort select="@displayorder" data-type="number"/>
8296
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8297
+ </xsl:for-each>
8298
+ </xsl:copy>
7581
8299
  </xsl:template><xsl:template name="convertDate">
7582
8300
  <xsl:param name="date"/>
7583
8301
  <xsl:param name="format" select="'short'"/>
@@ -7691,9 +8409,6 @@
7691
8409
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7692
8410
  </xsl:choose>
7693
8411
  </xsl:template><xsl:template name="addPDFUAmeta">
7694
- <xsl:variable name="lang">
7695
- <xsl:call-template name="getLang"/>
7696
- </xsl:variable>
7697
8412
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7698
8413
  <pdf:dictionary type="normal" key="ViewerPreferences">
7699
8414
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -7921,10 +8636,12 @@
7921
8636
  <xsl:param name="key"/>
7922
8637
  <xsl:param name="formatted">false</xsl:param>
7923
8638
  <xsl:param name="lang"/>
8639
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
7924
8640
 
7925
8641
  <xsl:variable name="curr_lang">
7926
8642
  <xsl:choose>
7927
8643
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
8644
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7928
8645
  <xsl:otherwise>
7929
8646
  <xsl:call-template name="getLang"/>
7930
8647
  </xsl:otherwise>
@@ -7959,6 +8676,7 @@
7959
8676
  </xsl:otherwise>
7960
8677
  </xsl:choose>
7961
8678
  </xsl:when>
8679
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7962
8680
  <xsl:otherwise>
7963
8681
  <xsl:variable name="key_">
7964
8682
  <xsl:call-template name="capitalize">
@@ -8028,53 +8746,153 @@
8028
8746
  <xsl:param name="first"/>
8029
8747
  <xsl:if test="$number != ''">
8030
8748
  <xsl:variable name="words">
8031
- <words>
8032
- <word cardinal="1">One-</word>
8033
- <word ordinal="1">First </word>
8034
- <word cardinal="2">Two-</word>
8035
- <word ordinal="2">Second </word>
8036
- <word cardinal="3">Three-</word>
8037
- <word ordinal="3">Third </word>
8038
- <word cardinal="4">Four-</word>
8039
- <word ordinal="4">Fourth </word>
8040
- <word cardinal="5">Five-</word>
8041
- <word ordinal="5">Fifth </word>
8042
- <word cardinal="6">Six-</word>
8043
- <word ordinal="6">Sixth </word>
8044
- <word cardinal="7">Seven-</word>
8045
- <word ordinal="7">Seventh </word>
8046
- <word cardinal="8">Eight-</word>
8047
- <word ordinal="8">Eighth </word>
8048
- <word cardinal="9">Nine-</word>
8049
- <word ordinal="9">Ninth </word>
8050
- <word ordinal="10">Tenth </word>
8051
- <word ordinal="11">Eleventh </word>
8052
- <word ordinal="12">Twelfth </word>
8053
- <word ordinal="13">Thirteenth </word>
8054
- <word ordinal="14">Fourteenth </word>
8055
- <word ordinal="15">Fifteenth </word>
8056
- <word ordinal="16">Sixteenth </word>
8057
- <word ordinal="17">Seventeenth </word>
8058
- <word ordinal="18">Eighteenth </word>
8059
- <word ordinal="19">Nineteenth </word>
8060
- <word cardinal="20">Twenty-</word>
8061
- <word ordinal="20">Twentieth </word>
8062
- <word cardinal="30">Thirty-</word>
8063
- <word ordinal="30">Thirtieth </word>
8064
- <word cardinal="40">Forty-</word>
8065
- <word ordinal="40">Fortieth </word>
8066
- <word cardinal="50">Fifty-</word>
8067
- <word ordinal="50">Fiftieth </word>
8068
- <word cardinal="60">Sixty-</word>
8069
- <word ordinal="60">Sixtieth </word>
8070
- <word cardinal="70">Seventy-</word>
8071
- <word ordinal="70">Seventieth </word>
8072
- <word cardinal="80">Eighty-</word>
8073
- <word ordinal="80">Eightieth </word>
8074
- <word cardinal="90">Ninety-</word>
8075
- <word ordinal="90">Ninetieth </word>
8076
- <word cardinal="100">Hundred-</word>
8077
- <word ordinal="100">Hundredth </word>
8749
+ <words>
8750
+ <xsl:choose>
8751
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
8752
+ <word cardinal="1">Une-</word>
8753
+ <word ordinal="1">Première </word>
8754
+ <word cardinal="2">Deux-</word>
8755
+ <word ordinal="2">Seconde </word>
8756
+ <word cardinal="3">Trois-</word>
8757
+ <word ordinal="3">Tierce </word>
8758
+ <word cardinal="4">Quatre-</word>
8759
+ <word ordinal="4">Quatrième </word>
8760
+ <word cardinal="5">Cinq-</word>
8761
+ <word ordinal="5">Cinquième </word>
8762
+ <word cardinal="6">Six-</word>
8763
+ <word ordinal="6">Sixième </word>
8764
+ <word cardinal="7">Sept-</word>
8765
+ <word ordinal="7">Septième </word>
8766
+ <word cardinal="8">Huit-</word>
8767
+ <word ordinal="8">Huitième </word>
8768
+ <word cardinal="9">Neuf-</word>
8769
+ <word ordinal="9">Neuvième </word>
8770
+ <word ordinal="10">Dixième </word>
8771
+ <word ordinal="11">Onzième </word>
8772
+ <word ordinal="12">Douzième </word>
8773
+ <word ordinal="13">Treizième </word>
8774
+ <word ordinal="14">Quatorzième </word>
8775
+ <word ordinal="15">Quinzième </word>
8776
+ <word ordinal="16">Seizième </word>
8777
+ <word ordinal="17">Dix-septième </word>
8778
+ <word ordinal="18">Dix-huitième </word>
8779
+ <word ordinal="19">Dix-neuvième </word>
8780
+ <word cardinal="20">Vingt-</word>
8781
+ <word ordinal="20">Vingtième </word>
8782
+ <word cardinal="30">Trente-</word>
8783
+ <word ordinal="30">Trentième </word>
8784
+ <word cardinal="40">Quarante-</word>
8785
+ <word ordinal="40">Quarantième </word>
8786
+ <word cardinal="50">Cinquante-</word>
8787
+ <word ordinal="50">Cinquantième </word>
8788
+ <word cardinal="60">Soixante-</word>
8789
+ <word ordinal="60">Soixantième </word>
8790
+ <word cardinal="70">Septante-</word>
8791
+ <word ordinal="70">Septantième </word>
8792
+ <word cardinal="80">Huitante-</word>
8793
+ <word ordinal="80">Huitantième </word>
8794
+ <word cardinal="90">Nonante-</word>
8795
+ <word ordinal="90">Nonantième </word>
8796
+ <word cardinal="100">Cent-</word>
8797
+ <word ordinal="100">Centième </word>
8798
+ </xsl:when>
8799
+ <xsl:when test="$lang = 'ru'">
8800
+ <word cardinal="1">Одна-</word>
8801
+ <word ordinal="1">Первое </word>
8802
+ <word cardinal="2">Две-</word>
8803
+ <word ordinal="2">Второе </word>
8804
+ <word cardinal="3">Три-</word>
8805
+ <word ordinal="3">Третье </word>
8806
+ <word cardinal="4">Четыре-</word>
8807
+ <word ordinal="4">Четвертое </word>
8808
+ <word cardinal="5">Пять-</word>
8809
+ <word ordinal="5">Пятое </word>
8810
+ <word cardinal="6">Шесть-</word>
8811
+ <word ordinal="6">Шестое </word>
8812
+ <word cardinal="7">Семь-</word>
8813
+ <word ordinal="7">Седьмое </word>
8814
+ <word cardinal="8">Восемь-</word>
8815
+ <word ordinal="8">Восьмое </word>
8816
+ <word cardinal="9">Девять-</word>
8817
+ <word ordinal="9">Девятое </word>
8818
+ <word ordinal="10">Десятое </word>
8819
+ <word ordinal="11">Одиннадцатое </word>
8820
+ <word ordinal="12">Двенадцатое </word>
8821
+ <word ordinal="13">Тринадцатое </word>
8822
+ <word ordinal="14">Четырнадцатое </word>
8823
+ <word ordinal="15">Пятнадцатое </word>
8824
+ <word ordinal="16">Шестнадцатое </word>
8825
+ <word ordinal="17">Семнадцатое </word>
8826
+ <word ordinal="18">Восемнадцатое </word>
8827
+ <word ordinal="19">Девятнадцатое </word>
8828
+ <word cardinal="20">Двадцать-</word>
8829
+ <word ordinal="20">Двадцатое </word>
8830
+ <word cardinal="30">Тридцать-</word>
8831
+ <word ordinal="30">Тридцатое </word>
8832
+ <word cardinal="40">Сорок-</word>
8833
+ <word ordinal="40">Сороковое </word>
8834
+ <word cardinal="50">Пятьдесят-</word>
8835
+ <word ordinal="50">Пятидесятое </word>
8836
+ <word cardinal="60">Шестьдесят-</word>
8837
+ <word ordinal="60">Шестидесятое </word>
8838
+ <word cardinal="70">Семьдесят-</word>
8839
+ <word ordinal="70">Семидесятое </word>
8840
+ <word cardinal="80">Восемьдесят-</word>
8841
+ <word ordinal="80">Восьмидесятое </word>
8842
+ <word cardinal="90">Девяносто-</word>
8843
+ <word ordinal="90">Девяностое </word>
8844
+ <word cardinal="100">Сто-</word>
8845
+ <word ordinal="100">Сотое </word>
8846
+ </xsl:when>
8847
+ <xsl:otherwise> <!-- default english -->
8848
+ <word cardinal="1">One-</word>
8849
+ <word ordinal="1">First </word>
8850
+ <word cardinal="2">Two-</word>
8851
+ <word ordinal="2">Second </word>
8852
+ <word cardinal="3">Three-</word>
8853
+ <word ordinal="3">Third </word>
8854
+ <word cardinal="4">Four-</word>
8855
+ <word ordinal="4">Fourth </word>
8856
+ <word cardinal="5">Five-</word>
8857
+ <word ordinal="5">Fifth </word>
8858
+ <word cardinal="6">Six-</word>
8859
+ <word ordinal="6">Sixth </word>
8860
+ <word cardinal="7">Seven-</word>
8861
+ <word ordinal="7">Seventh </word>
8862
+ <word cardinal="8">Eight-</word>
8863
+ <word ordinal="8">Eighth </word>
8864
+ <word cardinal="9">Nine-</word>
8865
+ <word ordinal="9">Ninth </word>
8866
+ <word ordinal="10">Tenth </word>
8867
+ <word ordinal="11">Eleventh </word>
8868
+ <word ordinal="12">Twelfth </word>
8869
+ <word ordinal="13">Thirteenth </word>
8870
+ <word ordinal="14">Fourteenth </word>
8871
+ <word ordinal="15">Fifteenth </word>
8872
+ <word ordinal="16">Sixteenth </word>
8873
+ <word ordinal="17">Seventeenth </word>
8874
+ <word ordinal="18">Eighteenth </word>
8875
+ <word ordinal="19">Nineteenth </word>
8876
+ <word cardinal="20">Twenty-</word>
8877
+ <word ordinal="20">Twentieth </word>
8878
+ <word cardinal="30">Thirty-</word>
8879
+ <word ordinal="30">Thirtieth </word>
8880
+ <word cardinal="40">Forty-</word>
8881
+ <word ordinal="40">Fortieth </word>
8882
+ <word cardinal="50">Fifty-</word>
8883
+ <word ordinal="50">Fiftieth </word>
8884
+ <word cardinal="60">Sixty-</word>
8885
+ <word ordinal="60">Sixtieth </word>
8886
+ <word cardinal="70">Seventy-</word>
8887
+ <word ordinal="70">Seventieth </word>
8888
+ <word cardinal="80">Eighty-</word>
8889
+ <word ordinal="80">Eightieth </word>
8890
+ <word cardinal="90">Ninety-</word>
8891
+ <word ordinal="90">Ninetieth </word>
8892
+ <word cardinal="100">Hundred-</word>
8893
+ <word ordinal="100">Hundredth </word>
8894
+ </xsl:otherwise>
8895
+ </xsl:choose>
8078
8896
  </words>
8079
8897
  </xsl:variable>
8080
8898
 
@@ -8148,4 +8966,18 @@
8148
8966
  <xsl:otherwise>_</xsl:otherwise>
8149
8967
  </xsl:choose>
8150
8968
  </xsl:attribute>
8969
+ </xsl:template><xsl:template name="substring-after-last">
8970
+ <xsl:param name="value"/>
8971
+ <xsl:param name="delimiter"/>
8972
+ <xsl:choose>
8973
+ <xsl:when test="contains($value, $delimiter)">
8974
+ <xsl:call-template name="substring-after-last">
8975
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
8976
+ <xsl:with-param name="delimiter" select="$delimiter"/>
8977
+ </xsl:call-template>
8978
+ </xsl:when>
8979
+ <xsl:otherwise>
8980
+ <xsl:value-of select="$value"/>
8981
+ </xsl:otherwise>
8982
+ </xsl:choose>
8151
8983
  </xsl:template></xsl:stylesheet>