metanorma-m3aawg 1.7.4 → 1.7.8

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: 689a0873051d63e1493f87fcb336e78624fa2fb478c709a6e3973eaeee3cff90
4
- data.tar.gz: ea913e23f8d07a3f1f295b0d2b05540c1de3c910e3e46aad496d44f0f470e9db
3
+ metadata.gz: 195a7ff8c331cdb5bad720dce725123e327b2ce2ec8f41d8fd6ae1ce29f23e1f
4
+ data.tar.gz: 1da335095bb891af26d258c52244cc4963230b41bbe3b0152c70d7f0809fe020
5
5
  SHA512:
6
- metadata.gz: 5ccbb0d129f1b4571e2355044df989d71ed11817f97eb9f825460421a5581440c5d525207d9333d09d24e3bd03dec78cf16b78ac5de1f6d74682b740dad06a3a
7
- data.tar.gz: cd768f7ec80f3223c69c200bf4f806f03dda1e954a1989f036e2f4b7168f2ee505a6231636ca42024c5eb3253a1a2d6740b7eb7f492a4df7a88adee5182262e8
6
+ metadata.gz: 02dd3cc4e5b4fe3106cd4258005d5659947e224ec04b0436fe1dbcea75ec345c17cc914d7c99fe07534b98fdb3b9086e018b5afcce66243e52a6694edb87e76d
7
+ data.tar.gz: c24ff0bacf14436fd4a31f9d5cf4a4a5822b56db8e3f7f0b47ed5fef75a2f0ea1a3bd5e5272f90c3c115e552346412e976bb886edae3a44d71310679bd1271bd
@@ -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:
data/.rubocop.yml CHANGED
@@ -7,4 +7,4 @@ inherit_from:
7
7
  # ...
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 2.4
10
+ TargetRubyVersion: 2.5
@@ -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>
@@ -14,8 +14,12 @@
14
14
 
15
15
 
16
16
  <xsl:variable name="debug">false</xsl:variable>
17
- <xsl:variable name="pageWidth" select="'215.9mm'"/>
18
- <xsl:variable name="pageHeight" select="'279.4mm'"/>
17
+ <xsl:variable name="pageWidth" select="215.9"/>
18
+ <xsl:variable name="pageHeight" select="279.4"/>
19
+ <xsl:variable name="marginLeftRight1" select="17.3"/>
20
+ <xsl:variable name="marginLeftRight2" select="17.3"/>
21
+ <xsl:variable name="marginTop" select="35"/>
22
+ <xsl:variable name="marginBottom" select="23"/>
19
23
 
20
24
  <xsl:variable name="title-en" select="/m3d:m3d-standard/m3d:bibdata/m3d:title[@language = 'en']"/>
21
25
  <!-- Example:
@@ -39,7 +43,7 @@
39
43
  <fo:layout-master-set>
40
44
 
41
45
  <!-- cover page -->
42
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
46
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
43
47
  <fo:region-body margin-top="31mm" margin-bottom="32mm" margin-left="17.3mm" margin-right="22mm"/>
44
48
  <fo:region-before region-name="cover-header" extent="31mm"/>
45
49
  <fo:region-after region-name="cover-footer" extent="32mm"/>
@@ -48,17 +52,17 @@
48
52
  </fo:simple-page-master>
49
53
 
50
54
  <!-- contents pages -->
51
- <fo:simple-page-master master-name="page" page-width="{$pageWidth}" page-height="{$pageHeight}">
52
- <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="17.3mm" margin-right="17.3mm"/>
53
- <fo:region-before region-name="header" extent="35mm"/>
54
- <fo:region-after region-name="footer" extent="23mm"/>
55
- <fo:region-start region-name="left-region" extent="17.3mm"/>
56
- <fo:region-end region-name="right-region" extent="17.3mm"/>
55
+ <fo:simple-page-master master-name="page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
57
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
58
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
59
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
60
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
57
61
  </fo:simple-page-master>
58
62
 
59
- <fo:simple-page-master master-name="last" page-width="{$pageWidth}" page-height="{$pageHeight}">
60
- <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="17.3mm" margin-right="17.3mm"/>
61
- <fo:region-before region-name="header" extent="35mm"/>
63
+ <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
64
+ <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
65
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
62
66
  <fo:region-after region-name="footer-last" extent="53mm"/>
63
67
  <fo:region-start region-name="left-region" extent="17.3mm"/>
64
68
  <fo:region-end region-name="right-region" extent="17.3mm"/>
@@ -1107,7 +1111,7 @@
1107
1111
  <xsl:attribute name="text-align">justify</xsl:attribute>
1108
1112
 
1109
1113
 
1110
-
1114
+
1111
1115
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1112
1116
 
1113
1117
 
