metanorma-iho 0.3.4 → 0.3.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: aaadb9f1a37db3c3b5aff92d2a593b365194c6d4e1435d06a7334766511adb1c
4
- data.tar.gz: fb552d20da927d65e91ad726ef7926fc7a1617cdee4cc71cfab8807d64a79888
3
+ metadata.gz: 6c062655a6505a149cd6784feb72db8371befad3879589a484fade5789913a55
4
+ data.tar.gz: 2ca9e9c8bdfa49509ac399d87ce989666315dca3dfb3644478317f791c271475
5
5
  SHA512:
6
- metadata.gz: 664a4bdc46f48822c6eb58ad3e258498dd8ff33da546168b905a4c5299643a1f0e3b7928167457139b7db70c2572f37305318f31f78ffb74824f6f78e9c7d2e0
7
- data.tar.gz: 475f2b786a53d4641fc6ebc0d8ab08c142d6c3dacf3053d5046497d7d8e63b2125b0104729d390b6d88097adace7536c061d269bc06f2374483b26015dcd85a6
6
+ metadata.gz: f9552c8aee4fe532b730ae900158ca6d689334bc1914607123ef83d770abe97d0ad0fb384b336460417f6fb9da3769eb790e6441fe3a42ee07441fc5da72017a
7
+ data.tar.gz: cbaceb84930772012ad0e76d76cc5373ad692ef56952c7d734ca3a743f243767b91607a87fc9c0ec1b2a4a22c3aa4b0d6559c39084eb118ad46d4c92d19ddd83
@@ -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>
@@ -15,8 +15,13 @@
15
15
 
16
16
 
17
17
  <xsl:variable name="debug">false</xsl:variable>
18
- <xsl:variable name="pageWidth" select="'210mm'"/>
19
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="25.4"/>
21
+ <xsl:variable name="marginLeftRight2" select="25.4"/>
22
+ <xsl:variable name="marginTop" select="25.4"/>
23
+ <xsl:variable name="marginBottom" select="25.4"/>
24
+
20
25
 
21
26
  <xsl:variable name="title-en" select="/iho:iho-standard/iho:bibdata/iho:title[@language = 'en']"/>
22
27
  <xsl:variable name="docidentifier" select="/iho:iho-standard/iho:bibdata/iho:docidentifier[@type = 'IHO']"/>
@@ -43,44 +48,44 @@
43
48
  <fo:root font-family="Arial, Cambria Math" font-size="12pt" xml:lang="{$lang}">
44
49
  <fo:layout-master-set>
45
50
  <!-- cover page -->
46
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
47
52
  <fo:region-body margin-top="0mm" margin-bottom="5mm" margin-left="0mm" margin-right="5mm"/>
48
53
  </fo:simple-page-master>
49
54
 
50
- <fo:simple-page-master master-name="first" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
52
- <fo:region-before region-name="header" extent="25.4mm"/>
53
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
54
- <fo:region-start region-name="left-region" extent="25.4mm"/>
55
- <fo:region-end region-name="right-region" extent="25.4mm"/>
55
+ <fo:simple-page-master master-name="first" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" 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-even" 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"/>
56
61
  </fo:simple-page-master>
57
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
58
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
59
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
60
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
61
- <fo:region-start region-name="left-region" extent="25.4mm"/>
62
- <fo:region-end region-name="right-region" extent="25.4mm"/>
62
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
63
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
64
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
65
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
66
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
67
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
63
68
  </fo:simple-page-master>
64
- <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
65
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
66
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
67
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
68
- <fo:region-start region-name="left-region" extent="25.4mm"/>
69
- <fo:region-end region-name="right-region" extent="25.4mm"/>
69
+ <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
70
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
71
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
72
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
73
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
70
75
  </fo:simple-page-master>
71
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
72
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
73
- <fo:region-before region-name="header-even" extent="25.4mm"/>
74
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
75
- <fo:region-start region-name="left-region" extent="25.4mm"/>
76
- <fo:region-end region-name="right-region" extent="25.4mm"/>
76
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
78
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
79
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
80
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
81
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
77
82
  </fo:simple-page-master>
78
- <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
79
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
80
- <fo:region-before region-name="header-even" extent="25.4mm"/>
81
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
82
- <fo:region-start region-name="left-region" extent="25.4mm"/>
83
- <fo:region-end region-name="right-region" extent="25.4mm"/>
83
+ <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
84
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
85
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
86
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
87
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
88
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
84
89
  </fo:simple-page-master>
85
90
  <!-- Preface pages -->
86
91
  <fo:page-sequence-master master-name="preface">
@@ -1174,7 +1179,7 @@
1174
1179
 
1175
1180
 
1176
1181
 
1177
-
1182
+
1178
1183
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1179
1184
 
1180
1185
 
@@ -1241,7 +1246,10 @@
1241
1246
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
1242
1247
 
