metanorma-mpfa 0.6.6 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c8636c4532317ad31af938010b32a0e0db9504d6d7bc6f96d46603694f3db1e
4
- data.tar.gz: fa33c669965b72847fa28c831ade831a5cbd0b0253794d4c3acb9d8454c6eda5
3
+ metadata.gz: 03feeea1971898de543923966b8a3a0c4f6b7870ff00dde9a176c70ad9f3afb5
4
+ data.tar.gz: 9b35dca4e54628cdfd6823e2a2d8df8da858fcb20ca52d15e6a69c44c01e5986
5
5
  SHA512:
6
- metadata.gz: c93cb0a5cd55b40bf6b22c5cfeac7e1a9d8c772b20a7e3c0b08b511ca4ccde6d188d99fdaf823362305bfdc4a80a8b675b8779ff91e91f0f816bb75b3ebf5243
7
- data.tar.gz: 17011395f91cc0f1210707bf31e6797a693bed509e1afeda99222e8ffc702fec9853c26110ed22716ae8fdd28ce59fd43bd3486d96392fe68e768ee39692f22e
6
+ metadata.gz: 0fd18f79dcd91f3104f13b5b6b4e555ead40f0f6a46a8d410e383159bd00f63cb1506958b15158fb562ef4da87a1b564b5804130d52eb302fe89394421e68d12
7
+ data.tar.gz: '018258015a295686a5f4f65cf23f870dcf83b04367e7142b0e4aa447c5657f15d415f0ab2c7f776f003af7f242644e8091593b2148e3b98b6adaccd58e6003d5'
@@ -32,6 +32,18 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="section-title">
36
+ <element name="title">
37
+ <zeroOrMore>
38
+ <ref name="TextElement"/>
39
+ </zeroOrMore>
40
+ </element>
41
+ <zeroOrMore>
42
+ <element name="variant-title">
43
+ <ref name="TypedTitleString"/>
44
+ </element>
45
+ </zeroOrMore>
46
+ </define>
35
47
  <define name="hyperlink">
36
48
  <element name="link">
37
49
  <attribute name="target">
@@ -158,15 +170,17 @@
158
170
  <data type="boolean"/>
159
171
  </attribute>
160
172
  </optional>
161
- <attribute name="type">
162
- <choice>
163
- <value>roman</value>
164
- <value>alphabet</value>
165
- <value>arabic</value>
166
- <value>roman_upper</value>
167
- <value>alphabet_upper</value>
168
- </choice>
169
- </attribute>
173
+ <optional>
174
+ <attribute name="type">
175
+ <choice>
176
+ <value>roman</value>
177
+ <value>alphabet</value>
178
+ <value>arabic</value>
179
+ <value>roman_upper</value>
180
+ <value>alphabet_upper</value>
181
+ </choice>
182
+ </attribute>
183
+ </optional>
170
184
  <oneOrMore>
171
185
  <ref name="li"/>
172
186
  </oneOrMore>
@@ -204,6 +218,18 @@
204
218
  </zeroOrMore>
205
219
  </element>
206
220
  </define>
221
+ <define name="dt">
222
+ <element name="dt">
223
+ <optional>
224
+ <attribute name="id">
225
+ <data type="ID"/>
226
+ </attribute>
227
+ </optional>
228
+ <zeroOrMore>
229
+ <ref name="TextElement"/>
230
+ </zeroOrMore>
231
+ </element>
232
+ </define>
207
233
  <define name="example">
208
234
  <element name="example">
209
235
  <attribute name="id">
@@ -899,7 +925,7 @@
899
925
  </include>
900
926
  <!-- end overrides -->
901
927
  <define name="docsubtype">
902
- <element name="docsubtype">
928
+ <element name="subdoctype">
903
929
  <ref name="DocumentSubtype"/>
904
930
  </element>
905
931
  </define>
@@ -954,6 +980,16 @@
954
980
  </define>
955
981
  <define name="concept">
956
982
  <element name="concept">
983
+ <optional>
984
+ <attribute name="ital">
985
+ <data type="boolean"/>
986
+ </attribute>
987
+ </optional>
988
+ <optional>
989
+ <attribute name="ref">
990
+ <data type="boolean"/>
991
+ </attribute>
992
+ </optional>
957
993
  <optional>
958
994
  <element name="refterm">
959
995
  <zeroOrMore>
@@ -989,8 +1025,14 @@
989
1025
  <ref name="imagemap"/>
990
1026
  <ref name="svgmap"/>
991
1027
  <ref name="inputform"/>
1028
+ <ref name="toc"/>
992
1029
  </choice>
993
1030
  </define>
1031
+ <define name="toc">
1032
+ <element name="toc">
1033
+ <ref name="ul"/>
1034
+ </element>
1035
+ </define>
994
1036
  <define name="inputform">
995
1037
  <element name="form">
996
1038
  <attribute name="id">
@@ -998,6 +1040,9 @@
998
1040
  </attribute>
999
1041
  <attribute name="name"/>