@@ -1174,7 +1178,10 @@
1174
1178
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1175
1179
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1176
1180
 
1177
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1181
+
1182
+ </xsl:attribute-set><xsl:variable name="table-border_">
1183
+
1184
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1178
1185
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1179
1186
 
1180
1187
 
@@ -1194,6 +1201,8 @@
1194
1201
 
1195
1202
 
1196
1203
 
1204
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1205
+
1197
1206
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1198
1207
 
1199
1208
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1223,6 +1232,7 @@
1223
1232
 
1224
1233
 
1225
1234
 
1235
+
1226
1236
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1227
1237
 
1228
1238
 
@@ -1244,6 +1254,7 @@
1244
1254
 
1245
1255
 
1246
1256
 
1257
+
1247
1258
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1248
1259
 
1249
1260
 
@@ -1285,10 +1296,12 @@
1285
1296
 
1286
1297
 
1287
1298
 
1299
+
1288
1300
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1289
1301
 
1290
1302
 
1291
1303
 
1304
+
1292
1305
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1293
1306
 
1294
1307
 
@@ -1343,6 +1356,7 @@
1343
1356
 
1344
1357
 
1345
1358
 
1359
+
1346
1360
 
1347
1361
 
1348
1362
 
@@ -1415,6 +1429,8 @@
1415
1429
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1416
1430
 
1417
1431
 
1432
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1433
+
1418
1434
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1419
1435
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1420
1436
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1425,14 +1441,15 @@
1425
1441
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1426
1442
 
1427
1443
  <!-- Normative references -->
1428
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1444
+ <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"/>
1429
1445
  <!-- Terms and definitions -->
1430
1446
  <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"/>
1431
1447
  <!-- Another main sections -->
1432
1448
  <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"/>
1433
1449
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1434
1450
  <!-- Bibliography -->
1435
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1451
+ <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"/>
1452
+
1436
1453
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1437
1454
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1438
1455
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1472,13 +1489,15 @@
1472
1489
  <xsl:variable name="table">
1473
1490
 
1474
1491
  <xsl:variable name="simple-table">
1475
- <xsl:call-template name="getSimpleTable"/>
1492
+ <xsl:call-template name="getSimpleTable"/>
1476
1493
  </xsl:variable>
1477
1494
 
1478
1495
  <!-- <xsl:if test="$namespace = 'bipm'">
1479
- <fo:block>&#xA0;</fo:block>
1496
+ <fo:block>&#xA0;</fo:block>
1480
1497
  </xsl:if> -->
1481
1498
 
1499
+
1500
+ <!-- Display table's name before table as standalone block -->
1482
1501
  <!-- $namespace = 'iso' or -->
1483
1502
 
1484
1503
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1554,6 +1573,12 @@
1554
1573
 
1555
1574
 
1556
1575
 
1576
+
1577
+
1578
+
1579
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1580
+
1581
+
1557
1582
  <xsl:variable name="table_width">
1558
1583
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1559
1584
  100%
@@ -1572,12 +1597,14 @@
1572
1597
 
1573
1598
 
1574
1599
 
1600
+
1575
1601
 
1576
1602
 
1577
1603
 
1578
1604
 
1579
1605
 
1580
1606
 
1607
+
1581
1608
  </xsl:variable>
1582
1609
 
1583
1610
 
@@ -1719,6 +1746,9 @@
1719
1746
  <fo:block xsl:use-attribute-sets="table-name-style">
1720
1747
 
1721
1748
 
1749
+
1750
+
1751
+
1722
1752
  <xsl:choose>
1723
1753
  <xsl:when test="$continued = 'true'">
1724
1754
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -1866,6 +1896,7 @@
1866
1896
  <!-- font-weight="bold" -->
1867
1897
  <fo:table-header>
1868
1898
 
1899
+
1869
1900
  <xsl:apply-templates/>
1870
1901
  </fo:table-header>
1871
1902
  </xsl:template><xsl:template name="table-header-title">
@@ -1990,6 +2021,8 @@
1990
2021
  </xsl:choose>
1991
2022
  </xsl:for-each>
1992
2023
 
2024
+
2025
+
1993
2026
  <xsl:choose>
1994
2027
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1995
2028
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2016,6 +2049,7 @@
2016
2049
 
2017
2050
 
2018
2051
 
2052
+
2019
2053
  <!-- fn will be processed inside 'note' processing -->
2020
2054
 
2021
2055
 
@@ -2024,6 +2058,11 @@
2024
2058
 
2025
2059
 
2026
2060
 
2061
+
2062
+
2063
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2064
+
2065
+
2027
2066
  <!-- except gb -->
2028
2067
 
2029
2068
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2049,6 +2088,10 @@
2049
2088
  <!-- fn processing -->
