metanorma-mpfa 0.6.5 → 0.6.9

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: 8c98ed7b1146c47d50b038240e5680d3345b63e181369ed20aa5d971162df961
4
- data.tar.gz: ff9fd29bd1dda19e35a6d70451fdcabe1b0e7ff94e9eef536f204929680206df
3
+ metadata.gz: df58e68481327baeb4b01c1fa195032891e17f26d117f92313f9047a64639006
4
+ data.tar.gz: 1fbd960a799d08b7524f8f501e2d5b446a4a3af0206afb1af904afbd0cf1f313
5
5
  SHA512:
6
- metadata.gz: 63a9e925b5aa576a8d2c55b7197dc2f6747b7cf8ceef99dbcfc633d251f5c659c037b26327103e06803900477dadee74d4b7eea2fdfc09e8179471feb785ce2c
7
- data.tar.gz: 2c4b7362d868a55775bbf52e0a42007d1ce77cea68c079ef6c8143cb656980fc5e14af3c6bd8b980d5c733ac41f7084615071a56342af5eab29648a3e2912a52
6
+ metadata.gz: 1ed204b79a90672638f89e039ae7945608841c845938d0317bf119da29029a90b6cae40c02cb3f6d09441dc40442b8c2a4d230a2da40e0d02b9543781a39afee
7
+ data.tar.gz: fad4815ccbfd1a9079e4c351b0ede966bc16ee980bde6afb7e8af52599c1cdd6761725c1a11612c5bd1e09d59c6b08603904f4eafddd38c4905b3af268bce670
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  steps:
@@ -204,6 +204,18 @@
204
204
  </zeroOrMore>
205
205
  </element>
206
206
  </define>
207
+ <define name="dt">
208
+ <element name="dt">
209
+ <optional>
210
+ <attribute name="id">
211
+ <data type="ID"/>
212
+ </attribute>
213
+ </optional>
214
+ <zeroOrMore>
215
+ <ref name="TextElement"/>
216
+ </zeroOrMore>
217
+ </element>
218
+ </define>
207
219
  <define name="example">
208
220
  <element name="example">
209
221
  <attribute name="id">
@@ -899,7 +911,7 @@
899
911
  </include>
900
912
  <!-- end overrides -->
901
913
  <define name="docsubtype">
902
- <element name="docsubtype">
914
+ <element name="subdoctype">
903
915
  <ref name="DocumentSubtype"/>
904
916
  </element>
905
917
  </define>
@@ -955,7 +967,34 @@
955
967
  <define name="concept">
956
968
  <element name="concept">
957
969
  <optional>
958
- <attribute name="term"/>
970
+ <attribute name="ital">
971
+ <data type="boolean"/>
972
+ </attribute>
973
+ </optional>
974
+ <optional>
975
+ <attribute name="ref">
976
+ <data type="boolean"/>
977
+ </attribute>
978
+ </optional>
979
+ <optional>
980
+ <element name="refterm">
981
+ <zeroOrMore>
982
+ <choice>
983
+ <ref name="PureTextElement"/>
984
+ <ref name="stem"/>
985
+ </choice>
986
+ </zeroOrMore>
987
+ </element>
988
+ </optional>
989
+ <optional>
990
+ <element name="renderterm">
991
+ <zeroOrMore>
992
+ <choice>
993
+ <ref name="PureTextElement"/>
994
+ <ref name="stem"/>
995
+ </choice>
996
+ </zeroOrMore>
997
+ </element>
959
998
  </optional>
960
999
  <choice>
961
1000
  <ref name="eref"/>
@@ -972,8 +1011,14 @@
972
1011
  <ref name="imagemap"/>
973
1012
  <ref name="svgmap"/>
974
1013
  <ref name="inputform"/>
1014
+ <ref name="toc"/>
975
1015
  </choice>
976
1016
  </define>
1017
+ <define name="toc">
1018
+ <element name="toc">
1019
+ <ref name="ul"/>
1020
+ </element>
1021
+ </define>
977
1022
  <define name="inputform">
978
1023
  <element name="form">
979
1024
  <attribute name="id">
@@ -981,6 +1026,9 @@
981
1026
  </attribute>
982
1027
  <attribute name="name"/>
983
1028
  <attribute name="action"/>
1029
+ <optional>
1030
+ <attribute name="class"/>
1031
+ </optional>
984
1032
  <zeroOrMore>
985
1033
  <choice>
986
1034
  <ref name="TextElement"/>
@@ -1212,6 +1260,12 @@
1212
1260
  <optional>
1213
1261
  <attribute name="type"/>
1214
1262
  </optional>
1263
+ <optional>
1264
+ <attribute name="identifier"/>
1265
+ </optional>
1266
+ <optional>
1267
+ <attribute name="prefix"/>
1268
+ </optional>
1215
1269
  <text/>
1216
1270
  </define>
1217
1271
  <define name="ics">
@@ -1473,26 +1527,26 @@
1473
1527
  <optional>