1243
1248
 
1244
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1249
+
1250
+ </xsl:attribute-set><xsl:variable name="table-border_">
1251
+
1252
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1245
1253
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1246
1254
 
1247
1255
 
@@ -1262,6 +1270,8 @@
1262
1270
 
1263
1271
 
1264
1272
 
1273
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1274
+
1265
1275
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1266
1276
 
1267
1277
 
@@ -1285,6 +1295,7 @@
1285
1295
 
1286
1296
 
1287
1297
 
1298
+
1288
1299
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1289
1300
 
1290
1301
 
@@ -1306,6 +1317,7 @@
1306
1317
 
1307
1318
 
1308
1319
 
1320
+
1309
1321
  </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">
1310
1322
 
1311
1323
 
@@ -1352,10 +1364,12 @@
1352
1364
 
1353
1365
 
1354
1366
 
1367
+
1355
1368
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1356
1369
 
1357
1370
 
1358
1371
 
1372
+
1359
1373
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1360
1374
 
1361
1375
 
@@ -1418,6 +1432,7 @@
1418
1432
 
1419
1433
 
1420
1434
 
1435
+
1421
1436
 
1422
1437
 
1423
1438
 
@@ -1491,6 +1506,8 @@
1491
1506
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1492
1507
 
1493
1508
 
1509
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1510
+
1494
1511
  </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">
1495
1512
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1496
1513
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1501,14 +1518,15 @@
1501
1518
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1502
1519
 
1503
1520
  <!-- Normative references -->
1504
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1521
+ <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"/>
1505
1522
  <!-- Terms and definitions -->
1506
1523
  <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"/>
1507
1524
  <!-- Another main sections -->
1508
1525
  <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"/>
1509
1526
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1510
1527
  <!-- Bibliography -->
1511
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1528
+ <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"/>
1529
+
1512
1530
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1513
1531
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1514
1532
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1544,13 +1562,15 @@
1544
1562
  <xsl:variable name="table">
1545
1563
 
1546
1564
  <xsl:variable name="simple-table">
1547
- <xsl:call-template name="getSimpleTable"/>
1565
+ <xsl:call-template name="getSimpleTable"/>
1548
1566
  </xsl:variable>
1549
1567
 
1550
1568
  <!-- <xsl:if test="$namespace = 'bipm'">
1551
- <fo:block>&#xA0;</fo:block>
1569
+ <fo:block>&#xA0;</fo:block>
1552
1570
  </xsl:if> -->
1553
1571
 
1572
+
1573
+ <!-- Display table's name before table as standalone block -->
1554
1574
  <!-- $namespace = 'iso' or -->
1555
1575
 
1556
1576
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1630,6 +1650,12 @@
1630
1650
 
1631
1651
 
1632
1652
 
1653
+
1654
+
1655
+
1656
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1657
+
1658
+
1633
1659
  <xsl:variable name="table_width">
1634
1660
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1635
1661
  100%
@@ -1648,6 +1674,7 @@
1648
1674
 
1649
1675
 
1650
1676
 
1677
+
1651
1678
 
1652
1679
 
1653
1680
 
@@ -1657,6 +1684,7 @@
1657
1684
 
1658
1685
 
1659
1686
 
1687
+
1660
1688
  </xsl:variable>
1661
1689
 
1662
1690
 
@@ -1798,6 +1826,9 @@
1798
1826
  <fo:block xsl:use-attribute-sets="table-name-style">
1799
1827
 
1800
1828
 
1829
+
1830
+
1831
+
1801
1832
  <xsl:choose>
1802
1833
  <xsl:when test="$continued = 'true'">
1803
1834
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -1945,6 +1976,7 @@
1945
1976
  <!-- font-weight="bold" -->
1946
1977
  <fo:table-header>
1947
1978
 
1979
+
1948
1980
  <xsl:apply-templates/>
1949
1981
  </fo:table-header>
1950
1982
  </xsl:template><xsl:template name="table-header-title">
@@ -2069,6 +2101,8 @@
2069
2101
  </xsl:choose>
2070
2102
  </xsl:for-each>
2071
2103
 
2104
+
2105
+
2072
2106
  <xsl:choose>
2073
2107
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2074
2108
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2095,6 +2129,7 @@
2095
2129
 
2096
2130
 
2097
2131
 
2132
+
2098
2133
  <!-- fn will be processed inside 'note' processing -->
2099
2134
 
2100
2135
 
@@ -2103,6 +2138,11 @@
2103
2138
 
2104
2139
 
2105
2140
 
2141
+
2142
+
2143
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2144
+
2145
+
2106
2146
  <!-- except gb -->
2107
2147
 
2108
2148
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2128,6 +2168,10 @@
2128
2168
  <!-- fn processing -->
2129
2169
  <xsl:call-template name="fn_display"/>
