metanorma-un 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: 24fe47575535e25483251e6ed1b2f278df382c1fe7878560b986a0bf9220eb9b
4
- data.tar.gz: 2ed7c0507c32d4733ffe26f91a8b9f1f4a019105d5dbd61c3edc1f8fbd7eccc0
3
+ metadata.gz: bebff59ec3ff854c555b92c957234f6741e6bf178b8b88f849a9a1984eee4bf0
4
+ data.tar.gz: e1c6234c1e97e715eb0162a12af1671aa095bec3ea184641c09e0ed27e80bfb9
5
5
  SHA512:
6
- metadata.gz: 2503fe478117ca61d6cf544b59fdacabfa136e8e72faa5cec74867323daa883156f3564579714bb62b8c960580fb419d16f97aa4ab68e998329fd1518e0c8b28
7
- data.tar.gz: 19b1cda0b57151e0b5c51b8780f72de396e581947450bf7f8b39118d240e3b9d92438139a758e7f14fe4bf843a175ed59f3c536ec179e7ded65c959806a8e3b3
6
+ metadata.gz: 9845dc890c962b26f7f28a73cd8acddc2631b2656f9cbd66ff23715b7b5077087838f7948c23b770c6006f001f49c71097fde08def137e725437fa3ca9f73bb1
7
+ data.tar.gz: c80f23d647165a1c4ad89bc7f7efed18f4c484ccbf495a9ef0a4a3a53bde0d68c241cb877c6ee093995987b90effeaab8ab3d7029c23aaea71a670bac2fb2d50
@@ -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>
@@ -11,8 +11,12 @@
11
11
 
12
12
 
13
13
 
14
- <xsl:variable name="pageWidth" select="'210mm'"/>
15
- <xsl:variable name="pageHeight" select="'297mm'"/>
14
+ <xsl:variable name="pageWidth" select="210"/>
15
+ <xsl:variable name="pageHeight" select="297"/>
16
+ <xsl:variable name="marginLeftRight1" select="40"/>
17
+ <xsl:variable name="marginLeftRight2" select="40"/>
18
+ <xsl:variable name="marginTop" select="30"/>
19
+ <xsl:variable name="marginBottom" select="40"/>
16
20
 
17
21
  <xsl:variable name="debug">false</xsl:variable>
18
22
 
@@ -42,7 +46,7 @@
42
46
  <fo:root font-family="Times New Roman, STIX Two Math, Source Han Sans" font-size="10pt" xml:lang="{$lang}">
43
47
  <fo:layout-master-set>
44
48
  <!-- Cover page -->
45
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
49
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
46
50
  <fo:region-body margin-top="17.5mm" margin-bottom="10mm" margin-left="20mm" margin-right="20mm"/>
47
51
  <fo:region-before extent="17.5mm"/>
48
52
  <fo:region-after extent="10mm"/>
@@ -51,20 +55,20 @@
51
55
  </fo:simple-page-master>
52
56
 
53
57
  <!-- Document odd pages -->
54
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
55
- <fo:region-body margin-top="30mm" margin-bottom="40mm" margin-left="40mm" margin-right="40mm"/>
58
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
59
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
56
60
  <fo:region-before region-name="header-odd" extent="26mm"/>
57
- <fo:region-after region-name="footer-odd" extent="40mm"/>
58
- <fo:region-start region-name="left-region" extent="40mm"/>
59
- <fo:region-end region-name="right-region" extent="40mm"/>
61
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
62
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
63
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
60
64
  </fo:simple-page-master>
61
65
  <!-- Document even pages -->
62
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
63
- <fo:region-body margin-top="30mm" margin-bottom="40mm" margin-left="40mm" margin-right="40mm"/>
66
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
67
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
64
68
  <fo:region-before region-name="header-even" extent="26mm"/>
65
- <fo:region-after region-name="footer-even" extent="40mm"/>
66
- <fo:region-start region-name="left-region" extent="40mm"/>
67
- <fo:region-end region-name="right-region" extent="40mm"/>
69
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
70
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
71
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
68
72
  </fo:simple-page-master>
69
73
  <fo:page-sequence-master master-name="document">
70
74
  <fo:repeatable-page-master-alternatives>
@@ -1069,103 +1073,6 @@
1069
1073
  </xsl:template>
1070
1074
 
1071
1075
 