1000
1042
  <attribute name="action"/>
1043
+ <optional>
1044
+ <attribute name="class"/>
1045
+ </optional>
1001
1046
  <zeroOrMore>
1002
1047
  <choice>
1003
1048
  <ref name="TextElement"/>
@@ -1229,6 +1274,12 @@
1229
1274
  <optional>
1230
1275
  <attribute name="type"/>
1231
1276
  </optional>
1277
+ <optional>
1278
+ <attribute name="identifier"/>
1279
+ </optional>
1280
+ <optional>
1281
+ <attribute name="prefix"/>
1282
+ </optional>
1232
1283
  <text/>
1233
1284
  </define>
1234
1285
  <define name="ics">
@@ -1490,26 +1541,26 @@
1490
1541
  <optional>
1491
1542
  <ref name="section-title"/>
1492
1543
  </optional>
1493
- <group>
1544
+ <choice>
1494
1545
  <choice>
1495
1546
  <group>
1496
- <zeroOrMore>
1547
+ <oneOrMore>
1497
1548
  <ref name="BasicBlock"/>
1498
- </zeroOrMore>
1549
+ </oneOrMore>
1499
1550
  <zeroOrMore>
1500
1551
  <ref name="note"/>
1501
1552
  </zeroOrMore>
1502
1553
  </group>
1503
1554
  <ref name="amend"/>
1504
1555
  </choice>
1505
- <zeroOrMore>
1556
+ <oneOrMore>
1506
1557
  <choice>
1507
1558
  <ref name="clause-subsection"/>
1508
1559
  <ref name="terms"/>
1509
1560
  <ref name="definitions"/>
1510
1561
  </choice>
1511
- </zeroOrMore>
1512
- </group>
1562
+ </oneOrMore>
1563
+ </choice>
1513
1564
  </define>
1514
1565
  <define name="Annex-Section">
1515
1566
  <optional>
@@ -64,9 +64,9 @@
64
64
  <optional>
65
65
  <ref name="label"/>
66
66
  </optional>
67
- <optional>
67
+ <zeroOrMore>
68
68
  <ref name="subject"/>
69
- </optional>
69
+ </zeroOrMore>
70
70
  <zeroOrMore>
71
71
  <ref name="reqinherit"/>
72
72
  </zeroOrMore>
@@ -80,6 +80,7 @@
80
80
  <ref name="verification"/>
81
81
  <ref name="import"/>
82
82
  <ref name="description"/>
83
+ <ref name="component"/>
83
84
  </choice>
84
85
  </zeroOrMore>
85
86
  <optional>
@@ -105,12 +106,16 @@
105
106
  </define>
106
107
  <define name="subject">
107
108
  <element name="subject">
108
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
109
112
  </element>
110
113
  </define>
111
114
  <define name="reqinherit">
112
115
  <element name="inherit">
113
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
114
119
  </element>
115
120
  </define>
116
121
  <define name="measurementtarget">
@@ -138,6 +143,12 @@
138
143
  <ref name="RequirementSubpart"/>
139
144
  </element>
140
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
141
152
  <define name="reqt_references">
142
153
  <element name="references">
143
154
  <oneOrMore>
@@ -37,7 +37,6 @@ module IsoDoc
37
37
  def googlefonts
38
38
  <<~HEAD.freeze
39
39
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
40
- <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
41
40
  <link href="https://fonts.googleapis.com/css?family=Titillium+Web:400,400i,700,700i" rel="stylesheet">
42
41
  HEAD
43
42
  end
@@ -134,7 +134,7 @@
134
134
  <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-MPFD-Logo))}" width="13.2mm" content-height="13mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image MPFD Logo"/>
135
135
  </fo:block>
136
136
  <fo:block-container text-align="center">
137
- <fo:block>
137
+ <fo:block role="H1">
138
138
  <fo:inline font-size="24pt" font-weight="bold">
139
139
  <xsl:call-template name="capitalizeWords">
140
140
  <xsl:with-param name="str" select="java:replaceAll(java:java.lang.String.new(/mpfd:mpfd-standard/mpfd:bibdata/mpfd:ext/mpfd:doctype),'MPF','')"/>
@@ -181,10 +181,10 @@
181
181
  <xsl:with-param name="name" select="'title-toc'"/>
182
182
  </xsl:call-template>
183
183
  </xsl:variable>
184
- <fo:block font-size="14pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
185
- <fo:block line-height="115%">
184
+ <fo:block font-size="14pt" margin-bottom="15.5pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
185
+ <fo:block line-height="115%" role="TOC">
186
186
  <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
187
- <fo:block>
187
+ <fo:block role="TOCI">
188
188
  <xsl:if test="@level = 1">
189
189
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
190
190
  </xsl:if>
@@ -240,7 +240,7 @@
240
240
 
241
241
 
242
242
 
243
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
243
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt" role="H1">
244
244
  <xsl:value-of select="$title-en"/>
245
245
  </fo:block>
246
246
 