2050
2089
  <xsl:call-template name="fn_display"/>
2051
2090
 
2091
+
2092
+ <!-- for PAS display Notes after footnotes -->
2093
+
2094
+
2052
2095
  </fo:table-cell>
2053
2096
  </fo:table-row>
2054
2097
  </fo:table-body>
@@ -2102,15 +2145,24 @@
2102
2145
 
2103
2146
 
2104
2147
 
2148
+
2149
+
2105
2150
  </xsl:if>
2106
2151
  <xsl:if test="$parent-name = 'tfoot'">
2107
2152
 
2108
2153
 
2154
+
2109
2155
  </xsl:if>
2110
2156
 
2111
2157
 
2112
2158
 
2113
2159
 
2160
+
2161
+
2162
+
2163
+
2164
+
2165
+
2114
2166
  <!-- <xsl:if test="$namespace = 'bipm'">
2115
2167
  <xsl:attribute name="height">8mm</xsl:attribute>
2116
2168
  </xsl:if> -->
@@ -2196,6 +2248,10 @@
2196
2248
 
2197
2249
 
2198
2250
 
2251
+
2252
+
2253
+
2254
+
2199
2255
  <xsl:if test=".//*[local-name() = 'table']">
2200
2256
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2201
2257
  </xsl:if>
@@ -2225,8 +2281,14 @@
2225
2281
 
2226
2282
 
2227
2283
 
2284
+
2285
+
2286
+ <!-- Table's note name (NOTE, for example) -->
2287
+
2228
2288
  <fo:inline padding-right="2mm">
2229
2289
 
2290
+
2291
+
2230
2292
 
2231
2293
 
2232
2294
 
@@ -2234,6 +2296,8 @@
2234
2296
 
2235
2297
  </fo:inline>
2236
2298
 
2299
+
2300
+
2237
2301
  <xsl:apply-templates mode="process"/>
2238
2302
  </fo:block>
2239
2303
 
@@ -2253,6 +2317,8 @@
2253
2317
  <xsl:variable name="reference" select="@reference"/>
2254
2318
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2255
2319
  <fo:block margin-bottom="12pt">
2320
+
2321
+
2256
2322
 
2257
2323
 
2258
2324
 
@@ -2268,9 +2334,11 @@
2268
2334
 
2269
2335
 
2270
2336
 
2337
+
2271
2338
  <xsl:value-of select="@reference"/>
2272
2339
 
2273
2340
 
2341
+
2274
2342
  </fo:inline>
2275
2343
  <fo:inline>
2276
2344
 
@@ -2411,11 +2479,16 @@
2411
2479
 
2412
2480
 
2413
2481
 
2482
+
2483
+
2484
+
2485
+
2414
2486
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2415
2487
 
2416
2488
 
2417
2489
  <xsl:value-of select="@reference"/>
2418
2490
 
2491
+
2419
2492
  </fo:basic-link>
2420
2493
  </fo:inline>
2421
2494
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2713,6 +2786,7 @@
2713
2786
 
2714
2787
  <fo:table-row>
2715
2788
 
2789
+
2716
2790
  <fo:table-cell>
2717
2791
 
2718
2792
  <fo:block margin-top="6pt">
@@ -2728,6 +2802,7 @@
2728
2802
 
2729
2803
 
2730
2804
 
2805
+
2731
2806
  <xsl:apply-templates/>
2732
2807
  <!-- <xsl:if test="$namespace = 'gb'">
2733
2808
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3280,7 +3355,15 @@
3280
3355
  <xsl:copy>
3281
3356
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3282
3357
  </xsl:copy>
3283
- <mathml:mspace width="0.5ex"/>
3358
+ <xsl:choose>
3359
+ <!-- if in msub, then don't add space -->
3360
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3361
+ <!-- if next char in digit, don't add space -->
3362
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3363
+ <xsl:otherwise>
3364
+ <mathml:mspace width="0.5ex"/>
3365
+ </xsl:otherwise>
3366
+ </xsl:choose>
3284
3367
  </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">
3285
3368
  <xsl:variable name="target">
3286
3369
  <xsl:choose>
@@ -3304,6 +3387,8 @@
3304
3387
  </xsl:variable>
3305
3388
  <fo:inline xsl:use-attribute-sets="link-style">
3306
3389
 
3390
+
3391
+
3307
3392
  <xsl:choose>
3308
3393
  <xsl:when test="$target_text = ''">
3309
3394
  <xsl:apply-templates/>
@@ -3412,6 +3497,7 @@
3412
3497
 
3413
3498
 
3414
3499
 
3500
+
3415
3501
  <fo:block-container margin-left="0mm">
3416
3502
 
3417
3503
 