2130
2170
 
2171
+
2172
+ <!-- for PAS display Notes after footnotes -->
2173
+
2174
+
2131
2175
  </fo:table-cell>
2132
2176
  </fo:table-row>
2133
2177
  </fo:table-body>
@@ -2181,15 +2225,24 @@
2181
2225
 
2182
2226
 
2183
2227
 
2228
+
2229
+
2184
2230
  </xsl:if>
2185
2231
  <xsl:if test="$parent-name = 'tfoot'">
2186
2232
 
2187
2233
 
2234
+
2188
2235
  </xsl:if>
2189
2236
 
2190
2237
 
2191
2238
 
2192
2239
 
2240
+
2241
+
2242
+
2243
+
2244
+
2245
+
2193
2246
  <!-- <xsl:if test="$namespace = 'bipm'">
2194
2247
  <xsl:attribute name="height">8mm</xsl:attribute>
2195
2248
  </xsl:if> -->
@@ -2277,6 +2330,10 @@
2277
2330
 
2278
2331
 
2279
2332
 
2333
+
2334
+
2335
+
2336
+
2280
2337
  <xsl:if test=".//*[local-name() = 'table']">
2281
2338
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2282
2339
  </xsl:if>
@@ -2304,12 +2361,18 @@
2304
2361
 
2305
2362
 
2306
2363
 
2364
+
2307
2365
  <xsl:attribute name="font-size">12pt</xsl:attribute>
2308
2366
 
2309
2367
 
2310
2368
 
2369
+
2370
+ <!-- Table's note name (NOTE, for example) -->
2371
+
2311
2372
  <fo:inline padding-right="2mm">
2312
2373
 
2374
+
2375
+
2313
2376
 
2314
2377
  <xsl:attribute name="font-size">11pt</xsl:attribute>
2315
2378
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
@@ -2320,6 +2383,8 @@
2320
2383
 
2321
2384
  </fo:inline>
2322
2385
 
2386
+
2387
+
2323
2388
  <xsl:apply-templates mode="process"/>
2324
2389
  </fo:block>
2325
2390
 
@@ -2339,6 +2404,8 @@
2339
2404
  <xsl:variable name="reference" select="@reference"/>
2340
2405
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2341
2406
  <fo:block margin-bottom="12pt">
2407
+
2408
+
2342
2409
 
2343
2410
 
2344
2411
 
@@ -2354,9 +2421,11 @@
2354
2421
 
2355
2422
 
2356
2423
 
2424
+
2357
2425
  <xsl:value-of select="@reference"/>
2358
2426
 
2359
2427
 
2428
+
2360
2429
  </fo:inline>
2361
2430
  <fo:inline>
2362
2431
 
@@ -2497,11 +2566,16 @@
2497
2566
 
2498
2567
 
2499
2568
 
2569
+
2570
+
2571
+
2572
+
2500
2573
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2501
2574
 
2502
2575
 
2503
2576
  <xsl:value-of select="@reference"/>
2504
2577
 
2578
+
2505
2579
  </fo:basic-link>
2506
2580
  </fo:inline>
2507
2581
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2803,6 +2877,7 @@
2803
2877
 
2804
2878
  <fo:table-row>
2805
2879
 
2880
+
2806
2881
  <fo:table-cell>
2807
2882
 
2808
2883
  <fo:block margin-top="6pt">
@@ -2821,6 +2896,7 @@
2821
2896
 
2822
2897
 
2823
2898
 
2899
+
2824
2900
  <xsl:apply-templates/>
2825
2901
  <!-- <xsl:if test="$namespace = 'gb'">
2826
2902
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3368,7 +3444,15 @@
3368
3444
  <xsl:copy>
3369
3445
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3370
3446
  </xsl:copy>
3371
- <mathml:mspace width="0.5ex"/>
3447
+ <xsl:choose>
3448
+ <!-- if in msub, then don't add space -->
3449
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3450
+ <!-- if next char in digit, don't add space -->
3451
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3452
+ <xsl:otherwise>
3453
+ <mathml:mspace width="0.5ex"/>
3454
+ </xsl:otherwise>
3455
+ </xsl:choose>
3372
3456
  </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">
3373
3457
  <xsl:variable name="target">
3374
3458
  <xsl:choose>
@@ -3392,6 +3476,8 @@
3392
3476
  </xsl:variable>
3393
3477
  <fo:inline xsl:use-attribute-sets="link-style">
3394
3478
 
3479
+
3480
+
3395
3481
  <xsl:choose>
3396
3482
  <xsl:when test="$target_text = ''">
3397
3483
  <xsl:apply-templates/>
@@ -3500,6 +3586,7 @@
3500
3586
 
3501
3587
 
3502
3588
 
3589
+
3503
3590
  <fo:block-container margin-left="0mm">
3504
3591
 