@@ -389,12 +389,13 @@
389
389
  </xsl:choose>
390
390
  </xsl:variable>
391
391
 
392
- <fo:block font-size="{$font-size}" color="rgb(14, 26, 133)" font-weight="bold" space-before="{$space-before}" space-after="{$space-after}" keep-with-next="always">
392
+ <fo:block font-size="{$font-size}" color="rgb(14, 26, 133)" font-weight="bold" space-before="{$space-before}" space-after="{$space-after}" keep-with-next="always" role="H{$level}">
393
393
  <xsl:if test="parent::mpfd:annex">
394
394
  <xsl:attribute name="text-align">center</xsl:attribute>
395
395
  <xsl:attribute name="font-size">12pt</xsl:attribute>
396
396
  </xsl:if>
397
397
  <xsl:apply-templates/>
398
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
398
399
  </fo:block>
399
400
 
400
401
  </xsl:template>
@@ -737,14 +738,14 @@
737
738
 
738
739
  <xsl:template name="insertHeaderFooter">
739
740
  <xsl:param name="font-weight">normal</xsl:param>
740
- <fo:static-content flow-name="header-even">
741
+ <fo:static-content flow-name="header-even" role="artifact">
741
742
  <fo:block-container height="100%" display-align="before">
742
743
  <fo:block padding-top="12.5mm">
743
744
  <xsl:value-of select="$copyrightShort"/>
744
745
  </fo:block>
745
746
  </fo:block-container>
746
747
  </fo:static-content>
747
- <fo:static-content flow-name="footer-even">
748
+ <fo:static-content flow-name="footer-even" role="artifact">
748
749
  <fo:block-container font-size="10pt" height="100%" display-align="after">
749
750
  <fo:table table-layout="fixed" width="100%">
750
751
  <fo:table-column column-width="10%"/>
@@ -762,14 +763,14 @@
762
763
  </fo:table>
763
764
  </fo:block-container>
764
765
  </fo:static-content>
765
- <fo:static-content flow-name="header-odd">
766
+ <fo:static-content flow-name="header-odd" role="artifact">
766
767
  <fo:block-container height="100%" display-align="before">
767
768
  <fo:block text-align="right" padding-top="12.5mm">
768
769
  <xsl:value-of select="$copyrightShort"/>
769
770
  </fo:block>
770
771
  </fo:block-container>
771
772
  </fo:static-content>
772
- <fo:static-content flow-name="footer-odd">
773
+ <fo:static-content flow-name="footer-odd" role="artifact">
773
774
  <fo:block-container font-size="10pt" height="100%" display-align="after">
774
775
  <fo:table table-layout="fixed" width="100%">
775
776
  <fo:table-column column-width="90%"/>
@@ -957,6 +958,7 @@
957
958
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
958
959
  <xsl:attribute name="white-space">pre</xsl:attribute>
959
960
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
961
+ <xsl:attribute name="role">Code</xsl:attribute>
960
962
 
961
963
 
962
964
 
@@ -978,8 +980,13 @@
978
980
 
979
981
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
980
982
 
981
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
982
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
983
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
984
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
985
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
986
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
987
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
988
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
989
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
983
990
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
984
991
 
985
992
 
@@ -1053,6 +1060,7 @@
1053
1060
 
1054
1061
 
1055
1062
 
1063
+
1056
1064
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1057
1065
 
1058
1066
 
@@ -1062,7 +1070,9 @@
1062
1070
 
1063
1071
 
1064
1072
 
1065
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1073
+ </xsl:attribute-set><xsl:variable name="table-border_">
1074
+
1075
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1066
1076
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1067
1077
 
1068
1078
 
@@ -1169,7 +1179,8 @@
1169
1179
 
1170
1180
 
1171
1181
 
1172
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1182
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1183
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1173
1184
 
1174
1185
 
1175
1186
 
@@ -1357,11 +1368,15 @@
1357
1368
  <fo:block>&#xA0;</fo:block>
1358
1369
  </xsl:if> -->
1359
1370
 
1371
+
1372
+ <!-- Display table's name before table as standalone block -->
1360
1373
  <!-- $namespace = 'iso' or -->
1361
1374
 
1362
1375
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1363
1376
 
1364
-
1377
+
1378
+
1379
+
1365
1380
 
1366
1381
  <xsl:call-template name="fn_name_display"/>
1367
1382
 
@@ -1436,6 +1451,12 @@
1436
1451
 
1437
1452
 
1438
1453
 
1454
+
1455
+
1456
+
1457
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1458
+
1459
+
1439
1460
  <xsl:variable name="table_width">
1440
1461
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1441
1462
  100%
@@ -1454,6 +1475,7 @@
1454
1475
 
1455
1476
 
1456
1477
 
1478
+
1457
1479
 
1458
1480
 
1459
1481
 
@@ -1480,6 +1502,8 @@
1480
1502
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1481
1503
  </xsl:if>
1482
1504
 
1505
+
1506
+
1483
1507
  <xsl:choose>