1072
- <xsl:template name="number-to-words">
1073
- <xsl:param name="number"/>
1074
- <xsl:param name="first"/>
1075
- <xsl:if test="$number != ''">
1076
- <xsl:variable name="words">
1077
- <words>
1078
- <word cardinal="1">one-</word>
1079
- <word ordinal="1">first </word>
1080
- <word cardinal="2">two-</word>
1081
- <word ordinal="2">second </word>
1082
- <word cardinal="3">three-</word>
1083
- <word ordinal="3">third </word>
1084
- <word cardinal="4">four-</word>
1085
- <word ordinal="4">fourth </word>
1086
- <word cardinal="5">five-</word>
1087
- <word ordinal="5">fifth </word>
1088
- <word cardinal="6">six-</word>
1089
- <word ordinal="6">sixth </word>
1090
- <word cardinal="7">seven-</word>
1091
- <word ordinal="7">seventh </word>
1092
- <word cardinal="8">eight-</word>
1093
- <word ordinal="8">eighth </word>
1094
- <word cardinal="9">nine-</word>
1095
- <word ordinal="9">ninth </word>
1096
- <word ordinal="10">tenth </word>
1097
- <word ordinal="11">eleventh </word>
1098
- <word ordinal="12">twelfth </word>
1099
- <word ordinal="13">thirteenth </word>
1100
- <word ordinal="14">fourteenth </word>
1101
- <word ordinal="15">fifteenth </word>
1102
- <word ordinal="16">sixteenth </word>
1103
- <word ordinal="17">seventeenth </word>
1104
- <word ordinal="18">eighteenth </word>
1105
- <word ordinal="19">nineteenth </word>
1106
- <word cardinal="20">twenty-</word>
1107
- <word ordinal="20">twentieth </word>
1108
- <word cardinal="30">thirty-</word>
1109
- <word ordinal="30">thirtieth </word>
1110
- <word cardinal="40">forty-</word>
1111
- <word ordinal="40">fortieth </word>
1112
- <word cardinal="50">fifty-</word>
1113
- <word ordinal="50">fiftieth </word>
1114
- <word cardinal="60">sixty-</word>
1115
- <word ordinal="60">sixtieth </word>
1116
- <word cardinal="70">seventy-</word>
1117
- <word ordinal="70">seventieth </word>
1118
- <word cardinal="80">eighty-</word>
1119
- <word ordinal="80">eightieth </word>
1120
- <word cardinal="90">ninety-</word>
1121
- <word ordinal="90">ninetieth </word>
1122
- <word cardinal="100">hundred-</word>
1123
- <word ordinal="100">hundredth </word>
1124
- </words>
1125
- </xsl:variable>
1126
-
1127
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
1128
-
1129
- <xsl:variable name="value">
1130
- <xsl:choose>
1131
- <xsl:when test="$ordinal != ''">
1132
- <xsl:value-of select="$ordinal"/>
1133
- </xsl:when>
1134
- <xsl:otherwise>
1135
- <xsl:choose>
1136
- <xsl:when test="$number &lt; 100">
1137
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
1138
- <xsl:variable name="digit" select="substring($number,2)"/>
1139
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
1140
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
1141
- </xsl:when>
1142
- <xsl:otherwise>
1143
- <!-- more 100 -->
1144
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
1145
- <xsl:variable name="digits" select="number(substring($number,2))"/>
1146
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
1147
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
1148
- <xsl:call-template name="number-to-words">
1149
- <xsl:with-param name="number" select="$digits"/>
1150
- </xsl:call-template>
1151
- </xsl:otherwise>
1152
- </xsl:choose>
1153
- </xsl:otherwise>
1154
- </xsl:choose>
1155
- </xsl:variable>
1156
- <xsl:choose>
1157
- <xsl:when test="$first = 'true'">
1158
- <xsl:call-template name="capitalize">
1159
- <xsl:with-param name="str" select="$value"/>
1160
- </xsl:call-template>
1161
- </xsl:when>
1162
- <xsl:otherwise>
1163
- <xsl:value-of select="$value"/>
1164
- </xsl:otherwise>
1165
- </xsl:choose>
1166
- </xsl:if>
1167
- </xsl:template>
1168
-
1169
1076
  <!-- convert YYYY-MM-DD to (Month YYYY) -->
1170
1077
  <xsl:template name="formatDate">
1171
1078
  <xsl:param name="date"/>
@@ -1369,7 +1276,7 @@
1369
1276
 
1370
1277
 
1371
1278
 
1372
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1279
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1373
1280
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1374
1281
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1375
1282
 
@@ -1458,6 +1365,7 @@
1458
1365
 
1459
1366
 
1460
1367
 
1368
+
1461
1369
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1462
1370
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1463
1371
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1472,7 +1380,9 @@
1472
1380
 
1473
1381
 
1474
1382
 
1475
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1383
+ </xsl:attribute-set><xsl:variable name="table-border_">
1384
+
1385
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1476
1386
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1477
1387
 
1478
1388
 
@@ -1516,6 +1426,7 @@
1516
1426
 
1517
1427
 
1518
1428
 
1429
+
1519
1430
  <xsl:attribute name="color">blue</xsl:attribute>
1520
1431
 
1521
1432
 
@@ -1720,14 +1631,15 @@
1720
1631
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1721
1632
 
1722
1633
  <!-- Normative references -->
1723
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1634
+ <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"/>
1724
1635
  <!-- Terms and definitions -->
1725
1636
  <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"/>
1726
1637
  <!-- Another main sections -->
1727
1638
  <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"/>
1728
1639
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1729
1640
  <!-- Bibliography -->
1730
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1641
+ <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"/>
1642
+
1731
1643
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1732
1644
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1733
1645
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1770,6 +1682,8 @@
1770
1682
  <fo:block>&#xA0;</fo:block>