3505
3592
 
@@ -3547,6 +3634,7 @@
3547
3634
  </xsl:choose>
3548
3635
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3549
3636
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3637
+
3550
3638
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3551
3639
 
3552
3640
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3620,6 +3708,7 @@
3620
3708
  </xsl:call-template>
3621
3709
 
3622
3710
  <fo:block>
3711
+
3623
3712
  <xsl:apply-templates/>
3624
3713
  </fo:block>
3625
3714
  <xsl:call-template name="fn_display_figure"/>
@@ -3674,7 +3763,24 @@
3674
3763
  </fo:instream-foreign-object>
3675
3764
  </xsl:when>
3676
3765
  <xsl:otherwise>
3677
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3766
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3767
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3768
+
3769
+ <xsl:variable name="img_src">
3770
+ <xsl:choose>
3771
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3772
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3773
+ </xsl:choose>
3774
+ </xsl:variable>
3775
+
3776
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3777
+ <xsl:if test="number($scale) &lt; 100">
3778
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3779
+ </xsl:if>
3780
+
3781
+ </xsl:if>
3782
+
3783
+ </fo:external-graphic>
3678
3784
  </xsl:otherwise>
3679
3785
  </xsl:choose>
3680
3786
 
@@ -3742,6 +3848,253 @@
3742
3848
  <xsl:param name="height"/>
3743
3849
  <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; "/>
3744
3850
  <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; "/>