1474
1528
  <ref name="section-title"/>
1475
1529
  </optional>
1476
- <group>
1530
+ <choice>
1477
1531
  <choice>
1478
1532
  <group>
1479
- <zeroOrMore>
1533
+ <oneOrMore>
1480
1534
  <ref name="BasicBlock"/>
1481
- </zeroOrMore>
1535
+ </oneOrMore>
1482
1536
  <zeroOrMore>
1483
1537
  <ref name="note"/>
1484
1538
  </zeroOrMore>
1485
1539
  </group>
1486
1540
  <ref name="amend"/>
1487
1541
  </choice>
1488
- <zeroOrMore>
1542
+ <oneOrMore>
1489
1543
  <choice>
1490
1544
  <ref name="clause-subsection"/>
1491
1545
  <ref name="terms"/>
1492
1546
  <ref name="definitions"/>
1493
1547
  </choice>
1494
- </zeroOrMore>
1495
- </group>
1548
+ </oneOrMore>
1549
+ </choice>
1496
1550
  </define>
1497
1551
  <define name="Annex-Section">
1498
1552
  <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
@@ -12,8 +12,12 @@
12
12
 
13
13
 
14
14
  <xsl:variable name="debug">false</xsl:variable>
15
- <xsl:variable name="pageWidth" select="'210mm'"/>
16
- <xsl:variable name="pageHeight" select="'297mm'"/>
15
+ <xsl:variable name="pageWidth" select="210"/>
16
+ <xsl:variable name="pageHeight" select="297"/>
17
+ <xsl:variable name="marginLeftRight1" select="19"/>
18
+ <xsl:variable name="marginLeftRight2" select="19"/>
19
+ <xsl:variable name="marginTop" select="16.5"/>
20
+ <xsl:variable name="marginBottom" select="10"/>
17
21
 
18
22
  <xsl:variable name="copyrightHolder">Ribose Group Inc.</xsl:variable>
19
23
 
@@ -63,7 +67,7 @@
63
67
  <fo:layout-master-set>
64
68
 
65
69
  <!-- cover page -->
66
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
70
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
67
71
  <fo:region-body margin-top="24mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
68
72
  <fo:region-before region-name="cover-header" extent="24mm"/>
69
73
  <fo:region-after region-name="footer" extent="10mm"/>
@@ -72,19 +76,19 @@
72
76
  </fo:simple-page-master>
73
77
 
74
78
  <!-- document pages -->
75
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
76
- <fo:region-body margin-top="16.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
77
- <fo:region-before region-name="header-odd" extent="16.5mm"/>
78
- <fo:region-after region-name="footer-odd" extent="10mm"/>
79
- <fo:region-start region-name="left-region" extent="19mm"/>
80
- <fo:region-end region-name="right-region" extent="19mm"/>
79
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
80
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
81
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
82
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
83
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
84
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
81
85
  </fo:simple-page-master>
82
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
83
- <fo:region-body margin-top="16.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
84
- <fo:region-before region-name="header-even" extent="16.5mm"/>
85
- <fo:region-after region-name="footer-even" extent="10mm"/>
86
- <fo:region-start region-name="left-region" extent="19mm"/>
87
- <fo:region-end region-name="right-region" extent="19mm"/>
86
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
87
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
88
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
89
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
90
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
91
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
88
92
  </fo:simple-page-master>
89
93
 
90
94
  <fo:page-sequence-master master-name="document">
@@ -1049,6 +1053,7 @@
1049
1053
 
1050
1054
 
1051
1055
 
1056
+
1052
1057
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1053
1058
 
1054
1059
 
@@ -1058,7 +1063,9 @@
1058
1063
 
1059
1064
 
1060
1065
 
1061
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1066
+ </xsl:attribute-set><xsl:variable name="table-border_">
1067
+
1068
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1062
1069
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1063
1070
 
1064
1071
 
@@ -1100,6 +1107,7 @@
1100
1107
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1101
1108
 
1102
1109
 
1110
+
1103
1111
  <xsl:attribute name="color">blue</xsl:attribute>
1104
1112
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1105
1113
 
@@ -1301,14 +1309,15 @@
1301
1309
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1302
1310
 
1303
1311
  <!-- Normative references -->
1304
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1312
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
1305
1313
  <!-- Terms and definitions -->
1306
1314
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
1307
1315
  <!-- Another main sections -->
1308
1316
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
1309
1317
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1310
1318
  <!-- Bibliography -->
1311
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1319
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1320
+
1312
1321
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1313
1322
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1314
1323
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1351,6 +1360,8 @@
1351
1360
  <fo:block>&#xA0;</fo:block>
1352
1361
  </xsl:if> -->
1353
1362
 
1363
+
1364
+ <!-- Display table's name before table as standalone block -->
1354
1365
  <!-- $namespace = 'iso' or -->
1355
1366
 
1356
1367
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1430,6 +1441,12 @@
1430
1441
 