1771
1683
  </xsl:if> -->
1772
1684
 
1685
+
1686
+ <!-- Display table's name before table as standalone block -->
1773
1687
  <!-- $namespace = 'iso' or -->
1774
1688
 
1775
1689
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1848,6 +1762,12 @@
1848
1762
 
1849
1763
 
1850
1764
 
1765
+
1766
+
1767
+
1768
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1769
+
1770
+
1851
1771
  <xsl:variable name="table_width">
1852
1772
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1853
1773
 
@@ -1871,6 +1791,7 @@
1871
1791
 
1872
1792
 
1873
1793
 
1794
+
1874
1795
 
1875
1796
 
1876
1797
 
@@ -1896,6 +1817,8 @@
1896
1817
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1897
1818
  </xsl:if>
1898
1819
 
1820
+
1821
+
1899
1822
  <xsl:choose>
1900
1823
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1901
1824
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -2180,9 +2103,9 @@
2180
2103
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2181
2104
  <xsl:with-param name="continued">true</xsl:with-param>
2182
2105
  </xsl:apply-templates>
2183
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2184
- <xsl:call-template name="fn_name_display"/>
2185
- </xsl:for-each>
2106
+
2107
+
2108
+
2186
2109
 
2187
2110
  </fo:table-cell>
2188
2111
  </fo:table-row>
@@ -2264,7 +2187,11 @@
2264
2187
 
2265
2188
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2266
2189
 
2267
- <xsl:if test="$isNoteOrFnExist = 'true'">
2190
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2191
+
2192
+ </xsl:variable>
2193
+
2194
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2268
2195
 
2269
2196
  <xsl:variable name="cols-count">
2270
2197
  <xsl:choose>
@@ -2293,6 +2220,8 @@
2293
2220
  </xsl:choose>
2294
2221
  </xsl:for-each>
2295
2222
 
2223
+
2224
+
2296
2225
  <xsl:choose>
2297
2226
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2298
2227
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2319,6 +2248,7 @@
2319
2248
 
2320
2249
 
2321
2250
 
2251
+
2322
2252
  <!-- fn will be processed inside 'note' processing -->
2323
2253
 
2324
2254
 
@@ -2327,6 +2257,11 @@
2327
2257
 
2328
2258
 
2329
2259
 
2260
+
2261
+
2262
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2263
+
2264
+
2330
2265
  <!-- except gb -->
2331
2266
 
2332
2267
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2352,6 +2287,10 @@
2352
2287
  <!-- fn processing -->
2353
2288
  <xsl:call-template name="fn_display"/>
2354
2289
 
2290
+
2291
+ <!-- for PAS display Notes after footnotes -->
2292
+
2293
+
2355
2294
  </fo:table-cell>
2356
2295
  </fo:table-row>
2357
2296
  </fo:table-body>
@@ -2393,6 +2332,19 @@
2393
2332
 
2394
2333
  </fo:table-body>
2395
2334
 
2335
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2336
+ <xsl:choose>
2337
+ <xsl:when test="substring-after(., '—') != ''">
2338
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2339
+ </xsl:when>
2340
+ <xsl:otherwise>
2341
+ <xsl:value-of select="."/>
2342
+ </xsl:otherwise>
2343
+ </xsl:choose>
2344
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2345
+ <xsl:apply-templates mode="presentation_name"/>
2346
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2347
+ <xsl:apply-templates select="."/>
2396
2348
  </xsl:template><xsl:template match="*[local-name()='tr']">
2397
2349
  <xsl:variable name="parent-name" select="local-name(..)"/>
2398
2350
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2405,10 +2357,13 @@
2405
2357
 
2406
2358
 
2407
2359
 
2360
+
2361
+
2408
2362
  </xsl:if>
2409
2363
  <xsl:if test="$parent-name = 'tfoot'">
2410
2364
 
2411
2365
 
2366
+
2412
2367
  </xsl:if>
2413
2368
 
2414
2369
 
@@ -2422,6 +2377,8 @@
2422
2377
 
2423
2378
 
2424
2379
 
2380
+
2381
+
2425
2382
  <!-- <xsl:if test="$namespace = 'bipm'">
2426
2383
  <xsl:attribute name="height">8mm</xsl:attribute>
2427
2384
  </xsl:if> -->
@@ -2515,6 +2472,7 @@
2515
2472
 
2516
2473
 
2517
2474
 
2475
+
2518
2476
  <xsl:attribute name="display-align">before</xsl:attribute>
2519
2477
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
2520
2478
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
@@ -2557,8 +2515,14 @@
2557
2515
 
2558
2516
 
2559
2517
 
2518
+
2519
+
2520
+ <!-- Table's note name (NOTE, for example) -->
2521
+
2560
2522
  <fo:inline padding-right="2mm">
2561
2523
 
2524
+
2525
+
2562
2526
 
2563
2527
 
2564
2528
  <xsl:if test="@type = 'source' or @type = 'abbreviation'">
@@ -2576,6 +2540,8 @@
2576
2540
 