3851
+ </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">
3852
+ <xsl:param name="name"/>
3853
+
3854
+ <xsl:variable name="svg_content">
3855
+ <xsl:apply-templates select="." mode="svg_update"/>
3856
+ </xsl:variable>
3857
+
3858
+ <xsl:variable name="alt-text">
3859
+ <xsl:choose>
3860
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3861
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3862
+ </xsl:when>
3863
+ <xsl:when test="normalize-space($name) != ''">
3864
+ <xsl:value-of select="$name"/>
3865
+ </xsl:when>
3866
+ <xsl:otherwise>Figure</xsl:otherwise>
3867
+ </xsl:choose>
3868
+ </xsl:variable>
3869
+
3870
+ <xsl:choose>
3871
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3872
+ <fo:block>
3873
+ <xsl:variable name="width" select="@width"/>
3874
+ <xsl:variable name="height" select="@height"/>
3875
+
3876
+ <xsl:variable name="scale_x">
3877
+ <xsl:choose>
3878
+ <xsl:when test="$width &gt; $width_effective_px">
3879
+ <xsl:value-of select="$width_effective_px div $width"/>
3880
+ </xsl:when>
3881
+ <xsl:otherwise>1</xsl:otherwise>
3882
+ </xsl:choose>
3883
+ </xsl:variable>
3884
+
3885
+ <xsl:variable name="scale_y">
3886
+ <xsl:choose>
3887
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3888
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3889
+ </xsl:when>
3890
+ <xsl:otherwise>1</xsl:otherwise>
3891
+ </xsl:choose>
3892
+ </xsl:variable>
3893
+
3894
+ <xsl:variable name="scale">
3895
+ <xsl:choose>
3896
+ <xsl:when test="$scale_y != 1">
3897
+ <xsl:value-of select="$scale_x * $scale_y"/>
3898
+ </xsl:when>
3899
+ <xsl:otherwise>
3900
+ <xsl:value-of select="$scale_x"/>
3901
+ </xsl:otherwise>
3902
+ </xsl:choose>
3903
+ </xsl:variable>
3904
+
3905
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3906
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3907
+
3908
+ <fo:table table-layout="fixed" width="100%">
3909
+ <fo:table-column column-width="proportional-column-width(1)"/>
3910
+ <fo:table-column column-width="{$width_scale}px"/>
3911
+ <fo:table-column column-width="proportional-column-width(1)"/>
3912
+ <fo:table-body>
3913
+ <fo:table-row>
3914
+ <fo:table-cell column-number="2">
3915
+ <fo:block>
3916
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3917
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3918
+ <fo:block line-height="0" font-size="0">
3919
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3920
+ <xsl:call-template name="bookmark"/>
3921
+ </xsl:for-each>
3922
+ </fo:block>
3923
+ </xsl:if>
3924
+ <fo:block text-depth="0" line-height="0" font-size="0">
3925
+
3926
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3927
+ <xsl:attribute name="width">100%</xsl:attribute>
3928
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3929
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3930
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3931
+
3932
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3933
+ </fo:instream-foreign-object>
3934
+ </fo:block>
3935
+
3936
+ <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">
3937
+ <xsl:with-param name="scale" select="$scale"/>
3938
+ </xsl:apply-templates>
3939
+ </fo:block-container>
3940
+ </fo:block>
3941
+ </fo:table-cell>
3942
+ </fo:table-row>
3943
+ </fo:table-body>
3944
+ </fo:table>
3945
+ </fo:block>
3946
+
3947
+ </xsl:when>
3948
+ <xsl:otherwise>
3949
+ <fo:block xsl:use-attribute-sets="image-style">
3950
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3951
+ <xsl:attribute name="width">100%</xsl:attribute>
3952
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3953
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3954
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3955
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3956
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3957
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3958
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3959
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3960
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3961
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3962
+ </xsl:if>
3963
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3964
+ <xsl:copy-of select="$svg_content"/>
3965
+ </fo:instream-foreign-object>
3966
+ </fo:block>
3967
+ </xsl:otherwise>
3968
+ </xsl:choose>
3969
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3970
+ <xsl:copy>
3971
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3972
+ </xsl:copy>
3973
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3974
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3975
+ <xsl:value-of select="."/>
3976
+ </xsl:attribute>
3977
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3978
+ <xsl:copy>
3979
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3980
+ <xsl:variable name="viewbox">
3981
+ <xsl:call-template name="split">
3982
+ <xsl:with-param name="pText" select="@viewBox"/>
3983
+ <xsl:with-param name="sep" select="' '"/>
3984
+ </xsl:call-template>
3985
+ </xsl:variable>
3986
+ <xsl:attribute name="width">
3987
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3988
+ </xsl:attribute>
3989
+ <xsl:attribute name="height">
3990
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3991
+ </xsl:attribute>
3992
+ <xsl:apply-templates mode="svg_update"/>
3993
+ </xsl:copy>
3994
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3995
+ <xsl:variable name="svg_content" select="document(@src)"/>
3996
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3997
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3998
+ <xsl:call-template name="image_svg">
3999
+ <xsl:with-param name="name" select="$name"/>
4000
+ </xsl:call-template>
4001
+ </xsl:for-each>
4002
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
4003
+ <xsl:copy>
4004
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
4005
+ </xsl:copy>
4006
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
4007
+ <xsl:apply-templates mode="svg_remove_a"/>
4008
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
4009
+ <xsl:param name="scale"/>
4010
+ <xsl:variable name="dest">
4011
+ <xsl:choose>
4012
+ <xsl:when test="starts-with(@href, '#')">
4013
+ <xsl:value-of select="substring-after(@href, '#')"/>
4014
+ </xsl:when>
4015
+ <xsl:otherwise>
4016
+ <xsl:value-of select="@href"/>
4017
+ </xsl:otherwise>
4018
+ </xsl:choose>
4019
+ </xsl:variable>
4020
+ <xsl:for-each select="./*[local-name() = 'rect']">
4021
+ <xsl:call-template name="insertSVGMapLink">
4022
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
4023
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
4024
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
4025
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
4026
+ <xsl:with-param name="dest" select="$dest"/>
4027
+ </xsl:call-template>
4028
+ </xsl:for-each>
4029
+
4030
+ <xsl:for-each select="./*[local-name() = 'polygon']">
4031
+ <xsl:variable name="points">
4032
+ <xsl:call-template name="split">
4033
+ <xsl:with-param name="pText" select="@points"/>
4034
+ </xsl:call-template>
4035
+ </xsl:variable>
4036
+ <xsl:variable name="x_coords">
4037
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
4038
+ <xsl:sort select="." data-type="number"/>
4039
+ <x><xsl:value-of select="."/></x>
4040
+ </xsl:for-each>
4041
+ </xsl:variable>
4042
+ <xsl:variable name="y_coords">
4043
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
4044
+ <xsl:sort select="." data-type="number"/>
4045
+ <y><xsl:value-of select="."/></y>
4046
+ </xsl:for-each>
4047
+ </xsl:variable>
4048
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
4049
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
4050
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
4051
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
4052
+ <xsl:call-template name="insertSVGMapLink">
4053
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4054
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4055
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4056
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4057
+ <xsl:with-param name="dest" select="$dest"/>
4058
+ </xsl:call-template>
4059
+ </xsl:for-each>
4060
+
4061
+ <xsl:for-each select="./*[local-name() = 'circle']">
4062
+ <xsl:call-template name="insertSVGMapLink">
4063
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4064
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4065
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4066
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4067
+ <xsl:with-param name="dest" select="$dest"/>
4068
+ </xsl:call-template>
4069
+ </xsl:for-each>
4070
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4071
+ <xsl:call-template name="insertSVGMapLink">
4072
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4073
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4074
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4075
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4076
+ <xsl:with-param name="dest" select="$dest"/>
4077
+ </xsl:call-template>
4078
+ </xsl:for-each>
4079
+ </xsl:template><xsl:template name="insertSVGMapLink">
4080
+ <xsl:param name="left"/>
4081
+ <xsl:param name="top"/>
4082
+ <xsl:param name="width"/>
4083
+ <xsl:param name="height"/>
4084
+ <xsl:param name="dest"/>
4085
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4086
+ <fo:block font-size="1pt">
4087
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4088
+ <fo:inline-container inline-progression-dimension="100%">
4089
+ <fo:block-container height="{$height - 1}px" width="100%">
4090
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4091
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4092
+ </xsl:if> -->
4093
+ <fo:block> </fo:block></fo:block-container>
4094
+ </fo:inline-container>
4095
+ </fo:basic-link>
4096
+ </fo:block>
4097
+ </fo:block-container>
3745
4098
  </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">