1431
1442
 
1432
1443
 
1444
+
1445
+
1446
+
1447
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1448
+
1449
+
1433
1450
  <xsl:variable name="table_width">
1434
1451
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1435
1452
  100%
@@ -1448,6 +1465,7 @@
1448
1465
 
1449
1466
 
1450
1467
 
1468
+
1451
1469
 
1452
1470
 
1453
1471
 
@@ -1474,6 +1492,8 @@
1474
1492
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1475
1493
  </xsl:if>
1476
1494
 
1495
+
1496
+
1477
1497
  <xsl:choose>
1478
1498
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1479
1499
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -1761,9 +1781,9 @@
1761
1781
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1762
1782
  <xsl:with-param name="continued">true</xsl:with-param>
1763
1783
  </xsl:apply-templates>
1764
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1765
- <xsl:call-template name="fn_name_display"/>
1766
- </xsl:for-each>
1784
+
1785
+
1786
+
1767
1787
 
1768
1788
  </fo:table-cell>
1769
1789
  </fo:table-row>
@@ -1845,7 +1865,11 @@
1845
1865
 
1846
1866
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1847
1867
 
1848
- <xsl:if test="$isNoteOrFnExist = 'true'">
1868
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
1869
+
1870
+ </xsl:variable>
1871
+
1872
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
1849
1873
 
1850
1874
  <xsl:variable name="cols-count">
1851
1875
  <xsl:choose>
@@ -1874,6 +1898,8 @@
1874
1898
  </xsl:choose>
1875
1899
  </xsl:for-each>
1876
1900
 
1901
+
1902
+
1877
1903
  <xsl:choose>
1878
1904
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1879
1905
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1900,6 +1926,7 @@
1900
1926
 
1901
1927
 
1902
1928
 
1929
+
1903
1930
  <!-- fn will be processed inside 'note' processing -->
1904
1931
 
1905
1932
 
@@ -1908,6 +1935,11 @@
1908
1935
 
1909
1936
 
1910
1937
 
1938
+
1939
+
1940
+ <!-- for BSI (not PAS) display Notes before footnotes -->
1941
+
1942
+
1911
1943
  <!-- except gb -->
1912
1944
 
1913
1945
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -1933,6 +1965,10 @@
1933
1965
  <!-- fn processing -->
1934
1966
  <xsl:call-template name="fn_display"/>
1935
1967
 
1968
+
1969
+ <!-- for PAS display Notes after footnotes -->
1970
+
1971
+
1936
1972
  </fo:table-cell>
1937
1973
  </fo:table-row>
1938
1974
  </fo:table-body>
@@ -1974,6 +2010,19 @@
1974
2010
 
1975
2011
  </fo:table-body>
1976
2012
 
2013
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2014
+ <xsl:choose>
2015
+ <xsl:when test="substring-after(., '—') != ''">
2016
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2017
+ </xsl:when>
2018
+ <xsl:otherwise>
2019
+ <xsl:value-of select="."/>
2020
+ </xsl:otherwise>
2021
+ </xsl:choose>
2022
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2023
+ <xsl:apply-templates mode="presentation_name"/>
2024
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2025
+ <xsl:apply-templates select="."/>
1977
2026
  </xsl:template><xsl:template match="*[local-name()='tr']">
1978
2027
  <xsl:variable name="parent-name" select="local-name(..)"/>
1979
2028
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -1986,10 +2035,13 @@
1986
2035
 
1987
2036
 
1988
2037
 
2038
+
2039
+
1989
2040
  </xsl:if>
1990
2041
  <xsl:if test="$parent-name = 'tfoot'">
1991
2042
 
1992
2043
 
2044
+
1993
2045
  </xsl:if>
1994
2046
 
1995
2047
 
@@ -1999,6 +2051,8 @@
1999
2051
 
2000
2052
 
2001
2053
 
2054
+
2055
+
2002
2056
  <!-- <xsl:if test="$namespace = 'bipm'">
2003
2057
  <xsl:attribute name="height">8mm</xsl:attribute>
2004
2058
  </xsl:if> -->
@@ -2090,6 +2144,7 @@
2090
2144
 
2091
2145
 
2092
2146
 
2147
+
2093
2148
  <xsl:if test=".//*[local-name() = 'table']">
2094
2149
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2095
2150
  </xsl:if>
@@ -2119,8 +2174,14 @@
2119
2174
 
2120
2175
 
2121
2176
 
2177
+
2178
+
2179
+ <!-- Table's note name (NOTE, for example) -->
2180
+
2122
2181
  <fo:inline padding-right="2mm">
2123
2182
 
2183
+
2184
+
2124
2185
 
2125
2186
 
2126
2187
 
@@ -2128,6 +2189,8 @@
2128
2189
 
2129
2190
  </fo:inline>
2130
2191
 
2192
+
2193
+
2131
2194
  <xsl:apply-templates mode="process"/>
2132
2195
  </fo:block>