2577
2541
  </fo:inline>
2578
2542
 
2543
+
2544
+
2579
2545
  <xsl:apply-templates mode="process"/>
2580
2546
  </fo:block>
2581
2547
 
@@ -2583,18 +2549,18 @@
2583
2549
  <xsl:apply-templates/>
2584
2550
  </xsl:template><xsl:template name="fn_display">
2585
2551
  <xsl:variable name="references">
2552
+
2586
2553
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2587
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2588
-
2589
-
2590
- <xsl:apply-templates/>
2591
- </fn>
2554
+ <xsl:call-template name="create_fn"/>
2592
2555
  </xsl:for-each>
2593
2556
  </xsl:variable>
2557
+
2594
2558
  <xsl:for-each select="xalan:nodeset($references)//fn">
2595
2559
  <xsl:variable name="reference" select="@reference"/>
2596
2560
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2597
2561
  <fo:block margin-bottom="12pt">
2562
+
2563
+
2598
2564
 
2599
2565
 
2600
2566
 
@@ -2610,9 +2576,11 @@
2610
2576
 
2611
2577
 
2612
2578
 
2579
+
2613
2580
  <xsl:value-of select="@reference"/>
2614
2581
 
2615
2582
 
2583
+
2616
2584
  </fo:inline>
2617
2585
  <fo:inline>
2618
2586
 
@@ -2622,6 +2590,12 @@
2622
2590
  </fo:block>
2623
2591
  </xsl:if>
2624
2592
  </xsl:for-each>
2593
+ </xsl:template><xsl:template name="create_fn">
2594
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2595
+
2596
+
2597
+ <xsl:apply-templates/>
2598
+ </fn>
2625
2599
  </xsl:template><xsl:template name="fn_name_display">
2626
2600
  <!-- <xsl:variable name="references">
2627
2601
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2754,11 +2728,15 @@
2754
2728
 
2755
2729
 
2756
2730
 
2731
+
2732
+
2733
+
2757
2734
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2758
2735
 
2759
2736
 
2760
2737
  <xsl:value-of select="@reference"/>
2761
2738
 
2739
+
2762
2740
  </fo:basic-link>
2763
2741
  </fo:inline>
2764
2742
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3616,19 +3594,6 @@
3616
3594
  <!-- replace start and end spaces to non-break space -->
3617
3595
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3618
3596
  </xsl:copy>
3619
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3620
- <xsl:copy>
3621
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3622
- </xsl:copy>
3623
- <xsl:choose>
3624
- <!-- if in msub, then don't add space -->
3625
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3626
- <!-- if next char in digit, don't add space -->
3627
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3628
- <xsl:otherwise>
3629
- <mathml:mspace width="0.5ex"/>
3630
- </xsl:otherwise>
3631
- </xsl:choose>
3632
3597
  </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">
3633
3598
  <xsl:variable name="target">
3634
3599
  <xsl:choose>
@@ -3653,6 +3618,7 @@
3653
3618
  <fo:inline xsl:use-attribute-sets="link-style">
3654
3619
 
3655
3620
 
3621
+
3656
3622
  <xsl:choose>
3657
3623
  <xsl:when test="$target_text = ''">
3658
3624
  <xsl:apply-templates/>
@@ -3761,6 +3727,7 @@
3761
3727
 
3762
3728
 
3763
3729
 
3730
+
3764
3731
  <fo:block-container margin-left="0mm">
3765
3732
 
3766
3733
 
@@ -3946,7 +3913,24 @@
3946
3913
  </fo:instream-foreign-object>
3947
3914
  </xsl:when>
3948
3915
  <xsl:otherwise>
3949
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3916
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3917
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3918
+
3919
+ <xsl:variable name="img_src">
3920
+ <xsl:choose>
3921
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3922
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3923
+ </xsl:choose>
3924
+ </xsl:variable>
3925
+
3926
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3927
+ <xsl:if test="number($scale) &lt; 100">
3928
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3929
+ </xsl:if>
3930
+
3931
+ </xsl:if>
3932
+
3933
+ </fo:external-graphic>
3950
3934
  </xsl:otherwise>
3951
3935
  </xsl:choose>
3952
3936
 
@@ -4014,6 +3998,253 @@
4014
3998
  <xsl:param name="height"/>
4015
3999
  <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; "/>
4016
4000
  <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; "/>