1484
1508
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1485
1509
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -1767,9 +1791,9 @@
1767
1791
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1768
1792
  <xsl:with-param name="continued">true</xsl:with-param>
1769
1793
  </xsl:apply-templates>
1770
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1771
- <xsl:call-template name="fn_name_display"/>
1772
- </xsl:for-each>
1794
+
1795
+
1796
+
1773
1797
 
1774
1798
  </fo:table-cell>
1775
1799
  </fo:table-row>
@@ -1851,7 +1875,11 @@
1851
1875
 
1852
1876
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1853
1877
 
1854
- <xsl:if test="$isNoteOrFnExist = 'true'">
1878
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
1879
+
1880
+ </xsl:variable>
1881
+
1882
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
1855
1883
 
1856
1884
  <xsl:variable name="cols-count">
1857
1885
  <xsl:choose>
@@ -1880,6 +1908,8 @@
1880
1908
  </xsl:choose>
1881
1909
  </xsl:for-each>
1882
1910
 
1911
+
1912
+
1883
1913
  <xsl:choose>
1884
1914
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1885
1915
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1906,6 +1936,7 @@
1906
1936
 
1907
1937
 
1908
1938
 
1939
+
1909
1940
  <!-- fn will be processed inside 'note' processing -->
1910
1941
 
1911
1942
 
@@ -1914,6 +1945,11 @@
1914
1945
 
1915
1946
 
1916
1947
 
1948
+
1949
+
1950
+ <!-- for BSI (not PAS) display Notes before footnotes -->
1951
+
1952
+
1917
1953
  <!-- except gb -->
1918
1954
 
1919
1955
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -1939,6 +1975,10 @@
1939
1975
  <!-- fn processing -->
1940
1976
  <xsl:call-template name="fn_display"/>
1941
1977
 
1978
+
1979
+ <!-- for PAS display Notes after footnotes -->
1980
+
1981
+
1942
1982
  </fo:table-cell>
1943
1983
  </fo:table-row>
1944
1984
  </fo:table-body>
@@ -1980,6 +2020,19 @@
1980
2020
 
1981
2021
  </fo:table-body>
1982
2022
 
2023
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2024
+ <xsl:choose>
2025
+ <xsl:when test="substring-after(., '—') != ''">
2026
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2027
+ </xsl:when>
2028
+ <xsl:otherwise>
2029
+ <xsl:value-of select="."/>
2030
+ </xsl:otherwise>
2031
+ </xsl:choose>
2032
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2033
+ <xsl:apply-templates mode="presentation_name"/>
2034
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2035
+ <xsl:apply-templates select="."/>
1983
2036
  </xsl:template><xsl:template match="*[local-name()='tr']">
1984
2037
  <xsl:variable name="parent-name" select="local-name(..)"/>
1985
2038
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -1992,10 +2045,13 @@
1992
2045
 
1993
2046
 
1994
2047
 
2048
+
2049
+
1995
2050
  </xsl:if>
1996
2051
  <xsl:if test="$parent-name = 'tfoot'">
1997
2052
 
1998
2053
 
2054
+
1999
2055
  </xsl:if>
2000
2056
 
2001
2057
 
@@ -2005,6 +2061,8 @@
2005
2061
 
2006
2062
 
2007
2063
 
2064
+
2065
+
2008
2066
  <!-- <xsl:if test="$namespace = 'bipm'">
2009
2067
  <xsl:attribute name="height">8mm</xsl:attribute>
2010
2068
  </xsl:if> -->
@@ -2127,8 +2185,13 @@
2127
2185
 
2128
2186
 
2129
2187
 
2188
+
2189
+ <!-- Table's note name (NOTE, for example) -->
2190
+
2130
2191
  <fo:inline padding-right="2mm">
2131
2192
 
2193
+
2194
+
2132
2195
 
2133
2196
 
2134
2197
 
@@ -2136,6 +2199,8 @@
2136
2199
 
2137
2200
  </fo:inline>
2138
2201
 
2202
+
2203
+
2139
2204
  <xsl:apply-templates mode="process"/>
2140
2205
  </fo:block>
2141
2206
 
@@ -2143,18 +2208,18 @@
2143
2208
  <xsl:apply-templates/>
2144
2209
  </xsl:template><xsl:template name="fn_display">
2145
2210
  <xsl:variable name="references">
2211
+
2146
2212
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2147
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2148
-
2149
-
2150
- <xsl:apply-templates/>
2151
- </fn>
2213
+ <xsl:call-template name="create_fn"/>
2152
2214
  </xsl:for-each>
2153
2215
  </xsl:variable>
2216
+
2154
2217
  <xsl:for-each select="xalan:nodeset($references)//fn">
2155
2218
  <xsl:variable name="reference" select="@reference"/>
2156
2219
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2157
2220
  <fo:block margin-bottom="12pt">
2221
+
2222
+
2158
2223
 
2159
2224
 
2160
2225
 
@@ -2172,6 +2237,7 @@
2172
2237
  <xsl:value-of select="@reference"/>