2133
2196
 
@@ -2135,18 +2198,18 @@
2135
2198
  <xsl:apply-templates/>
2136
2199
  </xsl:template><xsl:template name="fn_display">
2137
2200
  <xsl:variable name="references">
2201
+
2138
2202
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2139
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2140
-
2141
-
2142
- <xsl:apply-templates/>
2143
- </fn>
2203
+ <xsl:call-template name="create_fn"/>
2144
2204
  </xsl:for-each>
2145
2205
  </xsl:variable>
2206
+
2146
2207
  <xsl:for-each select="xalan:nodeset($references)//fn">
2147
2208
  <xsl:variable name="reference" select="@reference"/>
2148
2209
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2149
2210
  <fo:block margin-bottom="12pt">
2211
+
2212
+
2150
2213
 
2151
2214
 
2152
2215
 
@@ -2160,9 +2223,11 @@
2160
2223
 
2161
2224
 
2162
2225
 
2226
+
2163
2227
  <xsl:value-of select="@reference"/>
2164
2228
 
2165
2229
 
2230
+
2166
2231
  </fo:inline>
2167
2232
  <fo:inline>
2168
2233
 
@@ -2172,6 +2237,12 @@
2172
2237
  </fo:block>
2173
2238
  </xsl:if>
2174
2239
  </xsl:for-each>
2240
+ </xsl:template><xsl:template name="create_fn">
2241
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2242
+
2243
+
2244
+ <xsl:apply-templates/>
2245
+ </fn>
2175
2246
  </xsl:template><xsl:template name="fn_name_display">
2176
2247
  <!-- <xsl:variable name="references">
2177
2248
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2304,11 +2375,15 @@
2304
2375
 
2305
2376
 
2306
2377
 
2378
+
2379
+
2380
+
2307
2381
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2308
2382
 
2309
2383
 
2310
2384
  <xsl:value-of select="@reference"/>
2311
2385
 
2386
+
2312
2387
  </fo:basic-link>
2313
2388
  </fo:inline>
2314
2389
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3166,19 +3241,6 @@
3166
3241
  <!-- replace start and end spaces to non-break space -->
3167
3242
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3168
3243
  </xsl:copy>
3169
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3170
- <xsl:copy>
3171
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3172
- </xsl:copy>
3173
- <xsl:choose>
3174
- <!-- if in msub, then don't add space -->
3175
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3176
- <!-- if next char in digit, don't add space -->
3177
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3178
- <xsl:otherwise>
3179
- <mathml:mspace width="0.5ex"/>
3180
- </xsl:otherwise>
3181
- </xsl:choose>
3182
3244
  </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">
3183
3245
  <xsl:variable name="target">
3184
3246
  <xsl:choose>
@@ -3203,6 +3265,7 @@
3203
3265
  <fo:inline xsl:use-attribute-sets="link-style">
3204
3266
 
3205
3267
 
3268
+
3206
3269
  <xsl:choose>
3207
3270
  <xsl:when test="$target_text = ''">
3208
3271
  <xsl:apply-templates/>
@@ -3311,6 +3374,7 @@
3311
3374
 
3312
3375
 
3313
3376
 
3377
+
3314
3378
  <fo:block-container margin-left="0mm">
3315
3379
 
3316
3380
 
@@ -3483,7 +3547,24 @@
3483
3547
  </fo:instream-foreign-object>
3484
3548
  </xsl:when>
3485
3549
  <xsl:otherwise>
3486
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3550
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3551
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3552
+
3553
+ <xsl:variable name="img_src">
3554
+ <xsl:choose>
3555
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3556
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3557
+ </xsl:choose>
3558
+ </xsl:variable>
3559
+
3560
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3561
+ <xsl:if test="number($scale) &lt; 100">
3562
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3563
+ </xsl:if>
3564
+
3565
+ </xsl:if>
3566
+
3567
+ </fo:external-graphic>
3487
3568
  </xsl:otherwise>
3488
3569
  </xsl:choose>
3489
3570
 
@@ -3551,6 +3632,253 @@
3551
3632
  <xsl:param name="height"/>