4001
+ </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">
4002
+ <xsl:param name="name"/>
4003
+
4004
+ <xsl:variable name="svg_content">
4005
+ <xsl:apply-templates select="." mode="svg_update"/>
4006
+ </xsl:variable>
4007
+
4008
+ <xsl:variable name="alt-text">
4009
+ <xsl:choose>
4010
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
4011
+ <xsl:value-of select="../*[local-name() = 'name']"/>
4012
+ </xsl:when>
4013
+ <xsl:when test="normalize-space($name) != ''">
4014
+ <xsl:value-of select="$name"/>
4015
+ </xsl:when>
4016
+ <xsl:otherwise>Figure</xsl:otherwise>
4017
+ </xsl:choose>
4018
+ </xsl:variable>
4019
+
4020
+ <xsl:choose>
4021
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
4022
+ <fo:block>
4023
+ <xsl:variable name="width" select="@width"/>
4024
+ <xsl:variable name="height" select="@height"/>
4025
+
4026
+ <xsl:variable name="scale_x">
4027
+ <xsl:choose>
4028
+ <xsl:when test="$width &gt; $width_effective_px">
4029
+ <xsl:value-of select="$width_effective_px div $width"/>
4030
+ </xsl:when>
4031
+ <xsl:otherwise>1</xsl:otherwise>
4032
+ </xsl:choose>
4033
+ </xsl:variable>
4034
+
4035
+ <xsl:variable name="scale_y">
4036
+ <xsl:choose>
4037
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
4038
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
4039
+ </xsl:when>
4040
+ <xsl:otherwise>1</xsl:otherwise>
4041
+ </xsl:choose>
4042
+ </xsl:variable>
4043
+
4044
+ <xsl:variable name="scale">
4045
+ <xsl:choose>
4046
+ <xsl:when test="$scale_y != 1">
4047
+ <xsl:value-of select="$scale_x * $scale_y"/>
4048
+ </xsl:when>
4049
+ <xsl:otherwise>
4050
+ <xsl:value-of select="$scale_x"/>
4051
+ </xsl:otherwise>
4052
+ </xsl:choose>
4053
+ </xsl:variable>
4054
+
4055
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
4056
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
4057
+
4058
+ <fo:table table-layout="fixed" width="100%">
4059
+ <fo:table-column column-width="proportional-column-width(1)"/>
4060
+ <fo:table-column column-width="{$width_scale}px"/>
4061
+ <fo:table-column column-width="proportional-column-width(1)"/>
4062
+ <fo:table-body>
4063
+ <fo:table-row>
4064
+ <fo:table-cell column-number="2">
4065
+ <fo:block>
4066
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
4067
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4068
+ <fo:block line-height="0" font-size="0">
4069
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4070
+ <xsl:call-template name="bookmark"/>
4071
+ </xsl:for-each>
4072
+ </fo:block>
4073
+ </xsl:if>
4074
+ <fo:block text-depth="0" line-height="0" font-size="0">
4075
+
4076
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4077
+ <xsl:attribute name="width">100%</xsl:attribute>
4078
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4079
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4080
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4081
+
4082
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
4083
+ </fo:instream-foreign-object>
4084
+ </fo:block>
4085
+
4086
+ <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">
4087
+ <xsl:with-param name="scale" select="$scale"/>
4088
+ </xsl:apply-templates>
4089
+ </fo:block-container>
4090
+ </fo:block>
4091
+ </fo:table-cell>
4092
+ </fo:table-row>
4093
+ </fo:table-body>
4094
+ </fo:table>
4095
+ </fo:block>
4096
+
4097
+ </xsl:when>
4098
+ <xsl:otherwise>
4099
+ <fo:block xsl:use-attribute-sets="image-style">
4100
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4101
+ <xsl:attribute name="width">100%</xsl:attribute>
4102
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4103
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4104
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4105
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4106
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4107
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4108
+ <!-- effective height / width = 1.48, 1.4 - with title -->
4109
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4110
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4111
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4112
+ </xsl:if>
4113
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4114
+ <xsl:copy-of select="$svg_content"/>
4115
+ </fo:instream-foreign-object>
4116
+ </fo:block>
4117
+ </xsl:otherwise>
4118
+ </xsl:choose>
4119
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
4120
+ <xsl:copy>
4121
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
4122
+ </xsl:copy>
4123
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
4124
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4125
+ <xsl:value-of select="."/>
4126
+ </xsl:attribute>
4127
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4128
+ <xsl:copy>
4129
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4130
+ <xsl:variable name="viewbox">
4131
+ <xsl:call-template name="split">
4132
+ <xsl:with-param name="pText" select="@viewBox"/>
4133
+ <xsl:with-param name="sep" select="' '"/>
4134
+ </xsl:call-template>
4135
+ </xsl:variable>
4136
+ <xsl:attribute name="width">
4137
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4138
+ </xsl:attribute>
4139
+ <xsl:attribute name="height">
4140
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4141
+ </xsl:attribute>
4142
+ <xsl:apply-templates mode="svg_update"/>
4143
+ </xsl:copy>
4144
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4145
+ <xsl:variable name="svg_content" select="document(@src)"/>
4146
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4147
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
4148
+ <xsl:call-template name="image_svg">
4149
+ <xsl:with-param name="name" select="$name"/>
4150
+ </xsl:call-template>
4151
+ </xsl:for-each>
4152
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
4153
+ <xsl:copy>
4154
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
4155
+ </xsl:copy>
4156
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
4157
+ <xsl:apply-templates mode="svg_remove_a"/>
4158
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
4159
+ <xsl:param name="scale"/>
4160
+ <xsl:variable name="dest">
4161
+ <xsl:choose>
4162
+ <xsl:when test="starts-with(@href, '#')">
4163
+ <xsl:value-of select="substring-after(@href, '#')"/>
4164
+ </xsl:when>
4165
+ <xsl:otherwise>
4166
+ <xsl:value-of select="@href"/>
4167
+ </xsl:otherwise>
4168
+ </xsl:choose>
4169
+ </xsl:variable>
4170
+ <xsl:for-each select="./*[local-name() = 'rect']">
4171
+ <xsl:call-template name="insertSVGMapLink">
4172
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
4173
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
4174
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
4175
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
4176
+ <xsl:with-param name="dest" select="$dest"/>
4177
+ </xsl:call-template>
4178
+ </xsl:for-each>
4179
+
4180
+ <xsl:for-each select="./*[local-name() = 'polygon']">
4181
+ <xsl:variable name="points">
4182
+ <xsl:call-template name="split">
4183
+ <xsl:with-param name="pText" select="@points"/>
4184
+ </xsl:call-template>
4185
+ </xsl:variable>
4186
+ <xsl:variable name="x_coords">
4187
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
4188
+ <xsl:sort select="." data-type="number"/>
4189
+ <x><xsl:value-of select="."/></x>
4190
+ </xsl:for-each>
4191
+ </xsl:variable>
4192
+ <xsl:variable name="y_coords">
4193
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
4194
+ <xsl:sort select="." data-type="number"/>
4195
+ <y><xsl:value-of select="."/></y>
4196
+ </xsl:for-each>
4197
+ </xsl:variable>
4198
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
4199
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
4200
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
4201
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
4202
+ <xsl:call-template name="insertSVGMapLink">
4203
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4204
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4205
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4206
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4207
+ <xsl:with-param name="dest" select="$dest"/>
4208
+ </xsl:call-template>
4209
+ </xsl:for-each>
4210
+
4211
+ <xsl:for-each select="./*[local-name() = 'circle']">
4212
+ <xsl:call-template name="insertSVGMapLink">
4213
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4214
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4215
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4216
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4217
+ <xsl:with-param name="dest" select="$dest"/>
4218
+ </xsl:call-template>
4219
+ </xsl:for-each>
4220
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4221
+ <xsl:call-template name="insertSVGMapLink">
4222
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4223
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4224
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4225
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4226
+ <xsl:with-param name="dest" select="$dest"/>
4227
+ </xsl:call-template>
4228
+ </xsl:for-each>
4229
+ </xsl:template><xsl:template name="insertSVGMapLink">
4230
+ <xsl:param name="left"/>
4231
+ <xsl:param name="top"/>
4232
+ <xsl:param name="width"/>
4233
+ <xsl:param name="height"/>
4234
+ <xsl:param name="dest"/>
4235
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4236
+ <fo:block font-size="1pt">
4237
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4238
+ <fo:inline-container inline-progression-dimension="100%">
4239
+ <fo:block-container height="{$height - 1}px" width="100%">
4240
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4241
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4242
+ </xsl:if> -->
4243
+ <fo:block> </fo:block></fo:block-container>
4244
+ </fo:inline-container>
4245
+ </fo:basic-link>
4246
+ </fo:block>
4247
+ </fo:block-container>
4017
4248
  </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">