2173
2238
 
2174
2239
 
2240
+
2175
2241
  </fo:inline>
2176
2242
  <fo:inline>
2177
2243
 
@@ -2181,6 +2247,12 @@
2181
2247
  </fo:block>
2182
2248
  </xsl:if>
2183
2249
  </xsl:for-each>
2250
+ </xsl:template><xsl:template name="create_fn">
2251
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2252
+
2253
+
2254
+ <xsl:apply-templates/>
2255
+ </fn>
2184
2256
  </xsl:template><xsl:template name="fn_name_display">
2185
2257
  <!-- <xsl:variable name="references">
2186
2258
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2321,6 +2393,7 @@
2321
2393
 
2322
2394
  <xsl:value-of select="@reference"/>
2323
2395
 
2396
+
2324
2397
  </fo:basic-link>
2325
2398
  </fo:inline>
2326
2399
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3159,16 +3232,68 @@
3159
3232
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3160
3233
  </xsl:call-template>
3161
3234
 
3235
+
3236
+
3162
3237
  <xsl:variable name="mathml">
3163
3238
  <xsl:apply-templates select="." mode="mathml"/>
3164
3239
  </xsl:variable>
3165
3240
  <fo:instream-foreign-object fox:alt-text="Math">
3166
3241
 
3167
3242
 
3243
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3244
+ <xsl:variable name="comment_text_">
3245
+ <xsl:choose>
3246
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3247
+ <xsl:value-of select="$comment_text_following"/>
3248
+ </xsl:when>
3249
+ <xsl:otherwise>
3250
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3251
+ </xsl:otherwise>
3252
+ </xsl:choose>
3253
+ </xsl:variable>
3254
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3255
+
3256
+ <xsl:if test="normalize-space($comment_text) != ''">
3257
+ <!-- put Mathin Alternate Text -->
3258
+ <xsl:attribute name="fox:alt-text">
3259
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3260
+ </xsl:attribute>
3261
+ </xsl:if>
3262
+
3263
+ <xsl:variable name="mathml_content">
3264
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3265
+ </xsl:variable>
3266
+ <!-- put MathML in Actual Text -->
3267
+ <xsl:attribute name="fox:actual-text">
3268
+ <xsl:value-of select="$mathml_content"/>
3269
+ </xsl:attribute>
3270
+
3271
+
3168
3272
  <!-- <xsl:copy-of select="."/> -->
3169
3273
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3170
3274
  </fo:instream-foreign-object>
3171
3275
  </fo:inline>
3276
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3277
+ <!-- <xsl:text>a+b</xsl:text> -->
3278
+ <xsl:text>&lt;</xsl:text>
3279
+ <xsl:value-of select="local-name()"/>
3280
+ <xsl:if test="local-name() = 'math'">
3281
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3282
+ </xsl:if>
3283
+ <xsl:for-each select="@*">
3284
+ <xsl:text> </xsl:text>
3285
+ <xsl:value-of select="local-name()"/>
3286
+ <xsl:text>="</xsl:text>
3287
+ <xsl:value-of select="."/>
3288
+ <xsl:text>"</xsl:text>
3289
+ </xsl:for-each>
3290
+ <xsl:text>&gt;</xsl:text>
3291
+ <xsl:apply-templates mode="mathml_actual_text"/>
3292
+ <xsl:text>&lt;/</xsl:text>
3293
+ <xsl:value-of select="local-name()"/>
3294
+ <xsl:text>&gt;</xsl:text>
3295
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3296
+ <xsl:value-of select="normalize-space()"/>
3172
3297
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3173
3298
  <xsl:copy>
3174
3299
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3178,19 +3303,6 @@
3178
3303
  <!-- replace start and end spaces to non-break space -->
3179
3304
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3180
3305
  </xsl:copy>
3181
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3182
- <xsl:copy>
3183
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3184
- </xsl:copy>
3185
- <xsl:choose>
3186
- <!-- if in msub, then don't add space -->
3187
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3188
- <!-- if next char in digit, don't add space -->
3189
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3190
- <xsl:otherwise>
3191
- <mathml:mspace width="0.5ex"/>
3192
- </xsl:otherwise>
3193
- </xsl:choose>
3194
3306
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3195
3307
  <xsl:variable name="target">
3196
3308
  <xsl:choose>
@@ -3243,7 +3355,10 @@
3243
3355
  </fo:block>
3244
3356
  <xsl:apply-templates/>
3245
3357
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3246
- <fo:inline><xsl:apply-templates/></fo:inline>
3358
+ <xsl:variable name="level">
3359
+ <xsl:call-template name="getLevel"/>
3360
+ </xsl:variable>
3361
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3247
3362
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3248
3363
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3249
3364
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3278,9 +3393,10 @@
3278
3393
 
3279
3394
  </xsl:variable>
3280
3395
 
3396
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3281
3397
  <xsl:choose>
3282
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3283
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3398
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3399
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3284
3400
  </xsl:choose>