@@ -3455,6 +3541,7 @@
3455
3541
  </xsl:choose>
3456
3542
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3457
3543
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3544
+
3458
3545
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3459
3546
 
3460
3547
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3534,6 +3621,7 @@
3534
3621
  </xsl:call-template>
3535
3622
 
3536
3623
  <fo:block>
3624
+
3537
3625
  <xsl:apply-templates/>
3538
3626
  </fo:block>
3539
3627
  <xsl:call-template name="fn_display_figure"/>
@@ -3588,7 +3676,24 @@
3588
3676
  </fo:instream-foreign-object>
3589
3677
  </xsl:when>
3590
3678
  <xsl:otherwise>
3591
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3679
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3680
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3681
+
3682
+ <xsl:variable name="img_src">
3683
+ <xsl:choose>
3684
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3685
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3686
+ </xsl:choose>
3687
+ </xsl:variable>
3688
+
3689
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3690
+ <xsl:if test="number($scale) &lt; 100">
3691
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3692
+ </xsl:if>
3693
+
3694
+ </xsl:if>
3695
+
3696
+ </fo:external-graphic>
3592
3697
  </xsl:otherwise>
3593
3698
  </xsl:choose>
3594
3699
 
@@ -3656,6 +3761,253 @@
3656
3761
  <xsl:param name="height"/>
3657
3762
  <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; "/>
3658
3763
  <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; "/>