4018
4249
  <xsl:apply-templates mode="contents"/>
4019
4250
  <xsl:text> </xsl:text>
@@ -4042,28 +4273,39 @@
4042
4273
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4043
4274
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4044
4275
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4276
+ <xsl:if test="@bundle = 'true'">
4277
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4278
+ </xsl:if>
4045
4279
  <fo:bookmark-title>
4046
- <xsl:variable name="bookmark-title_">
4047
- <xsl:call-template name="getLangVersion">
4048
- <xsl:with-param name="lang" select="@lang"/>
4049
- <xsl:with-param name="doctype" select="@doctype"/>
4050
- <xsl:with-param name="title" select="@title-part"/>
4051
- </xsl:call-template>
4052
- </xsl:variable>
4053
4280
  <xsl:choose>
4054
- <xsl:when test="normalize-space($bookmark-title_) != ''">
4055
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
4056
- </xsl:when>
4057
- <xsl:otherwise>
4281
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4282
+ <xsl:variable name="bookmark-title_">
4283
+ <xsl:call-template name="getLangVersion">
4284
+ <xsl:with-param name="lang" select="@lang"/>
4285
+ <xsl:with-param name="doctype" select="@doctype"/>
4286
+ <xsl:with-param name="title" select="@title-part"/>
4287
+ </xsl:call-template>
4288
+ </xsl:variable>
4058
4289
  <xsl:choose>
4059
- <xsl:when test="@lang = 'en'">English</xsl:when>
4060
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
4061
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4062
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4290
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4291
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4292
+ </xsl:when>
4293
+ <xsl:otherwise>
4294
+ <xsl:choose>
4295
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4296
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4297
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4298
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4299
+ </xsl:choose>
4300
+ </xsl:otherwise>
4063
4301
  </xsl:choose>