3746
4099
  <xsl:apply-templates mode="contents"/>
3747
4100
  <xsl:text> </xsl:text>
@@ -3770,28 +4123,39 @@
3770
4123
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3771
4124
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3772
4125
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4126
+ <xsl:if test="@bundle = 'true'">
4127
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4128
+ </xsl:if>
3773
4129
  <fo:bookmark-title>
3774
- <xsl:variable name="bookmark-title_">
3775
- <xsl:call-template name="getLangVersion">
3776
- <xsl:with-param name="lang" select="@lang"/>
3777
- <xsl:with-param name="doctype" select="@doctype"/>
3778
- <xsl:with-param name="title" select="@title-part"/>
3779
- </xsl:call-template>
3780
- </xsl:variable>
3781
4130
  <xsl:choose>
3782
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3783
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3784
- </xsl:when>
3785
- <xsl:otherwise>
4131
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4132
+ <xsl:variable name="bookmark-title_">
4133
+ <xsl:call-template name="getLangVersion">
4134
+ <xsl:with-param name="lang" select="@lang"/>
4135
+ <xsl:with-param name="doctype" select="@doctype"/>
4136
+ <xsl:with-param name="title" select="@title-part"/>
4137
+ </xsl:call-template>
4138
+ </xsl:variable>
3786
4139
  <xsl:choose>
3787
- <xsl:when test="@lang = 'en'">English</xsl:when>
3788
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3789
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3790
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4140
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4141
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4142
+ </xsl:when>
4143
+ <xsl:otherwise>
4144
+ <xsl:choose>
4145
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4146
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4147
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4148
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4149
+ </xsl:choose>
4150
+ </xsl:otherwise>
3791
4151
  </xsl:choose>
4152
+ </xsl:when>
4153
+ <xsl:otherwise>
4154
+ <xsl:value-of select="@title-part"/>
3792
4155
  </xsl:otherwise>
3793
4156
  </xsl:choose>
3794
4157
  </fo:bookmark-title>
4158
+
3795
4159
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3796
4160
 
3797
4161
  <xsl:call-template name="insertFigureBookmarks">
@@ -3890,20 +4254,28 @@
3890
4254
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3891
4255
  </xsl:choose>
3892
4256
  </xsl:template><xsl:template match="item" mode="bookmark">
3893
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3894
- <fo:bookmark-title>
3895
- <xsl:if test="@section != ''">
3896
- <xsl:value-of select="@section"/>
3897
- <xsl:text> </xsl:text>
3898
- </xsl:if>
3899
- <xsl:value-of select="normalize-space(title)"/>
3900
- </fo:bookmark-title>
3901
- <xsl:apply-templates mode="bookmark"/>
3902
- </fo:bookmark>
4257
+ <xsl:choose>
4258
+ <xsl:when test="@id != ''">
4259
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4260
+ <fo:bookmark-title>
4261
+ <xsl:if test="@section != ''">
4262
+ <xsl:value-of select="@section"/>
4263
+ <xsl:text> </xsl:text>
4264
+ </xsl:if>
4265
+ <xsl:value-of select="normalize-space(title)"/>
4266
+ </fo:bookmark-title>
4267
+ <xsl:apply-templates mode="bookmark"/>
4268
+ </fo:bookmark>
4269
+ </xsl:when>
4270
+ <xsl:otherwise>
4271
+ <xsl:apply-templates mode="bookmark"/>
4272
+ </xsl:otherwise>
4273
+ </xsl:choose>
3903
4274
  </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">
3904
4275
  <xsl:if test="normalize-space() != ''">
3905
4276
  <fo:block xsl:use-attribute-sets="figure-name-style">
3906
4277
 
4278
+
3907
4279
  <xsl:apply-templates/>
3908
4280
  </fo:block>
3909
4281
  </xsl:if>
@@ -3984,6 +4356,7 @@
3984
4356
 
3985
4357
  <fo:block-container margin-left="0mm">
3986
4358
  <xsl:copy-of select="@id"/>
4359
+
3987
4360
  <xsl:if test="parent::*[local-name() = 'note']">
3988
4361
  <xsl:attribute name="margin-left">
3989
4362
  <xsl:choose>
@@ -3994,7 +4367,9 @@
3994
4367
 
3995
4368
  </xsl:if>