3764
+ </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">
3765
+ <xsl:param name="name"/>
3766
+
3767
+ <xsl:variable name="svg_content">
3768
+ <xsl:apply-templates select="." mode="svg_update"/>
3769
+ </xsl:variable>
3770
+
3771
+ <xsl:variable name="alt-text">
3772
+ <xsl:choose>
3773
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3774
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3775
+ </xsl:when>
3776
+ <xsl:when test="normalize-space($name) != ''">
3777
+ <xsl:value-of select="$name"/>
3778
+ </xsl:when>
3779
+ <xsl:otherwise>Figure</xsl:otherwise>
3780
+ </xsl:choose>
3781
+ </xsl:variable>
3782
+
3783
+ <xsl:choose>
3784
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3785
+ <fo:block>
3786
+ <xsl:variable name="width" select="@width"/>
3787
+ <xsl:variable name="height" select="@height"/>
3788
+
3789
+ <xsl:variable name="scale_x">
3790
+ <xsl:choose>
3791
+ <xsl:when test="$width &gt; $width_effective_px">
3792
+ <xsl:value-of select="$width_effective_px div $width"/>
3793
+ </xsl:when>
3794
+ <xsl:otherwise>1</xsl:otherwise>
3795
+ </xsl:choose>
3796
+ </xsl:variable>
3797
+
3798
+ <xsl:variable name="scale_y">
3799
+ <xsl:choose>
3800
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3801
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3802
+ </xsl:when>
3803
+ <xsl:otherwise>1</xsl:otherwise>
3804
+ </xsl:choose>
3805
+ </xsl:variable>
3806
+
3807
+ <xsl:variable name="scale">
3808
+ <xsl:choose>
3809
+ <xsl:when test="$scale_y != 1">
3810
+ <xsl:value-of select="$scale_x * $scale_y"/>
3811
+ </xsl:when>
3812
+ <xsl:otherwise>
3813
+ <xsl:value-of select="$scale_x"/>
3814
+ </xsl:otherwise>
3815
+ </xsl:choose>
3816
+ </xsl:variable>
3817
+
3818
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3819
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3820
+
3821
+ <fo:table table-layout="fixed" width="100%">
3822
+ <fo:table-column column-width="proportional-column-width(1)"/>
3823
+ <fo:table-column column-width="{$width_scale}px"/>
3824
+ <fo:table-column column-width="proportional-column-width(1)"/>
3825
+ <fo:table-body>
3826
+ <fo:table-row>
3827
+ <fo:table-cell column-number="2">
3828
+ <fo:block>
3829
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3830
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3831
+ <fo:block line-height="0" font-size="0">
3832
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3833
+ <xsl:call-template name="bookmark"/>
3834
+ </xsl:for-each>
3835
+ </fo:block>
3836
+ </xsl:if>
3837
+ <fo:block text-depth="0" line-height="0" font-size="0">
3838
+
3839
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3840
+ <xsl:attribute name="width">100%</xsl:attribute>
3841
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3842
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3843
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3844
+
3845
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3846
+ </fo:instream-foreign-object>
3847
+ </fo:block>
3848
+
3849
+ <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">
3850
+ <xsl:with-param name="scale" select="$scale"/>
3851
+ </xsl:apply-templates>
3852
+ </fo:block-container>
3853
+ </fo:block>
3854
+ </fo:table-cell>
3855
+ </fo:table-row>
3856
+ </fo:table-body>
3857
+ </fo:table>
3858
+ </fo:block>
3859
+
3860
+ </xsl:when>
3861
+ <xsl:otherwise>
3862
+ <fo:block xsl:use-attribute-sets="image-style">
3863
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3864
+ <xsl:attribute name="width">100%</xsl:attribute>
3865
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3866
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3867
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3868
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3869
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3870
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3871
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3872
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3873
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3874
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3875
+ </xsl:if>
3876
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3877
+ <xsl:copy-of select="$svg_content"/>
3878
+ </fo:instream-foreign-object>
3879
+ </fo:block>
3880
+ </xsl:otherwise>
3881
+ </xsl:choose>
3882
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3883
+ <xsl:copy>
3884
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3885
+ </xsl:copy>
3886
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3887
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3888
+ <xsl:value-of select="."/>
3889
+ </xsl:attribute>
3890
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3891
+ <xsl:copy>
3892
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3893
+ <xsl:variable name="viewbox">
3894
+ <xsl:call-template name="split">
3895
+ <xsl:with-param name="pText" select="@viewBox"/>
3896
+ <xsl:with-param name="sep" select="' '"/>
3897
+ </xsl:call-template>
3898
+ </xsl:variable>
3899
+ <xsl:attribute name="width">
3900
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3901
+ </xsl:attribute>
3902
+ <xsl:attribute name="height">
3903
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3904
+ </xsl:attribute>
3905
+ <xsl:apply-templates mode="svg_update"/>
3906
+ </xsl:copy>
3907
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3908
+ <xsl:variable name="svg_content" select="document(@src)"/>
3909
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3910
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3911
+ <xsl:call-template name="image_svg">
3912
+ <xsl:with-param name="name" select="$name"/>
3913
+ </xsl:call-template>
3914
+ </xsl:for-each>
3915
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3916
+ <xsl:copy>
3917
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3918
+ </xsl:copy>
3919
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3920
+ <xsl:apply-templates mode="svg_remove_a"/>
3921
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3922
+ <xsl:param name="scale"/>
3923
+ <xsl:variable name="dest">
3924
+ <xsl:choose>
3925
+ <xsl:when test="starts-with(@href, '#')">
3926
+ <xsl:value-of select="substring-after(@href, '#')"/>
3927
+ </xsl:when>
3928
+ <xsl:otherwise>
3929
+ <xsl:value-of select="@href"/>
3930
+ </xsl:otherwise>
3931
+ </xsl:choose>
3932
+ </xsl:variable>
3933
+ <xsl:for-each select="./*[local-name() = 'rect']">
3934
+ <xsl:call-template name="insertSVGMapLink">
3935
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3936
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3937
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3938
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3939
+ <xsl:with-param name="dest" select="$dest"/>
3940
+ </xsl:call-template>
3941
+ </xsl:for-each>
3942
+
3943
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3944
+ <xsl:variable name="points">
3945
+ <xsl:call-template name="split">
3946
+ <xsl:with-param name="pText" select="@points"/>
3947
+ </xsl:call-template>
3948
+ </xsl:variable>
3949
+ <xsl:variable name="x_coords">
3950
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3951
+ <xsl:sort select="." data-type="number"/>
3952
+ <x><xsl:value-of select="."/></x>
3953
+ </xsl:for-each>
3954
+ </xsl:variable>
3955
+ <xsl:variable name="y_coords">
3956
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3957
+ <xsl:sort select="." data-type="number"/>
3958
+ <y><xsl:value-of select="."/></y>
3959
+ </xsl:for-each>
3960
+ </xsl:variable>
3961
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3962
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3963
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3964
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3965
+ <xsl:call-template name="insertSVGMapLink">
3966
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3967
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3968
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3969
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3970
+ <xsl:with-param name="dest" select="$dest"/>
3971
+ </xsl:call-template>
3972
+ </xsl:for-each>
3973
+
3974
+ <xsl:for-each select="./*[local-name() = 'circle']">
3975
+ <xsl:call-template name="insertSVGMapLink">
3976
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3977
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3978
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3979
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3980
+ <xsl:with-param name="dest" select="$dest"/>
3981
+ </xsl:call-template>
3982
+ </xsl:for-each>
3983
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3984
+ <xsl:call-template name="insertSVGMapLink">
3985
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3986
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3987
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3988
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3989
+ <xsl:with-param name="dest" select="$dest"/>
3990
+ </xsl:call-template>
3991
+ </xsl:for-each>
3992
+ </xsl:template><xsl:template name="insertSVGMapLink">
3993
+ <xsl:param name="left"/>
3994
+ <xsl:param name="top"/>
3995
+ <xsl:param name="width"/>
3996
+ <xsl:param name="height"/>
3997
+ <xsl:param name="dest"/>
3998
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3999
+ <fo:block font-size="1pt">
4000
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4001
+ <fo:inline-container inline-progression-dimension="100%">
4002
+ <fo:block-container height="{$height - 1}px" width="100%">
4003
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4004
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4005
+ </xsl:if> -->
4006
+ <fo:block> </fo:block></fo:block-container>
4007
+ </fo:inline-container>
4008
+ </fo:basic-link>
4009
+ </fo:block>
4010
+ </fo:block-container>
3659
4011
  </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">