3552
3633
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3553
3634
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3635
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
3636
+ <xsl:param name="name"/>
3637
+
3638
+ <xsl:variable name="svg_content">
3639
+ <xsl:apply-templates select="." mode="svg_update"/>
3640
+ </xsl:variable>
3641
+
3642
+ <xsl:variable name="alt-text">
3643
+ <xsl:choose>
3644
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3645
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3646
+ </xsl:when>
3647
+ <xsl:when test="normalize-space($name) != ''">
3648
+ <xsl:value-of select="$name"/>
3649
+ </xsl:when>
3650
+ <xsl:otherwise>Figure</xsl:otherwise>
3651
+ </xsl:choose>
3652
+ </xsl:variable>
3653
+
3654
+ <xsl:choose>
3655
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3656
+ <fo:block>
3657
+ <xsl:variable name="width" select="@width"/>
3658
+ <xsl:variable name="height" select="@height"/>
3659
+
3660
+ <xsl:variable name="scale_x">
3661
+ <xsl:choose>
3662
+ <xsl:when test="$width &gt; $width_effective_px">
3663
+ <xsl:value-of select="$width_effective_px div $width"/>
3664
+ </xsl:when>
3665
+ <xsl:otherwise>1</xsl:otherwise>
3666
+ </xsl:choose>
3667
+ </xsl:variable>
3668
+
3669
+ <xsl:variable name="scale_y">
3670
+ <xsl:choose>
3671
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3672
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3673
+ </xsl:when>
3674
+ <xsl:otherwise>1</xsl:otherwise>
3675
+ </xsl:choose>
3676
+ </xsl:variable>
3677
+
3678
+ <xsl:variable name="scale">
3679
+ <xsl:choose>
3680
+ <xsl:when test="$scale_y != 1">
3681
+ <xsl:value-of select="$scale_x * $scale_y"/>
3682
+ </xsl:when>
3683
+ <xsl:otherwise>
3684
+ <xsl:value-of select="$scale_x"/>
3685
+ </xsl:otherwise>
3686
+ </xsl:choose>
3687
+ </xsl:variable>
3688
+
3689
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3690
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3691
+
3692
+ <fo:table table-layout="fixed" width="100%">
3693
+ <fo:table-column column-width="proportional-column-width(1)"/>
3694
+ <fo:table-column column-width="{$width_scale}px"/>
3695
+ <fo:table-column column-width="proportional-column-width(1)"/>
3696
+ <fo:table-body>
3697
+ <fo:table-row>
3698
+ <fo:table-cell column-number="2">
3699
+ <fo:block>
3700
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3701
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3702
+ <fo:block line-height="0" font-size="0">
3703
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3704
+ <xsl:call-template name="bookmark"/>
3705
+ </xsl:for-each>
3706
+ </fo:block>
3707
+ </xsl:if>
3708
+ <fo:block text-depth="0" line-height="0" font-size="0">
3709
+
3710
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3711
+ <xsl:attribute name="width">100%</xsl:attribute>
3712
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3713
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3714
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3715
+
3716
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3717
+ </fo:instream-foreign-object>
3718
+ </fo:block>
3719
+
3720
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
3721
+ <xsl:with-param name="scale" select="$scale"/>
3722
+ </xsl:apply-templates>
3723
+ </fo:block-container>
3724
+ </fo:block>
3725
+ </fo:table-cell>
3726
+ </fo:table-row>
3727
+ </fo:table-body>
3728
+ </fo:table>
3729
+ </fo:block>
3730
+
3731
+ </xsl:when>
3732
+ <xsl:otherwise>
3733
+ <fo:block xsl:use-attribute-sets="image-style">
3734
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3735
+ <xsl:attribute name="width">100%</xsl:attribute>
3736
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3737
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3738
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3739
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3740
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3741
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3742
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3743
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3744
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3745
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3746
+ </xsl:if>
3747
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3748
+ <xsl:copy-of select="$svg_content"/>
3749
+ </fo:instream-foreign-object>
3750
+ </fo:block>
3751
+ </xsl:otherwise>
3752
+ </xsl:choose>
3753
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3754
+ <xsl:copy>
3755
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3756
+ </xsl:copy>
3757
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3758
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3759
+ <xsl:value-of select="."/>
3760
+ </xsl:attribute>
3761
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3762
+ <xsl:copy>
3763
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3764
+ <xsl:variable name="viewbox">
3765
+ <xsl:call-template name="split">
3766
+ <xsl:with-param name="pText" select="@viewBox"/>
3767
+ <xsl:with-param name="sep" select="' '"/>
3768
+ </xsl:call-template>
3769
+ </xsl:variable>
3770
+ <xsl:attribute name="width">
3771
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3772
+ </xsl:attribute>
3773
+ <xsl:attribute name="height">
3774
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3775
+ </xsl:attribute>
3776
+ <xsl:apply-templates mode="svg_update"/>
3777
+ </xsl:copy>
3778
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3779
+ <xsl:variable name="svg_content" select="document(@src)"/>
3780
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3781
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3782
+ <xsl:call-template name="image_svg">
3783
+ <xsl:with-param name="name" select="$name"/>
3784
+ </xsl:call-template>
3785
+ </xsl:for-each>
3786
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3787
+ <xsl:copy>
3788
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3789
+ </xsl:copy>
3790
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3791
+ <xsl:apply-templates mode="svg_remove_a"/>
3792
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3793
+ <xsl:param name="scale"/>
3794
+ <xsl:variable name="dest">
3795
+ <xsl:choose>
3796
+ <xsl:when test="starts-with(@href, '#')">
3797
+ <xsl:value-of select="substring-after(@href, '#')"/>
3798
+ </xsl:when>
3799
+ <xsl:otherwise>
3800
+ <xsl:value-of select="@href"/>
3801
+ </xsl:otherwise>
3802
+ </xsl:choose>
3803
+ </xsl:variable>
3804
+ <xsl:for-each select="./*[local-name() = 'rect']">
3805
+ <xsl:call-template name="insertSVGMapLink">
3806
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3807
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3808
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3809
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3810
+ <xsl:with-param name="dest" select="$dest"/>
3811
+ </xsl:call-template>
3812
+ </xsl:for-each>
3813
+
3814
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3815
+ <xsl:variable name="points">
3816
+ <xsl:call-template name="split">
3817
+ <xsl:with-param name="pText" select="@points"/>
3818
+ </xsl:call-template>
3819
+ </xsl:variable>
3820
+ <xsl:variable name="x_coords">
3821
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3822
+ <xsl:sort select="." data-type="number"/>
3823
+ <x><xsl:value-of select="."/></x>
3824
+ </xsl:for-each>
3825
+ </xsl:variable>
3826
+ <xsl:variable name="y_coords">
3827
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3828
+ <xsl:sort select="." data-type="number"/>
3829
+ <y><xsl:value-of select="."/></y>
3830
+ </xsl:for-each>
3831
+ </xsl:variable>
3832
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3833
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3834
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3835
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3836
+ <xsl:call-template name="insertSVGMapLink">
3837
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3838
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3839
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3840
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3841
+ <xsl:with-param name="dest" select="$dest"/>
3842
+ </xsl:call-template>
3843
+ </xsl:for-each>
3844
+
3845
+ <xsl:for-each select="./*[local-name() = 'circle']">
3846
+ <xsl:call-template name="insertSVGMapLink">
3847
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3848
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3849
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3850
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3851
+ <xsl:with-param name="dest" select="$dest"/>
3852
+ </xsl:call-template>
3853
+ </xsl:for-each>
3854
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3855
+ <xsl:call-template name="insertSVGMapLink">
3856
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3857
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3858
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3859
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3860
+ <xsl:with-param name="dest" select="$dest"/>
3861
+ </xsl:call-template>
3862
+ </xsl:for-each>
3863
+ </xsl:template><xsl:template name="insertSVGMapLink">
3864
+ <xsl:param name="left"/>
3865
+ <xsl:param name="top"/>
3866
+ <xsl:param name="width"/>
3867
+ <xsl:param name="height"/>
3868
+ <xsl:param name="dest"/>
3869
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3870
+ <fo:block font-size="1pt">
3871
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3872
+ <fo:inline-container inline-progression-dimension="100%">
3873
+ <fo:block-container height="{$height - 1}px" width="100%">
3874
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3875
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3876
+ </xsl:if> -->
3877
+ <fo:block> </fo:block></fo:block-container>
3878
+ </fo:inline-container>
3879
+ </fo:basic-link>
3880
+ </fo:block>
3881
+ </fo:block-container>
3554
3882
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3555
3883
  <xsl:apply-templates mode="contents"/>