3285
3401
  <xsl:apply-templates/>
3286
3402
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3324,6 +3440,7 @@
3324
3440
 
3325
3441
 
3326
3442
 
3443
+
3327
3444
  <fo:block-container margin-left="0mm">
3328
3445
 
3329
3446
 
@@ -3423,7 +3540,10 @@
3423
3540
  </fo:block>
3424
3541
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3425
3542
  <xsl:if test="normalize-space() != ''">
3426
- <fo:inline>
3543
+ <xsl:variable name="level">
3544
+ <xsl:call-template name="getLevelTermName"/>
3545
+ </xsl:variable>
3546
+ <fo:inline role="H{$level}">
3427
3547
  <xsl:apply-templates/>
3428
3548
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3429
3549
  <xsl:text>.</xsl:text>
@@ -3496,7 +3616,24 @@
3496
3616
  </fo:instream-foreign-object>
3497
3617
  </xsl:when>
3498
3618
  <xsl:otherwise>
3499
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3619
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3620
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3621
+
3622
+ <xsl:variable name="img_src">
3623
+ <xsl:choose>
3624
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3625
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3626
+ </xsl:choose>
3627
+ </xsl:variable>
3628
+
3629
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3630
+ <xsl:if test="number($scale) &lt; 100">
3631
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3632
+ </xsl:if>
3633
+
3634
+ </xsl:if>
3635
+
3636
+ </fo:external-graphic>
3500
3637
  </xsl:otherwise>
3501
3638
  </xsl:choose>
3502
3639
 
@@ -3667,11 +3804,13 @@
3667
3804
  <xsl:attribute name="width">100%</xsl:attribute>
3668
3805
  <xsl:attribute name="content-height">100%</xsl:attribute>
3669
3806
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3807
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3808
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3670
3809
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3671
3810
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3672
3811
  <!-- effective height / width = 1.48, 1.4 - with title -->
3673
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3674
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3812
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3813
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3675
3814
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3676
3815
  </xsl:if>
3677
3816
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3688,6 +3827,23 @@
3688
3827
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3689
3828
  <xsl:value-of select="."/>
3690
3829
  </xsl:attribute>
3830
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3831
+ <xsl:copy>
3832
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3833
+ <xsl:variable name="viewbox">
3834
+ <xsl:call-template name="split">
3835
+ <xsl:with-param name="pText" select="@viewBox"/>
3836
+ <xsl:with-param name="sep" select="' '"/>
3837
+ </xsl:call-template>
3838
+ </xsl:variable>
3839
+ <xsl:attribute name="width">
3840
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3841
+ </xsl:attribute>
3842
+ <xsl:attribute name="height">
3843
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3844
+ </xsl:attribute>
3845
+ <xsl:apply-templates mode="svg_update"/>
3846
+ </xsl:copy>
3691
3847
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3692
3848
  <xsl:variable name="svg_content" select="document(@src)"/>
3693
3849
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4018,6 +4174,7 @@
4018
4174
  </xsl:when>
4019
4175
  <xsl:otherwise>
4020
4176
  <xsl:apply-templates/>
4177
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4021
4178
  </xsl:otherwise>
4022
4179
  </xsl:choose>
4023
4180
  </fo:block>
@@ -4158,14 +4315,6 @@
4158
4315
  <fo:block>
4159
4316
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4160
4317
  </fo:block>
4161
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4162
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4163
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4164
- </fo:block>
4165
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4166
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4167
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4168
- </fo:block>
4169
4318
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4170
4319
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4171
4320
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4182,6 +4331,38 @@
4182
4331
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4183
4332
  <xsl:apply-templates/>
4184
4333
  </fo:block>
4334
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4335
+ <fo:block xsl:use-attribute-sets="subject-style">
4336
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4337
+ </fo:block>
4338
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4339
+ <fo:block xsl:use-attribute-sets="subject-style">
4340
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4341
+ </fo:block>
4342
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4343
+ <fo:block xsl:use-attribute-sets="inherit-style">
4344
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4345
+ </fo:block>
4346
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4347
+ <fo:block xsl:use-attribute-sets="description-style">
4348
+ <xsl:apply-templates/>
4349
+ </fo:block>
4350
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4351
+ <fo:block xsl:use-attribute-sets="specification-style">
4352
+ <xsl:apply-templates/>
4353
+ </fo:block>
4354
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4355
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4356
+ <xsl:apply-templates/>
4357
+ </fo:block>
4358
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4359
+ <fo:block xsl:use-attribute-sets="verification-style">
4360
+ <xsl:apply-templates/>
4361
+ </fo:block>
4362
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4363
+ <fo:block xsl:use-attribute-sets="import-style">
4364
+ <xsl:apply-templates/>
4365
+ </fo:block>
4185
4366
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4186
4367
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4187
4368
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4333,7 +4514,19 @@
4333
4514
  </fo:inline>
4334
4515
  </xsl:if>