3660
4012
  <xsl:apply-templates mode="contents"/>
3661
4013
  <xsl:text> </xsl:text>
@@ -3684,28 +4036,39 @@
3684
4036
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3685
4037
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3686
4038
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4039
+ <xsl:if test="@bundle = 'true'">
4040
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4041
+ </xsl:if>
3687
4042
  <fo:bookmark-title>
3688
- <xsl:variable name="bookmark-title_">
3689
- <xsl:call-template name="getLangVersion">
3690
- <xsl:with-param name="lang" select="@lang"/>
3691
- <xsl:with-param name="doctype" select="@doctype"/>
3692
- <xsl:with-param name="title" select="@title-part"/>
3693
- </xsl:call-template>
3694
- </xsl:variable>
3695
4043
  <xsl:choose>
3696
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3697
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3698
- </xsl:when>
3699
- <xsl:otherwise>
4044
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4045
+ <xsl:variable name="bookmark-title_">
4046
+ <xsl:call-template name="getLangVersion">
4047
+ <xsl:with-param name="lang" select="@lang"/>
4048
+ <xsl:with-param name="doctype" select="@doctype"/>
4049
+ <xsl:with-param name="title" select="@title-part"/>
4050
+ </xsl:call-template>
4051
+ </xsl:variable>
3700
4052
  <xsl:choose>
3701
- <xsl:when test="@lang = 'en'">English</xsl:when>
3702
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3703
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3704
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4053
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4054
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4055
+ </xsl:when>
4056
+ <xsl:otherwise>
4057
+ <xsl:choose>
4058
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4059
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4060
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4061
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4062
+ </xsl:choose>
4063
+ </xsl:otherwise>
3705
4064
  </xsl:choose>
4065
+ </xsl:when>
4066
+ <xsl:otherwise>
4067
+ <xsl:value-of select="@title-part"/>
3706
4068
  </xsl:otherwise>
3707
4069
  </xsl:choose>
3708
4070
  </fo:bookmark-title>
4071
+
3709
4072
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3710
4073
 
3711
4074
  <xsl:call-template name="insertFigureBookmarks">
@@ -3804,20 +4167,28 @@
3804
4167
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3805
4168
  </xsl:choose>
3806
4169
  </xsl:template><xsl:template match="item" mode="bookmark">
3807
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3808
- <fo:bookmark-title>
3809
- <xsl:if test="@section != ''">
3810
- <xsl:value-of select="@section"/>
3811
- <xsl:text> </xsl:text>
3812
- </xsl:if>
3813
- <xsl:value-of select="normalize-space(title)"/>
3814
- </fo:bookmark-title>
3815
- <xsl:apply-templates mode="bookmark"/>
3816
- </fo:bookmark>
4170
+ <xsl:choose>
4171
+ <xsl:when test="@id != ''">
4172
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4173
+ <fo:bookmark-title>
4174
+ <xsl:if test="@section != ''">
4175
+ <xsl:value-of select="@section"/>
4176
+ <xsl:text> </xsl:text>
4177
+ </xsl:if>
4178
+ <xsl:value-of select="normalize-space(title)"/>
4179
+ </fo:bookmark-title>
4180
+ <xsl:apply-templates mode="bookmark"/>
4181
+ </fo:bookmark>
4182
+ </xsl:when>
4183
+ <xsl:otherwise>
4184
+ <xsl:apply-templates mode="bookmark"/>
4185
+ </xsl:otherwise>
4186
+ </xsl:choose>
3817
4187
  </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">
3818
4188
  <xsl:if test="normalize-space() != ''">
3819
4189
  <fo:block xsl:use-attribute-sets="figure-name-style">
3820
4190
 
4191
+
3821
4192
  <xsl:apply-templates/>
3822
4193
  </fo:block>
3823
4194
  </xsl:if>
@@ -3898,6 +4269,7 @@
3898
4269
 
3899
4270
  <fo:block-container margin-left="0mm">
3900
4271
  <xsl:copy-of select="@id"/>
4272
+
3901
4273
  <xsl:if test="parent::*[local-name() = 'note']">
3902
4274
  <xsl:attribute name="margin-left">
3903
4275
  <xsl:choose>