3556
3884
  <xsl:text> </xsl:text>
@@ -3579,28 +3907,39 @@
3579
3907
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3580
3908
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3581
3909
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3910
+ <xsl:if test="@bundle = 'true'">
3911
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3912
+ </xsl:if>
3582
3913
  <fo:bookmark-title>
3583
- <xsl:variable name="bookmark-title_">
3584
- <xsl:call-template name="getLangVersion">
3585
- <xsl:with-param name="lang" select="@lang"/>
3586
- <xsl:with-param name="doctype" select="@doctype"/>
3587
- <xsl:with-param name="title" select="@title-part"/>
3588
- </xsl:call-template>
3589
- </xsl:variable>
3590
3914
  <xsl:choose>
3591
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3592
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3593
- </xsl:when>
3594
- <xsl:otherwise>
3915
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3916
+ <xsl:variable name="bookmark-title_">
3917
+ <xsl:call-template name="getLangVersion">
3918
+ <xsl:with-param name="lang" select="@lang"/>
3919
+ <xsl:with-param name="doctype" select="@doctype"/>
3920
+ <xsl:with-param name="title" select="@title-part"/>
3921
+ </xsl:call-template>
3922
+ </xsl:variable>
3595
3923
  <xsl:choose>
3596
- <xsl:when test="@lang = 'en'">English</xsl:when>
3597
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3598
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3599
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3924
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3925
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3926
+ </xsl:when>
3927
+ <xsl:otherwise>
3928
+ <xsl:choose>
3929
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3930
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3931
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3932
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3933
+ </xsl:choose>
3934
+ </xsl:otherwise>
3600
3935
  </xsl:choose>
3936
+ </xsl:when>
3937
+ <xsl:otherwise>
3938
+ <xsl:value-of select="@title-part"/>
3601
3939
  </xsl:otherwise>
3602
3940
  </xsl:choose>
3603
3941
  </fo:bookmark-title>
3942
+
3604
3943
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3605
3944
 