3996
4369
  <fo:block-container margin-left="0mm">
3997
-
4370
+
4371
+
4372
+
3998
4373
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3999
4374
  <xsl:variable name="_font-size">
4000
4375
 
@@ -4023,10 +4398,14 @@
4023
4398
  </xsl:choose>
4024
4399
  </xsl:attribute>
4025
4400
  </xsl:if>
4026
- <xsl:apply-templates/>
4027
- </fo:block>
4401
+
4402
+ <xsl:apply-templates/>
4403
+ </fo:block>
4404
+
4405
+
4028
4406
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4029
4407
 
4408
+
4030
4409
  </fo:block-container>
4031
4410
  </fo:block-container>
4032
4411
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4372,6 +4751,8 @@
4372
4751
 
4373
4752
 
4374
4753
 
4754
+
4755
+
4375
4756
  <xsl:call-template name="getTitle">
4376
4757
  <xsl:with-param name="name" select="'title-source'"/>
4377
4758
  </xsl:call-template>
@@ -4448,7 +4829,9 @@
4448
4829
 
4449
4830
 
4450
4831
  </xsl:if>
4451
-
4832
+
4833
+
4834
+
4452
4835
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4453
4836
  <xsl:if test="normalize-space(@citeas) = ''">
4454
4837
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4460,6 +4843,7 @@
4460
4843
 
4461
4844
 
4462
4845
 
4846
+
4463
4847
  </xsl:if>
4464
4848
 
4465
4849
  <xsl:apply-templates/>
@@ -4601,6 +4985,7 @@
4601
4985
  <xsl:call-template name="setId"/>
4602
4986
 
4603
4987
 
4988
+
4604
4989
  <xsl:apply-templates/>
4605
4990
  </fo:block>
4606
4991
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4946,17 +5331,17 @@
4946
5331
  <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')]"/>
4947
5332
  <xsl:choose>
4948
5333
  <xsl:when test="normalize-space($_doc_ident) != ''">
4949
- <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"/>
5334
+ <!-- <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"/>
4950
5335
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4951
5336
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4952
- </xsl:if>
5337
+ </xsl:if> -->
4953
5338
  <xsl:value-of select="$_doc_ident"/>
4954
5339
  </xsl:when>
4955
5340
  <xsl:otherwise>
4956
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5341
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4957
5342
  <xsl:if test="$type != ''">
4958
5343
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4959
- </xsl:if>
5344
+ </xsl:if> -->
4960
5345
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4961
5346
  </xsl:otherwise>
4962
5347
  </xsl:choose>
@@ -5397,20 +5782,40 @@
5397
5782
  </xsl:call-template>
5398
5783
  </xsl:if>
5399
5784
  </xsl:template><xsl:template name="getLocalizedString">
5400
- <xsl:param name="key"/>
5785
+ <xsl:param name="key"/>
5786
+ <xsl:param name="formatted">false</xsl:param>
5401
5787
 
5402
5788
  <xsl:variable name="curr_lang">
5403
5789
  <xsl:call-template name="getLang"/>
5404
5790
  </xsl:variable>
5405
5791
 
5406
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5792
+ <xsl:variable name="data_value">
5793
+ <xsl:choose>
5794
+ <xsl:when test="$formatted = 'true'">
5795
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5796
+ </xsl:when>
5797
+ <xsl:otherwise>
5798
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5799
+ </xsl:otherwise>
5800
+ </xsl:choose>
5801
+ </xsl:variable>
5407
5802
 
5408
5803
  <xsl:choose>
5409
- <xsl:when test="$data_value != ''">
5410
- <xsl:value-of select="$data_value"/>
5804
+ <xsl:when test="normalize-space($data_value) != ''">
5805
+ <xsl:choose>
5806
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5807
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5808
+ </xsl:choose>
5411
5809
  </xsl:when>
5412
5810
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5413
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5811
+ <xsl:choose>
5812
+ <xsl:when test="$formatted = 'true'">
5813
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5814
+ </xsl:when>
5815
+ <xsl:otherwise>
5816
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5817
+ </xsl:otherwise>
5818
+ </xsl:choose>
5414
5819
  </xsl:when>
5415
5820
  <xsl:otherwise>
5416
5821
  <xsl:variable name="key_">
@@ -5421,7 +5826,7 @@
5421
5826
  <xsl:value-of select="$key_"/>
5422
5827
  </xsl:otherwise>
5423
5828
  </xsl:choose>
5424
-
5829
+
5425
5830
  </xsl:template><xsl:template name="setTrackChangesStyles">
5426
5831
  <xsl:param name="isAdded"/>
5427
5832
  <xsl:param name="isDeleted"/>
@@ -5462,4 +5867,110 @@
5462
5867
  <xsl:value-of select="$align"/>
5463
5868
  </xsl:when>
5464
5869
  </xsl:choose>