@@ -3908,7 +4280,9 @@
3908
4280
 
3909
4281
  </xsl:if>
3910
4282
  <fo:block-container margin-left="0mm">
3911
-
4283
+
4284
+
4285
+
3912
4286
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3913
4287
  <xsl:variable name="_font-size">
3914
4288
 
@@ -3937,10 +4311,14 @@
3937
4311
  </xsl:choose>
3938
4312
  </xsl:attribute>
3939
4313
  </xsl:if>
3940
- <xsl:apply-templates/>
3941
- </fo:block>
4314
+
4315
+ <xsl:apply-templates/>
4316
+ </fo:block>
4317
+
4318
+
3942
4319
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3943
4320
 
4321
+
3944
4322
  </fo:block-container>
3945
4323
  </fo:block-container>
3946
4324
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4349,7 +4727,9 @@
4349
4727
  <xsl:attribute name="vertical-align">super</xsl:attribute>
4350
4728
 
4351
4729
  </xsl:if>
4352
-
4730
+
4731
+
4732
+
4353
4733
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4354
4734
  <xsl:if test="normalize-space(@citeas) = ''">
4355
4735
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4358,6 +4738,7 @@
4358
4738
 
4359
4739
 
4360
4740
 
4741
+
4361
4742
  </xsl:if>
4362
4743
 
4363
4744
  <xsl:apply-templates/>
@@ -4508,6 +4889,7 @@
4508
4889
  <xsl:call-template name="setId"/>
4509
4890
 
4510
4891
 
4892
+
4511
4893
  <xsl:apply-templates/>
4512
4894
  </fo:block>
4513
4895
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4754,17 +5136,17 @@
4754
5136
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
4755
5137
  <xsl:choose>
4756
5138
  <xsl:when test="normalize-space($_doc_ident) != ''">
4757
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
5139
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
4758
5140
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4759
5141
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4760
- </xsl:if>
5142
+ </xsl:if> -->
4761
5143
  <xsl:value-of select="$_doc_ident"/>
4762
5144
  </xsl:when>
4763
5145
  <xsl:otherwise>
4764
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5146
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4765
5147
  <xsl:if test="$type != ''">
4766
5148
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4767
- </xsl:if>
5149
+ </xsl:if> -->
4768
5150
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4769
5151
  </xsl:otherwise>
4770
5152
  </xsl:choose>
@@ -5205,20 +5587,40 @@
5205
5587
  </xsl:call-template>
5206
5588
  </xsl:if>
5207
5589
  </xsl:template><xsl:template name="getLocalizedString">
5208
- <xsl:param name="key"/>
5590
+ <xsl:param name="key"/>
5591
+ <xsl:param name="formatted">false</xsl:param>
5209
5592
 
5210
5593
  <xsl:variable name="curr_lang">
5211
5594
  <xsl:call-template name="getLang"/>
5212
5595
  </xsl:variable>
5213
5596
 
5214
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5597
+ <xsl:variable name="data_value">
5598
+ <xsl:choose>
5599
+ <xsl:when test="$formatted = 'true'">
5600
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5601
+ </xsl:when>
5602
+ <xsl:otherwise>
5603
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5604
+ </xsl:otherwise>
5605
+ </xsl:choose>
5606
+ </xsl:variable>
5215
5607
 
5216
5608
  <xsl:choose>
5217
- <xsl:when test="$data_value != ''">
5218
- <xsl:value-of select="$data_value"/>
5609
+ <xsl:when test="normalize-space($data_value) != ''">
5610
+ <xsl:choose>
5611
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5612
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5613
+ </xsl:choose>
5219
5614
  </xsl:when>
5220
5615
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5221
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5616
+ <xsl:choose>
5617
+ <xsl:when test="$formatted = 'true'">
5618
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5619
+ </xsl:when>
5620
+ <xsl:otherwise>
5621
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5622
+ </xsl:otherwise>
5623
+ </xsl:choose>
5222
5624
  </xsl:when>
5223
5625
  <xsl:otherwise>
5224
5626
  <xsl:variable name="key_">
@@ -5229,7 +5631,7 @@
5229
5631
  <xsl:value-of select="$key_"/>
5230
5632
  </xsl:otherwise>
5231
5633
  </xsl:choose>
5232
-
5634
+
5233
5635
  </xsl:template><xsl:template name="setTrackChangesStyles">
5234
5636
  <xsl:param name="isAdded"/>
5235
5637
  <xsl:param name="isDeleted"/>
@@ -5270,4 +5672,110 @@
5270
5672
  <xsl:value-of select="$align"/>
5271
5673
  </xsl:when>
5272
5674
  </xsl:choose>