4302
+ </xsl:when>
4303
+ <xsl:otherwise>
4304
+ <xsl:value-of select="@title-part"/>
4064
4305
  </xsl:otherwise>
4065
4306
  </xsl:choose>
4066
4307
  </fo:bookmark-title>
4308
+
4067
4309
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4068
4310
 
4069
4311
  <xsl:call-template name="insertFigureBookmarks">
@@ -4162,16 +4404,23 @@
4162
4404
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
4163
4405
  </xsl:choose>
4164
4406
  </xsl:template><xsl:template match="item" mode="bookmark">
4165
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
4166
- <fo:bookmark-title>
4167
- <xsl:if test="@section != ''">
4168
- <xsl:value-of select="@section"/>
4169
- <xsl:text> </xsl:text>
4170
- </xsl:if>
4171
- <xsl:value-of select="normalize-space(title)"/>
4172
- </fo:bookmark-title>
4173
- <xsl:apply-templates mode="bookmark"/>
4174
- </fo:bookmark>
4407
+ <xsl:choose>
4408
+ <xsl:when test="@id != ''">
4409
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4410
+ <fo:bookmark-title>
4411
+ <xsl:if test="@section != ''">
4412
+ <xsl:value-of select="@section"/>
4413
+ <xsl:text> </xsl:text>
4414
+ </xsl:if>
4415
+ <xsl:value-of select="normalize-space(title)"/>
4416
+ </fo:bookmark-title>
4417
+ <xsl:apply-templates mode="bookmark"/>
4418
+ </fo:bookmark>
4419
+ </xsl:when>
4420
+ <xsl:otherwise>
4421
+ <xsl:apply-templates mode="bookmark"/>
4422
+ </xsl:otherwise>
4423
+ </xsl:choose>
4175
4424
  </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">
4176
4425
  <xsl:if test="normalize-space() != ''">
4177
4426
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4537,7 +4786,19 @@
4537
4786
  </fo:inline>
4538
4787
  </xsl:if>
4539
4788
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4540
- <fo:inline><xsl:apply-templates/></fo:inline>
4789
+ <xsl:variable name="element">inline
4790
+
4791
+ </xsl:variable>
4792
+ <xsl:choose>
4793
+ <xsl:when test="contains($element, 'block')">
4794
+ <fo:block xsl:use-attribute-sets="example-p-style">
4795
+ <xsl:apply-templates/>
4796
+ </fo:block>
4797
+ </xsl:when>
4798
+ <xsl:otherwise>
4799
+ <fo:inline><xsl:apply-templates/></fo:inline>
4800
+ </xsl:otherwise>
4801
+ </xsl:choose>
4541
4802
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4542
4803
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4543
4804
 
@@ -4720,7 +4981,9 @@
4720
4981
 
4721
4982
 
4722
4983
  </xsl:if>
4723
-
4984
+
4985
+
4986
+
4724
4987
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4725
4988
  <xsl:if test="normalize-space(@citeas) = ''">
4726
4989
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4729,6 +4992,7 @@
4729
4992
 
4730
4993
 
4731
4994
 
4995
+
4732
4996
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4733
4997
 
4734
4998
  </xsl:if>
@@ -5114,7 +5378,6 @@
5114
5378
  </xsl:template><xsl:template name="processBibitem">
5115
5379
 
5116
5380
 
5117
- <!-- end BIPM bibitem processing-->
5118
5381
 
5119
5382
 
5120
5383
 
@@ -5579,20 +5842,40 @@
5579
5842
  </xsl:call-template>
5580
5843
  </xsl:if>
5581
5844
  </xsl:template><xsl:template name="getLocalizedString">
5582
- <xsl:param name="key"/>
5845
+ <xsl:param name="key"/>
5846
+ <xsl:param name="formatted">false</xsl:param>
5583
5847
 
5584
5848
  <xsl:variable name="curr_lang">
5585
5849
  <xsl:call-template name="getLang"/>
5586
5850
  </xsl:variable>
5587
5851
 
5588
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5852
+ <xsl:variable name="data_value">
5853
+ <xsl:choose>
5854
+ <xsl:when test="$formatted = 'true'">
5855
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5856
+ </xsl:when>
5857
+ <xsl:otherwise>
5858
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5859
+ </xsl:otherwise>
5860
+ </xsl:choose>
5861
+ </xsl:variable>
5589
5862
 
5590
5863
  <xsl:choose>
5591
- <xsl:when test="$data_value != ''">
5592
- <xsl:value-of select="$data_value"/>
5864
+ <xsl:when test="normalize-space($data_value) != ''">
5865
+ <xsl:choose>
5866
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5867
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5868
+ </xsl:choose>
5593
5869
  </xsl:when>
5594
5870
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5595
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5871
+ <xsl:choose>
5872
+ <xsl:when test="$formatted = 'true'">
5873
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5874
+ </xsl:when>
5875
+ <xsl:otherwise>
5876
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5877
+ </xsl:otherwise>
5878
+ </xsl:choose>
5596
5879
  </xsl:when>
5597
5880
  <xsl:otherwise>
5598
5881
  <xsl:variable name="key_">