4335
4516
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4336
- <fo:inline><xsl:apply-templates/></fo:inline>
4517
+ <xsl:variable name="element">inline
4518
+
4519
+ </xsl:variable>
4520
+ <xsl:choose>
4521
+ <xsl:when test="contains($element, 'block')">
4522
+ <fo:block xsl:use-attribute-sets="example-p-style">
4523
+ <xsl:apply-templates/>
4524
+ </fo:block>
4525
+ </xsl:when>
4526
+ <xsl:otherwise>
4527
+ <fo:inline><xsl:apply-templates/></fo:inline>
4528
+ </xsl:otherwise>
4529
+ </xsl:choose>
4337
4530
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4338
4531
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4339
4532
 
@@ -4522,9 +4715,10 @@
4522
4715
 
4523
4716
 
4524
4717
  </xsl:if>
4525
-
4718
+
4719
+
4720
+
4526
4721
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4527
-
4528
4722
  <xsl:if test="normalize-space(@citeas) = ''">
4529
4723
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4530
4724
  </xsl:if>
@@ -4535,6 +4729,7 @@
4535
4729
 
4536
4730
 
4537
4731
 
4732
+
4538
4733
  </xsl:if>
4539
4734
 
4540
4735
  <xsl:apply-templates/>
@@ -4903,7 +5098,6 @@
4903
5098
  </xsl:template><xsl:template name="processBibitem">
4904
5099
 
4905
5100
 
4906
- <!-- end BIPM bibitem processing-->
4907
5101
 
4908
5102
 
4909
5103
 
@@ -5033,6 +5227,9 @@
5033
5227
  <fo:block-container border="1pt solid black" width="50%">
5034
5228
  <fo:block> </fo:block>
5035
5229
  </fo:block-container>
5230
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5231
+ <fo:inline padding-right="5mm"> </fo:inline>
5232
+ <fo:inline><xsl:apply-templates/></fo:inline>
5036
5233
  </xsl:template><xsl:template name="convertDate">
5037
5234
  <xsl:param name="date"/>
5038
5235
  <xsl:param name="format" select="'short'"/>
@@ -5264,6 +5461,26 @@
5264
5461
  <xsl:value-of select="$level"/>
5265
5462
  </xsl:otherwise>
5266
5463
  </xsl:choose>
5464
+ </xsl:template><xsl:template name="getLevelTermName">
5465
+ <xsl:choose>
5466
+ <xsl:when test="normalize-space(../@depth) != ''">
5467
+ <xsl:value-of select="../@depth"/>
5468
+ </xsl:when>
5469
+ <xsl:otherwise>
5470
+ <xsl:variable name="title_level_">
5471
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5472
+ <xsl:call-template name="getLevel"/>
5473
+ </xsl:for-each>
5474
+ </xsl:variable>
5475
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5476
+ <xsl:choose>
5477
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5478
+ <xsl:otherwise>
5479
+ <xsl:call-template name="getLevel"/>
5480
+ </xsl:otherwise>
5481
+ </xsl:choose>
5482
+ </xsl:otherwise>
5483
+ </xsl:choose>
5267
5484
  </xsl:template><xsl:template name="split">
5268
5485
  <xsl:param name="pText" select="."/>
5269
5486
  <xsl:param name="sep" select="','"/>
@@ -5361,20 +5578,40 @@
5361
5578
  </xsl:call-template>
5362
5579
  </xsl:if>
5363
5580
  </xsl:template><xsl:template name="getLocalizedString">
5364
- <xsl:param name="key"/>
5581
+ <xsl:param name="key"/>
5582
+ <xsl:param name="formatted">false</xsl:param>
5365
5583
 
5366
5584
  <xsl:variable name="curr_lang">
5367
5585
  <xsl:call-template name="getLang"/>
5368
5586
  </xsl:variable>
5369
5587
 
5370
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5588
+ <xsl:variable name="data_value">
5589
+ <xsl:choose>
5590
+ <xsl:when test="$formatted = 'true'">
5591
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5592
+ </xsl:when>
5593
+ <xsl:otherwise>
5594
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5595
+ </xsl:otherwise>
5596
+ </xsl:choose>
5597
+ </xsl:variable>
5371
5598
 
5372
5599
  <xsl:choose>
5373
- <xsl:when test="$data_value != ''">
5374
- <xsl:value-of select="$data_value"/>
5600
+ <xsl:when test="normalize-space($data_value) != ''">
5601
+ <xsl:choose>
5602
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5603
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5604
+ </xsl:choose>
5375
5605
  </xsl:when>
5376
5606
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5377
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5607
+ <xsl:choose>
5608
+ <xsl:when test="$formatted = 'true'">
5609
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5610
+ </xsl:when>
5611
+ <xsl:otherwise>
5612
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5613
+ </xsl:otherwise>
5614
+ </xsl:choose>
5378
5615
  </xsl:when>
5379
5616
  <xsl:otherwise>
5380
5617
  <xsl:variable name="key_">
@@ -5385,7 +5622,7 @@
5385
5622
  <xsl:value-of select="$key_"/>