3606
3945
  <xsl:call-template name="insertFigureBookmarks">
@@ -3699,16 +4038,23 @@
3699
4038
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3700
4039
  </xsl:choose>
3701
4040
  </xsl:template><xsl:template match="item" mode="bookmark">
3702
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3703
- <fo:bookmark-title>
3704
- <xsl:if test="@section != ''">
3705
- <xsl:value-of select="@section"/>
3706
- <xsl:text> </xsl:text>
3707
- </xsl:if>
3708
- <xsl:value-of select="normalize-space(title)"/>
3709
- </fo:bookmark-title>
3710
- <xsl:apply-templates mode="bookmark"/>
3711
- </fo:bookmark>
4041
+ <xsl:choose>
4042
+ <xsl:when test="@id != ''">
4043
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4044
+ <fo:bookmark-title>
4045
+ <xsl:if test="@section != ''">
4046
+ <xsl:value-of select="@section"/>
4047
+ <xsl:text> </xsl:text>
4048
+ </xsl:if>
4049
+ <xsl:value-of select="normalize-space(title)"/>
4050
+ </fo:bookmark-title>
4051
+ <xsl:apply-templates mode="bookmark"/>
4052
+ </fo:bookmark>
4053
+ </xsl:when>
4054
+ <xsl:otherwise>
4055
+ <xsl:apply-templates mode="bookmark"/>
4056
+ </xsl:otherwise>
4057
+ </xsl:choose>
3712
4058
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3713
4059
  <xsl:if test="normalize-space() != ''">
3714
4060
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4074,7 +4420,19 @@
4074
4420
  </fo:inline>
4075
4421
  </xsl:if>
4076
4422
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4077
- <fo:inline><xsl:apply-templates/></fo:inline>
4423
+ <xsl:variable name="element">inline
4424
+
4425
+ </xsl:variable>
4426
+ <xsl:choose>
4427
+ <xsl:when test="contains($element, 'block')">
4428
+ <fo:block xsl:use-attribute-sets="example-p-style">
4429
+ <xsl:apply-templates/>
4430
+ </fo:block>
4431
+ </xsl:when>
4432
+ <xsl:otherwise>
4433
+ <fo:inline><xsl:apply-templates/></fo:inline>
4434
+ </xsl:otherwise>
4435
+ </xsl:choose>
4078
4436
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4079
4437
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4080
4438
 
@@ -4263,7 +4621,9 @@
4263
4621
 
4264
4622
 
4265
4623
  </xsl:if>
4266
-
4624
+
4625
+
4626
+
4267
4627
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4268
4628
  <xsl:if test="normalize-space(@citeas) = ''">
4269
4629
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4275,6 +4635,7 @@
4275
4635
 
4276
4636
 
4277
4637
 
4638
+
4278
4639
  </xsl:if>
4279
4640
 
4280
4641
  <xsl:apply-templates/>
@@ -4643,7 +5004,6 @@
4643
5004
  </xsl:template><xsl:template name="processBibitem">
4644
5005
 
4645
5006
 
4646
- <!-- end BIPM bibitem processing-->
4647
5007
 
4648
5008
 
4649
5009
 
@@ -5101,20 +5461,40 @@
5101
5461
  </xsl:call-template>
5102
5462
  </xsl:if>
5103
5463
  </xsl:template><xsl:template name="getLocalizedString">
5104
- <xsl:param name="key"/>
5464
+ <xsl:param name="key"/>
5465
+ <xsl:param name="formatted">false</xsl:param>
5105
5466
 
5106
5467
  <xsl:variable name="curr_lang">
5107
5468
  <xsl:call-template name="getLang"/>
5108
5469
  </xsl:variable>
5109
5470
 
5110
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5471
+ <xsl:variable name="data_value">
5472
+ <xsl:choose>
5473
+ <xsl:when test="$formatted = 'true'">
5474
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5475
+ </xsl:when>
5476
+ <xsl:otherwise>
5477
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5478
+ </xsl:otherwise>
5479
+ </xsl:choose>
5480
+ </xsl:variable>
5111
5481
 
5112
5482
  <xsl:choose>
5113
- <xsl:when test="$data_value != ''">
5114
- <xsl:value-of select="$data_value"/>
5483
+ <xsl:when test="normalize-space($data_value) != ''">
5484
+ <xsl:choose>
5485
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5486
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5487
+ </xsl:choose>
5115
5488
  </xsl:when>
5116
5489
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5117
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5490
+ <xsl:choose>
5491
+ <xsl:when test="$formatted = 'true'">
5492
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5493
+ </xsl:when>
5494
+ <xsl:otherwise>
5495
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5496
+ </xsl:otherwise>
5497
+ </xsl:choose>
5118
5498
  </xsl:when>
5119
5499
  <xsl:otherwise>
5120
5500
  <xsl:variable name="key_">
@@ -5125,7 +5505,7 @@
5125
5505
  <xsl:value-of select="$key_"/>