@@ -5603,7 +5886,7 @@
5603
5886
  <xsl:value-of select="$key_"/>
5604
5887
  </xsl:otherwise>
5605
5888
  </xsl:choose>
5606
-
5889
+
5607
5890
  </xsl:template><xsl:template name="setTrackChangesStyles">
5608
5891
  <xsl:param name="isAdded"/>
5609
5892
  <xsl:param name="isDeleted"/>
@@ -5654,4 +5937,100 @@
5654
5937
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5655
5938
  </xsl:choose>
5656
5939
  </xsl:attribute>
5940
+ </xsl:template><xsl:template name="number-to-words">
5941
+ <xsl:param name="number"/>
5942
+ <xsl:param name="first"/>
5943
+ <xsl:if test="$number != ''">
5944
+ <xsl:variable name="words">
5945
+ <words>
5946
+ <word cardinal="1">One-</word>
5947
+ <word ordinal="1">First </word>
5948
+ <word cardinal="2">Two-</word>
5949
+ <word ordinal="2">Second </word>
5950
+ <word cardinal="3">Three-</word>
5951
+ <word ordinal="3">Third </word>
5952
+ <word cardinal="4">Four-</word>
5953
+ <word ordinal="4">Fourth </word>
5954
+ <word cardinal="5">Five-</word>
5955
+ <word ordinal="5">Fifth </word>
5956
+ <word cardinal="6">Six-</word>
5957
+ <word ordinal="6">Sixth </word>
5958
+ <word cardinal="7">Seven-</word>
5959
+ <word ordinal="7">Seventh </word>
5960
+ <word cardinal="8">Eight-</word>
5961
+ <word ordinal="8">Eighth </word>
5962
+ <word cardinal="9">Nine-</word>
5963
+ <word ordinal="9">Ninth </word>
5964
+ <word ordinal="10">Tenth </word>
5965
+ <word ordinal="11">Eleventh </word>
5966
+ <word ordinal="12">Twelfth </word>
5967
+ <word ordinal="13">Thirteenth </word>
5968
+ <word ordinal="14">Fourteenth </word>
5969
+ <word ordinal="15">Fifteenth </word>
5970
+ <word ordinal="16">Sixteenth </word>
5971
+ <word ordinal="17">Seventeenth </word>
5972
+ <word ordinal="18">Eighteenth </word>
5973
+ <word ordinal="19">Nineteenth </word>
5974
+ <word cardinal="20">Twenty-</word>
5975
+ <word ordinal="20">Twentieth </word>
5976
+ <word cardinal="30">Thirty-</word>
5977
+ <word ordinal="30">Thirtieth </word>
5978
+ <word cardinal="40">Forty-</word>
5979
+ <word ordinal="40">Fortieth </word>
5980
+ <word cardinal="50">Fifty-</word>
5981
+ <word ordinal="50">Fiftieth </word>
5982
+ <word cardinal="60">Sixty-</word>
5983
+ <word ordinal="60">Sixtieth </word>
5984
+ <word cardinal="70">Seventy-</word>
5985
+ <word ordinal="70">Seventieth </word>
5986
+ <word cardinal="80">Eighty-</word>
5987
+ <word ordinal="80">Eightieth </word>
5988
+ <word cardinal="90">Ninety-</word>
5989
+ <word ordinal="90">Ninetieth </word>
5990
+ <word cardinal="100">Hundred-</word>
5991
+ <word ordinal="100">Hundredth </word>
5992
+ </words>
5993
+ </xsl:variable>
5994
+
5995
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5996
+
5997
+ <xsl:variable name="value">
5998
+ <xsl:choose>
5999
+ <xsl:when test="$ordinal != ''">
6000
+ <xsl:value-of select="$ordinal"/>
6001
+ </xsl:when>
6002
+ <xsl:otherwise>
6003
+ <xsl:choose>
6004
+ <xsl:when test="$number &lt; 100">
6005
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6006
+ <xsl:variable name="digit" select="substring($number,2)"/>
6007
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6008
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6009
+ </xsl:when>
6010
+ <xsl:otherwise>
6011
+ <!-- more 100 -->
6012
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6013
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6014
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6015
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6016
+ <xsl:call-template name="number-to-words">
6017
+ <xsl:with-param name="number" select="$digits"/>
6018
+ </xsl:call-template>
6019
+ </xsl:otherwise>
6020
+ </xsl:choose>
6021
+ </xsl:otherwise>
6022
+ </xsl:choose>
6023
+ </xsl:variable>
6024
+ <xsl:choose>
6025
+ <xsl:when test="$first = 'true'">
6026
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6027
+ <xsl:call-template name="capitalize">
6028
+ <xsl:with-param name="str" select="$value_lc"/>
6029
+ </xsl:call-template>
6030
+ </xsl:when>
6031
+ <xsl:otherwise>
6032
+ <xsl:value-of select="$value"/>
6033
+ </xsl:otherwise>
6034
+ </xsl:choose>
6035
+ </xsl:if>
5657
6036
  </xsl:template></xsl:stylesheet>