5675
+ </xsl:template><xsl:template name="setTextAlignment">
5676
+ <xsl:param name="default">left</xsl:param>
5677
+ <xsl:attribute name="text-align">
5678
+ <xsl:choose>
5679
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5680
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5681
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5682
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5683
+ </xsl:choose>
5684
+ </xsl:attribute>
5685
+ </xsl:template><xsl:template name="number-to-words">
5686
+ <xsl:param name="number"/>
5687
+ <xsl:param name="first"/>
5688
+ <xsl:if test="$number != ''">
5689
+ <xsl:variable name="words">
5690
+ <words>
5691
+ <word cardinal="1">One-</word>
5692
+ <word ordinal="1">First </word>
5693
+ <word cardinal="2">Two-</word>
5694
+ <word ordinal="2">Second </word>
5695
+ <word cardinal="3">Three-</word>
5696
+ <word ordinal="3">Third </word>
5697
+ <word cardinal="4">Four-</word>
5698
+ <word ordinal="4">Fourth </word>
5699
+ <word cardinal="5">Five-</word>
5700
+ <word ordinal="5">Fifth </word>
5701
+ <word cardinal="6">Six-</word>
5702
+ <word ordinal="6">Sixth </word>
5703
+ <word cardinal="7">Seven-</word>
5704
+ <word ordinal="7">Seventh </word>
5705
+ <word cardinal="8">Eight-</word>
5706
+ <word ordinal="8">Eighth </word>
5707
+ <word cardinal="9">Nine-</word>
5708
+ <word ordinal="9">Ninth </word>
5709
+ <word ordinal="10">Tenth </word>
5710
+ <word ordinal="11">Eleventh </word>
5711
+ <word ordinal="12">Twelfth </word>
5712
+ <word ordinal="13">Thirteenth </word>
5713
+ <word ordinal="14">Fourteenth </word>
5714
+ <word ordinal="15">Fifteenth </word>
5715
+ <word ordinal="16">Sixteenth </word>
5716
+ <word ordinal="17">Seventeenth </word>
5717
+ <word ordinal="18">Eighteenth </word>
5718
+ <word ordinal="19">Nineteenth </word>
5719
+ <word cardinal="20">Twenty-</word>
5720
+ <word ordinal="20">Twentieth </word>
5721
+ <word cardinal="30">Thirty-</word>
5722
+ <word ordinal="30">Thirtieth </word>
5723
+ <word cardinal="40">Forty-</word>
5724
+ <word ordinal="40">Fortieth </word>
5725
+ <word cardinal="50">Fifty-</word>
5726
+ <word ordinal="50">Fiftieth </word>
5727
+ <word cardinal="60">Sixty-</word>
5728
+ <word ordinal="60">Sixtieth </word>
5729
+ <word cardinal="70">Seventy-</word>
5730
+ <word ordinal="70">Seventieth </word>
5731
+ <word cardinal="80">Eighty-</word>
5732
+ <word ordinal="80">Eightieth </word>
5733
+ <word cardinal="90">Ninety-</word>
5734
+ <word ordinal="90">Ninetieth </word>
5735
+ <word cardinal="100">Hundred-</word>
5736
+ <word ordinal="100">Hundredth </word>
5737
+ </words>
5738
+ </xsl:variable>
5739
+
5740
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5741
+
5742
+ <xsl:variable name="value">
5743
+ <xsl:choose>
5744
+ <xsl:when test="$ordinal != ''">
5745
+ <xsl:value-of select="$ordinal"/>
5746
+ </xsl:when>
5747
+ <xsl:otherwise>
5748
+ <xsl:choose>
5749
+ <xsl:when test="$number &lt; 100">
5750
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5751
+ <xsl:variable name="digit" select="substring($number,2)"/>
5752
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5753
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5754
+ </xsl:when>
5755
+ <xsl:otherwise>
5756
+ <!-- more 100 -->
5757
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5758
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5759
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5760
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5761
+ <xsl:call-template name="number-to-words">
5762
+ <xsl:with-param name="number" select="$digits"/>
5763
+ </xsl:call-template>
5764
+ </xsl:otherwise>
5765
+ </xsl:choose>
5766
+ </xsl:otherwise>
5767
+ </xsl:choose>
5768
+ </xsl:variable>
5769
+ <xsl:choose>
5770
+ <xsl:when test="$first = 'true'">
5771
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5772
+ <xsl:call-template name="capitalize">
5773
+ <xsl:with-param name="str" select="$value_lc"/>
5774
+ </xsl:call-template>
5775
+ </xsl:when>
5776
+ <xsl:otherwise>
5777
+ <xsl:value-of select="$value"/>
5778
+ </xsl:otherwise>
5779
+ </xsl:choose>
5780
+ </xsl:if>
5273
5781
  </xsl:template></xsl:stylesheet>