5126
5506
  </xsl:otherwise>
5127
5507
  </xsl:choose>
5128
-
5508
+
5129
5509
  </xsl:template><xsl:template name="setTrackChangesStyles">
5130
5510
  <xsl:param name="isAdded"/>
5131
5511
  <xsl:param name="isDeleted"/>
@@ -5176,4 +5556,100 @@
5176
5556
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5177
5557
  </xsl:choose>
5178
5558
  </xsl:attribute>
5559
+ </xsl:template><xsl:template name="number-to-words">
5560
+ <xsl:param name="number"/>
5561
+ <xsl:param name="first"/>
5562
+ <xsl:if test="$number != ''">
5563
+ <xsl:variable name="words">
5564
+ <words>
5565
+ <word cardinal="1">One-</word>
5566
+ <word ordinal="1">First </word>
5567
+ <word cardinal="2">Two-</word>
5568
+ <word ordinal="2">Second </word>
5569
+ <word cardinal="3">Three-</word>
5570
+ <word ordinal="3">Third </word>
5571
+ <word cardinal="4">Four-</word>
5572
+ <word ordinal="4">Fourth </word>
5573
+ <word cardinal="5">Five-</word>
5574
+ <word ordinal="5">Fifth </word>
5575
+ <word cardinal="6">Six-</word>
5576
+ <word ordinal="6">Sixth </word>
5577
+ <word cardinal="7">Seven-</word>
5578
+ <word ordinal="7">Seventh </word>
5579
+ <word cardinal="8">Eight-</word>
5580
+ <word ordinal="8">Eighth </word>
5581
+ <word cardinal="9">Nine-</word>
5582
+ <word ordinal="9">Ninth </word>
5583
+ <word ordinal="10">Tenth </word>
5584
+ <word ordinal="11">Eleventh </word>
5585
+ <word ordinal="12">Twelfth </word>
5586
+ <word ordinal="13">Thirteenth </word>
5587
+ <word ordinal="14">Fourteenth </word>
5588
+ <word ordinal="15">Fifteenth </word>
5589
+ <word ordinal="16">Sixteenth </word>
5590
+ <word ordinal="17">Seventeenth </word>
5591
+ <word ordinal="18">Eighteenth </word>
5592
+ <word ordinal="19">Nineteenth </word>
5593
+ <word cardinal="20">Twenty-</word>
5594
+ <word ordinal="20">Twentieth </word>
5595
+ <word cardinal="30">Thirty-</word>
5596
+ <word ordinal="30">Thirtieth </word>
5597
+ <word cardinal="40">Forty-</word>
5598
+ <word ordinal="40">Fortieth </word>
5599
+ <word cardinal="50">Fifty-</word>
5600
+ <word ordinal="50">Fiftieth </word>
5601
+ <word cardinal="60">Sixty-</word>
5602
+ <word ordinal="60">Sixtieth </word>
5603
+ <word cardinal="70">Seventy-</word>
5604
+ <word ordinal="70">Seventieth </word>
5605
+ <word cardinal="80">Eighty-</word>
5606
+ <word ordinal="80">Eightieth </word>
5607
+ <word cardinal="90">Ninety-</word>
5608
+ <word ordinal="90">Ninetieth </word>
5609
+ <word cardinal="100">Hundred-</word>
5610
+ <word ordinal="100">Hundredth </word>
5611
+ </words>
5612
+ </xsl:variable>
5613
+
5614
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5615
+
5616
+ <xsl:variable name="value">
5617
+ <xsl:choose>
5618
+ <xsl:when test="$ordinal != ''">
5619
+ <xsl:value-of select="$ordinal"/>
5620
+ </xsl:when>
5621
+ <xsl:otherwise>
5622
+ <xsl:choose>
5623
+ <xsl:when test="$number &lt; 100">
5624
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5625
+ <xsl:variable name="digit" select="substring($number,2)"/>
5626
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5627
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5628
+ </xsl:when>
5629
+ <xsl:otherwise>
5630
+ <!-- more 100 -->
5631
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5632
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5633
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5634
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5635
+ <xsl:call-template name="number-to-words">
5636
+ <xsl:with-param name="number" select="$digits"/>
5637
+ </xsl:call-template>
5638
+ </xsl:otherwise>
5639
+ </xsl:choose>
5640
+ </xsl:otherwise>
5641
+ </xsl:choose>
5642
+ </xsl:variable>
5643
+ <xsl:choose>
5644
+ <xsl:when test="$first = 'true'">
5645
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5646
+ <xsl:call-template name="capitalize">
5647
+ <xsl:with-param name="str" select="$value_lc"/>
5648
+ </xsl:call-template>
5649
+ </xsl:when>
5650
+ <xsl:otherwise>
5651
+ <xsl:value-of select="$value"/>
5652
+ </xsl:otherwise>
5653
+ </xsl:choose>
5654
+ </xsl:if>
5179
5655
  </xsl:template></xsl:stylesheet>