5870
+ </xsl:template><xsl:template name="setTextAlignment">
5871
+ <xsl:param name="default">left</xsl:param>
5872
+ <xsl:attribute name="text-align">
5873
+ <xsl:choose>
5874
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5875
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5876
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5877
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5878
+ </xsl:choose>
5879
+ </xsl:attribute>
5880
+ </xsl:template><xsl:template name="number-to-words">
5881
+ <xsl:param name="number"/>
5882
+ <xsl:param name="first"/>
5883
+ <xsl:if test="$number != ''">
5884
+ <xsl:variable name="words">
5885
+ <words>
5886
+ <word cardinal="1">One-</word>
5887
+ <word ordinal="1">First </word>
5888
+ <word cardinal="2">Two-</word>
5889
+ <word ordinal="2">Second </word>
5890
+ <word cardinal="3">Three-</word>
5891
+ <word ordinal="3">Third </word>
5892
+ <word cardinal="4">Four-</word>
5893
+ <word ordinal="4">Fourth </word>
5894
+ <word cardinal="5">Five-</word>
5895
+ <word ordinal="5">Fifth </word>
5896
+ <word cardinal="6">Six-</word>
5897
+ <word ordinal="6">Sixth </word>
5898
+ <word cardinal="7">Seven-</word>
5899
+ <word ordinal="7">Seventh </word>
5900
+ <word cardinal="8">Eight-</word>
5901
+ <word ordinal="8">Eighth </word>
5902
+ <word cardinal="9">Nine-</word>
5903
+ <word ordinal="9">Ninth </word>
5904
+ <word ordinal="10">Tenth </word>
5905
+ <word ordinal="11">Eleventh </word>
5906
+ <word ordinal="12">Twelfth </word>
5907
+ <word ordinal="13">Thirteenth </word>
5908
+ <word ordinal="14">Fourteenth </word>
5909
+ <word ordinal="15">Fifteenth </word>
5910
+ <word ordinal="16">Sixteenth </word>
5911
+ <word ordinal="17">Seventeenth </word>
5912
+ <word ordinal="18">Eighteenth </word>
5913
+ <word ordinal="19">Nineteenth </word>
5914
+ <word cardinal="20">Twenty-</word>
5915
+ <word ordinal="20">Twentieth </word>
5916
+ <word cardinal="30">Thirty-</word>
5917
+ <word ordinal="30">Thirtieth </word>
5918
+ <word cardinal="40">Forty-</word>
5919
+ <word ordinal="40">Fortieth </word>
5920
+ <word cardinal="50">Fifty-</word>
5921
+ <word ordinal="50">Fiftieth </word>
5922
+ <word cardinal="60">Sixty-</word>
5923
+ <word ordinal="60">Sixtieth </word>
5924
+ <word cardinal="70">Seventy-</word>
5925
+ <word ordinal="70">Seventieth </word>
5926
+ <word cardinal="80">Eighty-</word>
5927
+ <word ordinal="80">Eightieth </word>
5928
+ <word cardinal="90">Ninety-</word>
5929
+ <word ordinal="90">Ninetieth </word>
5930
+ <word cardinal="100">Hundred-</word>
5931
+ <word ordinal="100">Hundredth </word>
5932
+ </words>
5933
+ </xsl:variable>
5934
+
5935
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5936
+
5937
+ <xsl:variable name="value">
5938
+ <xsl:choose>
5939
+ <xsl:when test="$ordinal != ''">
5940
+ <xsl:value-of select="$ordinal"/>
5941
+ </xsl:when>
5942
+ <xsl:otherwise>
5943
+ <xsl:choose>
5944
+ <xsl:when test="$number &lt; 100">
5945
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5946
+ <xsl:variable name="digit" select="substring($number,2)"/>
5947
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5948
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5949
+ </xsl:when>
5950
+ <xsl:otherwise>
5951
+ <!-- more 100 -->
5952
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5953
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5954
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5955
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5956
+ <xsl:call-template name="number-to-words">
5957
+ <xsl:with-param name="number" select="$digits"/>
5958
+ </xsl:call-template>
5959
+ </xsl:otherwise>
5960
+ </xsl:choose>
5961
+ </xsl:otherwise>
5962
+ </xsl:choose>
5963
+ </xsl:variable>
5964
+ <xsl:choose>
5965
+ <xsl:when test="$first = 'true'">
5966
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5967
+ <xsl:call-template name="capitalize">
5968
+ <xsl:with-param name="str" select="$value_lc"/>
5969
+ </xsl:call-template>
5970
+ </xsl:when>
5971
+ <xsl:otherwise>
5972
+ <xsl:value-of select="$value"/>
5973
+ </xsl:otherwise>
5974
+ </xsl:choose>
5975
+ </xsl:if>
5465
5976
  </xsl:template></xsl:stylesheet>