5386
5623
  </xsl:otherwise>
5387
5624
  </xsl:choose>
5388
-
5625
+
5389
5626
  </xsl:template><xsl:template name="setTrackChangesStyles">
5390
5627
  <xsl:param name="isAdded"/>
5391
5628
  <xsl:param name="isDeleted"/>
@@ -5436,4 +5673,100 @@
5436
5673
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5437
5674
  </xsl:choose>
5438
5675
  </xsl:attribute>
5676
+ </xsl:template><xsl:template name="number-to-words">
5677
+ <xsl:param name="number"/>
5678
+ <xsl:param name="first"/>
5679
+ <xsl:if test="$number != ''">
5680
+ <xsl:variable name="words">
5681
+ <words>
5682
+ <word cardinal="1">One-</word>
5683
+ <word ordinal="1">First </word>
5684
+ <word cardinal="2">Two-</word>
5685
+ <word ordinal="2">Second </word>
5686
+ <word cardinal="3">Three-</word>
5687
+ <word ordinal="3">Third </word>
5688
+ <word cardinal="4">Four-</word>
5689
+ <word ordinal="4">Fourth </word>
5690
+ <word cardinal="5">Five-</word>
5691
+ <word ordinal="5">Fifth </word>
5692
+ <word cardinal="6">Six-</word>
5693
+ <word ordinal="6">Sixth </word>
5694
+ <word cardinal="7">Seven-</word>
5695
+ <word ordinal="7">Seventh </word>
5696
+ <word cardinal="8">Eight-</word>
5697
+ <word ordinal="8">Eighth </word>
5698
+ <word cardinal="9">Nine-</word>
5699
+ <word ordinal="9">Ninth </word>
5700
+ <word ordinal="10">Tenth </word>
5701
+ <word ordinal="11">Eleventh </word>
5702
+ <word ordinal="12">Twelfth </word>
5703
+ <word ordinal="13">Thirteenth </word>
5704
+ <word ordinal="14">Fourteenth </word>
5705
+ <word ordinal="15">Fifteenth </word>
5706
+ <word ordinal="16">Sixteenth </word>
5707
+ <word ordinal="17">Seventeenth </word>
5708
+ <word ordinal="18">Eighteenth </word>
5709
+ <word ordinal="19">Nineteenth </word>
5710
+ <word cardinal="20">Twenty-</word>
5711
+ <word ordinal="20">Twentieth </word>
5712
+ <word cardinal="30">Thirty-</word>
5713
+ <word ordinal="30">Thirtieth </word>
5714
+ <word cardinal="40">Forty-</word>
5715
+ <word ordinal="40">Fortieth </word>
5716
+ <word cardinal="50">Fifty-</word>
5717
+ <word ordinal="50">Fiftieth </word>
5718
+ <word cardinal="60">Sixty-</word>
5719
+ <word ordinal="60">Sixtieth </word>
5720
+ <word cardinal="70">Seventy-</word>
5721
+ <word ordinal="70">Seventieth </word>
5722
+ <word cardinal="80">Eighty-</word>
5723
+ <word ordinal="80">Eightieth </word>
5724
+ <word cardinal="90">Ninety-</word>
5725
+ <word ordinal="90">Ninetieth </word>
5726
+ <word cardinal="100">Hundred-</word>
5727
+ <word ordinal="100">Hundredth </word>
5728
+ </words>
5729
+ </xsl:variable>
5730
+
5731
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5732
+
5733
+ <xsl:variable name="value">
5734
+ <xsl:choose>
5735
+ <xsl:when test="$ordinal != ''">
5736
+ <xsl:value-of select="$ordinal"/>
5737
+ </xsl:when>
5738
+ <xsl:otherwise>
5739
+ <xsl:choose>
5740
+ <xsl:when test="$number &lt; 100">
5741
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5742
+ <xsl:variable name="digit" select="substring($number,2)"/>
5743
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5744
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5745
+ </xsl:when>
5746
+ <xsl:otherwise>
5747
+ <!-- more 100 -->
5748
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5749
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5750
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5751
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5752
+ <xsl:call-template name="number-to-words">
5753
+ <xsl:with-param name="number" select="$digits"/>
5754
+ </xsl:call-template>
5755
+ </xsl:otherwise>
5756
+ </xsl:choose>
5757
+ </xsl:otherwise>
5758
+ </xsl:choose>
5759
+ </xsl:variable>
5760
+ <xsl:choose>
5761
+ <xsl:when test="$first = 'true'">
5762
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5763
+ <xsl:call-template name="capitalize">
5764
+ <xsl:with-param name="str" select="$value_lc"/>
5765
+ </xsl:call-template>
5766
+ </xsl:when>
5767
+ <xsl:otherwise>
5768
+ <xsl:value-of select="$value"/>
5769
+ </xsl:otherwise>
5770
+ </xsl:choose>
5771
+ </xsl:if>
5439
5772
  </xsl:template></xsl:stylesheet>