metanorma-un 0.6.4 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e71f536abb0db67acc17cc170df30bc5bf75f08dd77b1ed422be2f9adc508224
4
- data.tar.gz: 1e35c83a41170225d7ba66249d46a3f508fcf8037c668f9c1829fcfe1a9a21e2
3
+ metadata.gz: aebf3c6706cfb9ddeb3383122c3024ce95df446858775f8054c293a9906c02cc
4
+ data.tar.gz: 0d6826ce4771d8d6b5d235308026177ce41888a8dfc21349bd2b3a0aeb227a7e
5
5
  SHA512:
6
- metadata.gz: c82c6e187908b68c2bd5966c30b57a91a9e2684ee81ef37108e35cc080c53f18740f327060324b8f3245b92310f2abc3b9b64a1ed3d6f97dde72fe566ce09e78
7
- data.tar.gz: e25b815d746e0dc5ff056a0fefe47719a279ec32bdd1003102ce11bda1ec61ab622f3599b3dcc4df181b3b9d99979bd62adafc34845161dde69f7670bc3e8230
6
+ metadata.gz: 25c47d32f0deeddaad8160e391f5c421c6cfffc555cbaa0239682c75a3c798ea484e154ffe11d9a5696e32bbc16ab587eaec2b1bfc6ab27af470fae824481f35
7
+ data.tar.gz: d5ecc5209fee4731f50317763bff7d327bf794032ae3bef01fdddedc23ab40b6dc20a9ab281d4d86126103578a880ca8b25d8b6c6e869860e950eaa81a6f2295
@@ -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>
@@ -11,8 +11,12 @@
11
11
 
12
12
 
13
13
 
14
- <xsl:variable name="pageWidth" select="'210mm'"/>
15
- <xsl:variable name="pageHeight" select="'297mm'"/>
14
+ <xsl:variable name="pageWidth" select="210"/>
15
+ <xsl:variable name="pageHeight" select="297"/>
16
+ <xsl:variable name="marginLeftRight1" select="40"/>
17
+ <xsl:variable name="marginLeftRight2" select="40"/>
18
+ <xsl:variable name="marginTop" select="30"/>
19
+ <xsl:variable name="marginBottom" select="40"/>
16
20
 
17
21
  <xsl:variable name="debug">false</xsl:variable>
18
22
 
@@ -42,7 +46,7 @@
42
46
  <fo:root font-family="Times New Roman, STIX Two Math, Source Han Sans" font-size="10pt" xml:lang="{$lang}">
43
47
  <fo:layout-master-set>
44
48
  <!-- Cover page -->
45
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
49
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
46
50
  <fo:region-body margin-top="17.5mm" margin-bottom="10mm" margin-left="20mm" margin-right="20mm"/>
47
51
  <fo:region-before extent="17.5mm"/>
48
52
  <fo:region-after extent="10mm"/>
@@ -51,20 +55,20 @@
51
55
  </fo:simple-page-master>
52
56
 
53
57
  <!-- Document odd pages -->
54
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
55
- <fo:region-body margin-top="30mm" margin-bottom="40mm" margin-left="40mm" margin-right="40mm"/>
58
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
59
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
56
60
  <fo:region-before region-name="header-odd" extent="26mm"/>
57
- <fo:region-after region-name="footer-odd" extent="40mm"/>
58
- <fo:region-start region-name="left-region" extent="40mm"/>
59
- <fo:region-end region-name="right-region" extent="40mm"/>
61
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
62
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
63
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
60
64
  </fo:simple-page-master>
61
65
  <!-- Document even pages -->
62
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
63
- <fo:region-body margin-top="30mm" margin-bottom="40mm" margin-left="40mm" margin-right="40mm"/>
66
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
67
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
64
68
  <fo:region-before region-name="header-even" extent="26mm"/>
65
- <fo:region-after region-name="footer-even" extent="40mm"/>
66
- <fo:region-start region-name="left-region" extent="40mm"/>
67
- <fo:region-end region-name="right-region" extent="40mm"/>
69
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
70
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
71
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
68
72
  </fo:simple-page-master>
69
73
  <fo:page-sequence-master master-name="document">
70
74
  <fo:repeatable-page-master-alternatives>
@@ -1069,103 +1073,6 @@
1069
1073
  </xsl:template>
1070
1074
 
1071
1075
 
1072
- <xsl:template name="number-to-words">
1073
- <xsl:param name="number"/>
1074
- <xsl:param name="first"/>
1075
- <xsl:if test="$number != ''">
1076
- <xsl:variable name="words">
1077
- <words>
1078
- <word cardinal="1">one-</word>
1079
- <word ordinal="1">first </word>
1080
- <word cardinal="2">two-</word>
1081
- <word ordinal="2">second </word>
1082
- <word cardinal="3">three-</word>
1083
- <word ordinal="3">third </word>
1084
- <word cardinal="4">four-</word>
1085
- <word ordinal="4">fourth </word>
1086
- <word cardinal="5">five-</word>
1087
- <word ordinal="5">fifth </word>
1088
- <word cardinal="6">six-</word>
1089
- <word ordinal="6">sixth </word>
1090
- <word cardinal="7">seven-</word>
1091
- <word ordinal="7">seventh </word>
1092
- <word cardinal="8">eight-</word>
1093
- <word ordinal="8">eighth </word>
1094
- <word cardinal="9">nine-</word>
1095
- <word ordinal="9">ninth </word>
1096
- <word ordinal="10">tenth </word>
1097
- <word ordinal="11">eleventh </word>
1098
- <word ordinal="12">twelfth </word>
1099
- <word ordinal="13">thirteenth </word>
1100
- <word ordinal="14">fourteenth </word>
1101
- <word ordinal="15">fifteenth </word>
1102
- <word ordinal="16">sixteenth </word>
1103
- <word ordinal="17">seventeenth </word>
1104
- <word ordinal="18">eighteenth </word>
1105
- <word ordinal="19">nineteenth </word>
1106
- <word cardinal="20">twenty-</word>
1107
- <word ordinal="20">twentieth </word>
1108
- <word cardinal="30">thirty-</word>
1109
- <word ordinal="30">thirtieth </word>
1110
- <word cardinal="40">forty-</word>
1111
- <word ordinal="40">fortieth </word>
1112
- <word cardinal="50">fifty-</word>
1113
- <word ordinal="50">fiftieth </word>
1114
- <word cardinal="60">sixty-</word>
1115
- <word ordinal="60">sixtieth </word>
1116
- <word cardinal="70">seventy-</word>
1117
- <word ordinal="70">seventieth </word>
1118
- <word cardinal="80">eighty-</word>
1119
- <word ordinal="80">eightieth </word>
1120
- <word cardinal="90">ninety-</word>
1121
- <word ordinal="90">ninetieth </word>
1122
- <word cardinal="100">hundred-</word>
1123
- <word ordinal="100">hundredth </word>
1124
- </words>
1125
- </xsl:variable>
1126
-
1127
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
1128
-
1129
- <xsl:variable name="value">
1130
- <xsl:choose>
1131
- <xsl:when test="$ordinal != ''">
1132
- <xsl:value-of select="$ordinal"/>
1133
- </xsl:when>
1134
- <xsl:otherwise>
1135
- <xsl:choose>
1136
- <xsl:when test="$number &lt; 100">
1137
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
1138
- <xsl:variable name="digit" select="substring($number,2)"/>
1139
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
1140
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
1141
- </xsl:when>
1142
- <xsl:otherwise>
1143
- <!-- more 100 -->
1144
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
1145
- <xsl:variable name="digits" select="number(substring($number,2))"/>
1146
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
1147
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
1148
- <xsl:call-template name="number-to-words">
1149
- <xsl:with-param name="number" select="$digits"/>
1150
- </xsl:call-template>
1151
- </xsl:otherwise>
1152
- </xsl:choose>
1153
- </xsl:otherwise>
1154
- </xsl:choose>
1155
- </xsl:variable>
1156
- <xsl:choose>
1157
- <xsl:when test="$first = 'true'">
1158
- <xsl:call-template name="capitalize">
1159
- <xsl:with-param name="str" select="$value"/>
1160
- </xsl:call-template>
1161
- </xsl:when>
1162
- <xsl:otherwise>
1163
- <xsl:value-of select="$value"/>
1164
- </xsl:otherwise>
1165
- </xsl:choose>
1166
- </xsl:if>
1167
- </xsl:template>
1168
-
1169
1076
  <!-- convert YYYY-MM-DD to (Month YYYY) -->
1170
1077
  <xsl:template name="formatDate">
1171
1078
  <xsl:param name="date"/>
@@ -1406,7 +1313,7 @@
1406
1313
 
1407
1314
 
1408
1315
 
1409
-
1316
+
1410
1317
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1411
1318
 
1412
1319
 
@@ -1471,7 +1378,10 @@
1471
1378
 
1472
1379
 
1473
1380
 
1474
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1381
+
1382
+ </xsl:attribute-set><xsl:variable name="table-border_">
1383
+
1384
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1475
1385
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1476
1386
 
1477
1387
 
@@ -1494,6 +1404,8 @@
1494
1404
 
1495
1405
 
1496
1406
 
1407
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1408
+
1497
1409
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1498
1410
 
1499
1411
 
@@ -1513,6 +1425,7 @@
1513
1425
 
1514
1426
 
1515
1427
 
1428
+
1516
1429
  <xsl:attribute name="color">blue</xsl:attribute>
1517
1430
 
1518
1431
 
@@ -1534,6 +1447,7 @@
1534
1447
 
1535
1448
 
1536
1449
 
1450
+
1537
1451
  </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">
1538
1452
 
1539
1453
 
@@ -1576,10 +1490,12 @@
1576
1490
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
1577
1491
 
1578
1492
 
1493
+
1579
1494
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1580
1495
 
1581
1496
 
1582
1497
 
1498
+
1583
1499
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1584
1500
 
1585
1501
 
@@ -1623,6 +1539,7 @@
1623
1539
 
1624
1540
 
1625
1541
 
1542
+
1626
1543
 
1627
1544
  <xsl:attribute name="text-align">center</xsl:attribute>
1628
1545
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1701,6 +1618,8 @@
1701
1618
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1702
1619
 
1703
1620
 
1621
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1622
+
1704
1623
  </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">
1705
1624
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1706
1625
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1711,14 +1630,15 @@
1711
1630
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1712
1631
 
1713
1632
  <!-- Normative references -->
1714
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1633
+ <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"/>
1715
1634
  <!-- Terms and definitions -->
1716
1635
  <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"/>
1717
1636
  <!-- Another main sections -->
1718
1637
  <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"/>
1719
1638
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1720
1639
  <!-- Bibliography -->
1721
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1640
+ <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"/>
1641
+
1722
1642
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1723
1643
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1724
1644
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1754,13 +1674,15 @@
1754
1674
  <xsl:variable name="table">
1755
1675
 
1756
1676
  <xsl:variable name="simple-table">
1757
- <xsl:call-template name="getSimpleTable"/>
1677
+ <xsl:call-template name="getSimpleTable"/>
1758
1678
  </xsl:variable>
1759
1679
 
1760
1680
  <!-- <xsl:if test="$namespace = 'bipm'">
1761
- <fo:block>&#xA0;</fo:block>
1681
+ <fo:block>&#xA0;</fo:block>
1762
1682
  </xsl:if> -->
1763
1683
 
1684
+
1685
+ <!-- Display table's name before table as standalone block -->
1764
1686
  <!-- $namespace = 'iso' or -->
1765
1687
 
1766
1688
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1839,6 +1761,12 @@
1839
1761
 
1840
1762
 
1841
1763
 
1764
+
1765
+
1766
+
1767
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1768
+
1769
+
1842
1770
  <xsl:variable name="table_width">
1843
1771
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1844
1772
 
@@ -1862,6 +1790,7 @@
1862
1790
 
1863
1791
 
1864
1792
 
1793
+
1865
1794
 
1866
1795
 
1867
1796
 
@@ -1870,6 +1799,7 @@
1870
1799
 
1871
1800
 
1872
1801
 
1802
+
1873
1803
  </xsl:variable>
1874
1804
 
1875
1805
 
@@ -2008,6 +1938,9 @@
2008
1938
  <fo:block xsl:use-attribute-sets="table-name-style">
2009
1939
 
2010
1940
 
1941
+
1942
+
1943
+
2011
1944
  <xsl:choose>
2012
1945
  <xsl:when test="$continued = 'true'">
2013
1946
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -2155,6 +2088,7 @@
2155
2088
  <!-- font-weight="bold" -->
2156
2089
  <fo:table-header>
2157
2090
 
2091
+
2158
2092
  <xsl:apply-templates/>
2159
2093
  </fo:table-header>
2160
2094
  </xsl:template><xsl:template name="table-header-title">
@@ -2279,6 +2213,8 @@
2279
2213
  </xsl:choose>
2280
2214
  </xsl:for-each>
2281
2215
 
2216
+
2217
+
2282
2218
  <xsl:choose>
2283
2219
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2284
2220
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2305,6 +2241,7 @@
2305
2241
 
2306
2242
 
2307
2243
 
2244
+
2308
2245
  <!-- fn will be processed inside 'note' processing -->
2309
2246
 
2310
2247
 
@@ -2313,6 +2250,11 @@
2313
2250
 
2314
2251
 
2315
2252
 
2253
+
2254
+
2255
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2256
+
2257
+
2316
2258
  <!-- except gb -->
2317
2259
 
2318
2260
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2338,6 +2280,10 @@
2338
2280
  <!-- fn processing -->
2339
2281
  <xsl:call-template name="fn_display"/>
2340
2282
 
2283
+
2284
+ <!-- for PAS display Notes after footnotes -->
2285
+
2286
+
2341
2287
  </fo:table-cell>
2342
2288
  </fo:table-row>
2343
2289
  </fo:table-body>
@@ -2391,10 +2337,13 @@
2391
2337
 
2392
2338
 
2393
2339
 
2340
+
2341
+
2394
2342
  </xsl:if>
2395
2343
  <xsl:if test="$parent-name = 'tfoot'">
2396
2344
 
2397
2345
 
2346
+
2398
2347
  </xsl:if>
2399
2348
 
2400
2349
 
@@ -2404,6 +2353,12 @@
2404
2353
 
2405
2354
 
2406
2355
 
2356
+
2357
+
2358
+
2359
+
2360
+
2361
+
2407
2362
  <!-- <xsl:if test="$namespace = 'bipm'">
2408
2363
  <xsl:attribute name="height">8mm</xsl:attribute>
2409
2364
  </xsl:if> -->
@@ -2497,6 +2452,7 @@
2497
2452
 
2498
2453
 
2499
2454
 
2455
+
2500
2456
  <xsl:attribute name="display-align">before</xsl:attribute>
2501
2457
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
2502
2458
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
@@ -2507,6 +2463,9 @@
2507
2463
 
2508
2464
 
2509
2465
 
2466
+
2467
+
2468
+
2510
2469
  <xsl:if test=".//*[local-name() = 'table']">
2511
2470
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2512
2471
  </xsl:if>
@@ -2536,8 +2495,14 @@
2536
2495
 
2537
2496
 
2538
2497
 
2498
+
2499
+
2500
+ <!-- Table's note name (NOTE, for example) -->
2501
+
2539
2502
  <fo:inline padding-right="2mm">
2540
2503
 
2504
+
2505
+
2541
2506
 
2542
2507
 
2543
2508
  <xsl:if test="@type = 'source' or @type = 'abbreviation'">
@@ -2555,6 +2520,8 @@
2555
2520
 
2556
2521
  </fo:inline>
2557
2522
 
2523
+
2524
+
2558
2525
  <xsl:apply-templates mode="process"/>
2559
2526
  </fo:block>
2560
2527
 
@@ -2574,6 +2541,8 @@
2574
2541
  <xsl:variable name="reference" select="@reference"/>
2575
2542
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2576
2543
  <fo:block margin-bottom="12pt">
2544
+
2545
+
2577
2546
 
2578
2547
 
2579
2548
 
@@ -2589,9 +2558,11 @@
2589
2558
 
2590
2559
 
2591
2560
 
2561
+
2592
2562
  <xsl:value-of select="@reference"/>
2593
2563
 
2594
2564
 
2565
+
2595
2566
  </fo:inline>
2596
2567
  <fo:inline>
2597
2568
 
@@ -2732,11 +2703,16 @@
2732
2703
 
2733
2704
 
2734
2705
 
2706
+
2707
+
2708
+
2709
+
2735
2710
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2736
2711
 
2737
2712
 
2738
2713
  <xsl:value-of select="@reference"/>
2739
2714
 
2715
+
2740
2716
  </fo:basic-link>
2741
2717
  </fo:inline>
2742
2718
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3034,6 +3010,7 @@
3034
3010
 
3035
3011
  <fo:table-row>
3036
3012
 
3013
+
3037
3014
  <fo:table-cell>
3038
3015
 
3039
3016
  <fo:block margin-top="6pt">
@@ -3049,6 +3026,7 @@
3049
3026
 
3050
3027
 
3051
3028
 
3029
+
3052
3030
  <xsl:apply-templates/>
3053
3031
  <!-- <xsl:if test="$namespace = 'gb'">
3054
3032
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3596,7 +3574,15 @@
3596
3574
  <xsl:copy>
3597
3575
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3598
3576
  </xsl:copy>
3599
- <mathml:mspace width="0.5ex"/>
3577
+ <xsl:choose>
3578
+ <!-- if in msub, then don't add space -->
3579
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3580
+ <!-- if next char in digit, don't add space -->
3581
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3582
+ <xsl:otherwise>
3583
+ <mathml:mspace width="0.5ex"/>
3584
+ </xsl:otherwise>
3585
+ </xsl:choose>
3600
3586
  </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">
3601
3587
  <xsl:variable name="target">
3602
3588
  <xsl:choose>
@@ -3620,6 +3606,8 @@
3620
3606
  </xsl:variable>
3621
3607
  <fo:inline xsl:use-attribute-sets="link-style">
3622
3608
 
3609
+
3610
+
3623
3611
  <xsl:choose>
3624
3612
  <xsl:when test="$target_text = ''">
3625
3613
  <xsl:apply-templates/>
@@ -3728,6 +3716,7 @@
3728
3716
 
3729
3717
 
3730
3718
 
3719
+
3731
3720
  <fo:block-container margin-left="0mm">
3732
3721
 
3733
3722
 
@@ -3780,6 +3769,7 @@
3780
3769
  </xsl:choose>
3781
3770
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3782
3771
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3772
+
3783
3773
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3784
3774
 
3785
3775
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3857,6 +3847,7 @@
3857
3847
  </xsl:call-template>
3858
3848
 
3859
3849
  <fo:block>
3850
+
3860
3851
  <xsl:apply-templates/>
3861
3852
  </fo:block>
3862
3853
  <xsl:call-template name="fn_display_figure"/>
@@ -3911,7 +3902,24 @@
3911
3902
  </fo:instream-foreign-object>
3912
3903
  </xsl:when>
3913
3904
  <xsl:otherwise>
3914
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3905
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3906
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3907
+
3908
+ <xsl:variable name="img_src">
3909
+ <xsl:choose>
3910
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3911
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3912
+ </xsl:choose>
3913
+ </xsl:variable>
3914
+
3915
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3916
+ <xsl:if test="number($scale) &lt; 100">
3917
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3918
+ </xsl:if>
3919
+
3920
+ </xsl:if>
3921
+
3922
+ </fo:external-graphic>
3915
3923
  </xsl:otherwise>
3916
3924
  </xsl:choose>
3917
3925
 
@@ -3979,6 +3987,253 @@
3979
3987
  <xsl:param name="height"/>
3980
3988
  <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; "/>
3981
3989
  <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; "/>
3990
+ </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">
3991
+ <xsl:param name="name"/>
3992
+
3993
+ <xsl:variable name="svg_content">
3994
+ <xsl:apply-templates select="." mode="svg_update"/>
3995
+ </xsl:variable>
3996
+
3997
+ <xsl:variable name="alt-text">
3998
+ <xsl:choose>
3999
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
4000
+ <xsl:value-of select="../*[local-name() = 'name']"/>
4001
+ </xsl:when>
4002
+ <xsl:when test="normalize-space($name) != ''">
4003
+ <xsl:value-of select="$name"/>
4004
+ </xsl:when>
4005
+ <xsl:otherwise>Figure</xsl:otherwise>
4006
+ </xsl:choose>
4007
+ </xsl:variable>
4008
+
4009
+ <xsl:choose>
4010
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
4011
+ <fo:block>
4012
+ <xsl:variable name="width" select="@width"/>
4013
+ <xsl:variable name="height" select="@height"/>
4014
+
4015
+ <xsl:variable name="scale_x">
4016
+ <xsl:choose>
4017
+ <xsl:when test="$width &gt; $width_effective_px">
4018
+ <xsl:value-of select="$width_effective_px div $width"/>
4019
+ </xsl:when>
4020
+ <xsl:otherwise>1</xsl:otherwise>
4021
+ </xsl:choose>
4022
+ </xsl:variable>
4023
+
4024
+ <xsl:variable name="scale_y">
4025
+ <xsl:choose>
4026
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
4027
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
4028
+ </xsl:when>
4029
+ <xsl:otherwise>1</xsl:otherwise>
4030
+ </xsl:choose>
4031
+ </xsl:variable>
4032
+
4033
+ <xsl:variable name="scale">
4034
+ <xsl:choose>
4035
+ <xsl:when test="$scale_y != 1">
4036
+ <xsl:value-of select="$scale_x * $scale_y"/>
4037
+ </xsl:when>
4038
+ <xsl:otherwise>
4039
+ <xsl:value-of select="$scale_x"/>
4040
+ </xsl:otherwise>
4041
+ </xsl:choose>
4042
+ </xsl:variable>
4043
+
4044
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
4045
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
4046
+
4047
+ <fo:table table-layout="fixed" width="100%">
4048
+ <fo:table-column column-width="proportional-column-width(1)"/>
4049
+ <fo:table-column column-width="{$width_scale}px"/>
4050
+ <fo:table-column column-width="proportional-column-width(1)"/>
4051
+ <fo:table-body>
4052
+ <fo:table-row>
4053
+ <fo:table-cell column-number="2">
4054
+ <fo:block>
4055
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
4056
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4057
+ <fo:block line-height="0" font-size="0">
4058
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4059
+ <xsl:call-template name="bookmark"/>
4060
+ </xsl:for-each>
4061
+ </fo:block>
4062
+ </xsl:if>
4063
+ <fo:block text-depth="0" line-height="0" font-size="0">
4064
+
4065
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4066
+ <xsl:attribute name="width">100%</xsl:attribute>
4067
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4068
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4069
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4070
+
4071
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
4072
+ </fo:instream-foreign-object>
4073
+ </fo:block>
4074
+
4075
+ <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">
4076
+ <xsl:with-param name="scale" select="$scale"/>
4077
+ </xsl:apply-templates>
4078
+ </fo:block-container>
4079
+ </fo:block>
4080
+ </fo:table-cell>
4081
+ </fo:table-row>
4082
+ </fo:table-body>
4083
+ </fo:table>
4084
+ </fo:block>
4085
+
4086
+ </xsl:when>
4087
+ <xsl:otherwise>
4088
+ <fo:block xsl:use-attribute-sets="image-style">
4089
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4090
+ <xsl:attribute name="width">100%</xsl:attribute>
4091
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4092
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4093
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4094
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4095
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4096
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4097
+ <!-- effective height / width = 1.48, 1.4 - with title -->
4098
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4099
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4100
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4101
+ </xsl:if>
4102
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4103
+ <xsl:copy-of select="$svg_content"/>
4104
+ </fo:instream-foreign-object>
4105
+ </fo:block>
4106
+ </xsl:otherwise>
4107
+ </xsl:choose>
4108
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
4109
+ <xsl:copy>
4110
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
4111
+ </xsl:copy>
4112
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
4113
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4114
+ <xsl:value-of select="."/>
4115
+ </xsl:attribute>
4116
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4117
+ <xsl:copy>
4118
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4119
+ <xsl:variable name="viewbox">
4120
+ <xsl:call-template name="split">
4121
+ <xsl:with-param name="pText" select="@viewBox"/>
4122
+ <xsl:with-param name="sep" select="' '"/>
4123
+ </xsl:call-template>
4124
+ </xsl:variable>
4125
+ <xsl:attribute name="width">
4126
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4127
+ </xsl:attribute>
4128
+ <xsl:attribute name="height">
4129
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4130
+ </xsl:attribute>
4131
+ <xsl:apply-templates mode="svg_update"/>
4132
+ </xsl:copy>
4133
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4134
+ <xsl:variable name="svg_content" select="document(@src)"/>
4135
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4136
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
4137
+ <xsl:call-template name="image_svg">
4138
+ <xsl:with-param name="name" select="$name"/>
4139
+ </xsl:call-template>
4140
+ </xsl:for-each>
4141
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
4142
+ <xsl:copy>
4143
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
4144
+ </xsl:copy>
4145
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
4146
+ <xsl:apply-templates mode="svg_remove_a"/>
4147
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
4148
+ <xsl:param name="scale"/>
4149
+ <xsl:variable name="dest">
4150
+ <xsl:choose>
4151
+ <xsl:when test="starts-with(@href, '#')">
4152
+ <xsl:value-of select="substring-after(@href, '#')"/>
4153
+ </xsl:when>
4154
+ <xsl:otherwise>
4155
+ <xsl:value-of select="@href"/>
4156
+ </xsl:otherwise>
4157
+ </xsl:choose>
4158
+ </xsl:variable>
4159
+ <xsl:for-each select="./*[local-name() = 'rect']">
4160
+ <xsl:call-template name="insertSVGMapLink">
4161
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
4162
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
4163
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
4164
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
4165
+ <xsl:with-param name="dest" select="$dest"/>
4166
+ </xsl:call-template>
4167
+ </xsl:for-each>
4168
+
4169
+ <xsl:for-each select="./*[local-name() = 'polygon']">
4170
+ <xsl:variable name="points">
4171
+ <xsl:call-template name="split">
4172
+ <xsl:with-param name="pText" select="@points"/>
4173
+ </xsl:call-template>
4174
+ </xsl:variable>
4175
+ <xsl:variable name="x_coords">
4176
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
4177
+ <xsl:sort select="." data-type="number"/>
4178
+ <x><xsl:value-of select="."/></x>
4179
+ </xsl:for-each>
4180
+ </xsl:variable>
4181
+ <xsl:variable name="y_coords">
4182
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
4183
+ <xsl:sort select="." data-type="number"/>
4184
+ <y><xsl:value-of select="."/></y>
4185
+ </xsl:for-each>
4186
+ </xsl:variable>
4187
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
4188
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
4189
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
4190
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
4191
+ <xsl:call-template name="insertSVGMapLink">
4192
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4193
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4194
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4195
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4196
+ <xsl:with-param name="dest" select="$dest"/>
4197
+ </xsl:call-template>
4198
+ </xsl:for-each>
4199
+
4200
+ <xsl:for-each select="./*[local-name() = 'circle']">
4201
+ <xsl:call-template name="insertSVGMapLink">
4202
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4203
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4204
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4205
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4206
+ <xsl:with-param name="dest" select="$dest"/>
4207
+ </xsl:call-template>
4208
+ </xsl:for-each>
4209
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4210
+ <xsl:call-template name="insertSVGMapLink">
4211
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4212
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4213
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4214
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4215
+ <xsl:with-param name="dest" select="$dest"/>
4216
+ </xsl:call-template>
4217
+ </xsl:for-each>
4218
+ </xsl:template><xsl:template name="insertSVGMapLink">
4219
+ <xsl:param name="left"/>
4220
+ <xsl:param name="top"/>
4221
+ <xsl:param name="width"/>
4222
+ <xsl:param name="height"/>
4223
+ <xsl:param name="dest"/>
4224
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4225
+ <fo:block font-size="1pt">
4226
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4227
+ <fo:inline-container inline-progression-dimension="100%">
4228
+ <fo:block-container height="{$height - 1}px" width="100%">
4229
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4230
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4231
+ </xsl:if> -->
4232
+ <fo:block> </fo:block></fo:block-container>
4233
+ </fo:inline-container>
4234
+ </fo:basic-link>
4235
+ </fo:block>
4236
+ </fo:block-container>
3982
4237
  </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">
3983
4238
  <xsl:apply-templates mode="contents"/>
3984
4239
  <xsl:text> </xsl:text>
@@ -4007,28 +4262,39 @@
4007
4262
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4008
4263
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4009
4264
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4265
+ <xsl:if test="@bundle = 'true'">
4266
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4267
+ </xsl:if>
4010
4268
  <fo:bookmark-title>
4011
- <xsl:variable name="bookmark-title_">
4012
- <xsl:call-template name="getLangVersion">
4013
- <xsl:with-param name="lang" select="@lang"/>
4014
- <xsl:with-param name="doctype" select="@doctype"/>
4015
- <xsl:with-param name="title" select="@title-part"/>
4016
- </xsl:call-template>
4017
- </xsl:variable>
4018
4269
  <xsl:choose>
4019
- <xsl:when test="normalize-space($bookmark-title_) != ''">
4020
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
4021
- </xsl:when>
4022
- <xsl:otherwise>
4270
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4271
+ <xsl:variable name="bookmark-title_">
4272
+ <xsl:call-template name="getLangVersion">
4273
+ <xsl:with-param name="lang" select="@lang"/>
4274
+ <xsl:with-param name="doctype" select="@doctype"/>
4275
+ <xsl:with-param name="title" select="@title-part"/>
4276
+ </xsl:call-template>
4277
+ </xsl:variable>
4023
4278
  <xsl:choose>
4024
- <xsl:when test="@lang = 'en'">English</xsl:when>
4025
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
4026
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4027
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4279
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4280
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4281
+ </xsl:when>
4282
+ <xsl:otherwise>
4283
+ <xsl:choose>
4284
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4285
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4286
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4287
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4288
+ </xsl:choose>
4289
+ </xsl:otherwise>
4028
4290
  </xsl:choose>
4291
+ </xsl:when>
4292
+ <xsl:otherwise>
4293
+ <xsl:value-of select="@title-part"/>
4029
4294
  </xsl:otherwise>
4030
4295
  </xsl:choose>
4031
4296
  </fo:bookmark-title>
4297
+
4032
4298
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4033
4299
 
4034
4300
  <xsl:call-template name="insertFigureBookmarks">
@@ -4127,20 +4393,28 @@
4127
4393
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
4128
4394
  </xsl:choose>
4129
4395
  </xsl:template><xsl:template match="item" mode="bookmark">
4130
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
4131
- <fo:bookmark-title>
4132
- <xsl:if test="@section != ''">
4133
- <xsl:value-of select="@section"/>
4134
- <xsl:text> </xsl:text>
4135
- </xsl:if>
4136
- <xsl:value-of select="normalize-space(title)"/>
4137
- </fo:bookmark-title>
4138
- <xsl:apply-templates mode="bookmark"/>
4139
- </fo:bookmark>
4396
+ <xsl:choose>
4397
+ <xsl:when test="@id != ''">
4398
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4399
+ <fo:bookmark-title>
4400
+ <xsl:if test="@section != ''">
4401
+ <xsl:value-of select="@section"/>
4402
+ <xsl:text> </xsl:text>
4403
+ </xsl:if>
4404
+ <xsl:value-of select="normalize-space(title)"/>
4405
+ </fo:bookmark-title>
4406
+ <xsl:apply-templates mode="bookmark"/>
4407
+ </fo:bookmark>
4408
+ </xsl:when>
4409
+ <xsl:otherwise>
4410
+ <xsl:apply-templates mode="bookmark"/>
4411
+ </xsl:otherwise>
4412
+ </xsl:choose>
4140
4413
  </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">
4141
4414
  <xsl:if test="normalize-space() != ''">
4142
4415
  <fo:block xsl:use-attribute-sets="figure-name-style">
4143
4416
 
4417
+
4144
4418
  <xsl:apply-templates/>
4145
4419
  </fo:block>
4146
4420
  </xsl:if>
@@ -4221,6 +4495,7 @@
4221
4495
 
4222
4496
  <fo:block-container margin-left="0mm">
4223
4497
  <xsl:copy-of select="@id"/>
4498
+
4224
4499
  <xsl:if test="parent::*[local-name() = 'note']">
4225
4500
  <xsl:attribute name="margin-left">
4226
4501
  <xsl:choose>
@@ -4231,7 +4506,9 @@
4231
4506
 
4232
4507
  </xsl:if>
4233
4508
  <fo:block-container margin-left="0mm">
4234
-
4509
+
4510
+
4511
+
4235
4512
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4236
4513
  <xsl:variable name="_font-size">
4237
4514
 
@@ -4260,10 +4537,14 @@
4260
4537
  </xsl:choose>
4261
4538
  </xsl:attribute>
4262
4539
  </xsl:if>
4263
- <xsl:apply-templates/>
4264
- </fo:block>
4540
+
4541
+ <xsl:apply-templates/>
4542
+ </fo:block>
4543
+
4544
+
4265
4545
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4266
4546
 
4547
+
4267
4548
  </fo:block-container>
4268
4549
  </fo:block-container>
4269
4550
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4677,7 +4958,9 @@
4677
4958
 
4678
4959
 
4679
4960
  </xsl:if>
4680
-
4961
+
4962
+
4963
+
4681
4964
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4682
4965
  <xsl:if test="normalize-space(@citeas) = ''">
4683
4966
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4686,6 +4969,7 @@
4686
4969
 
4687
4970
 
4688
4971
 
4972
+
4689
4973
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4690
4974
 
4691
4975
  </xsl:if>
@@ -4833,6 +5117,7 @@
4833
5117
  <xsl:call-template name="setId"/>
4834
5118
 
4835
5119
 
5120
+
4836
5121
  <xsl:apply-templates/>
4837
5122
  </fo:block>
4838
5123
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -5084,17 +5369,17 @@
5084
5369
  <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')]"/>
5085
5370
  <xsl:choose>
5086
5371
  <xsl:when test="normalize-space($_doc_ident) != ''">
5087
- <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"/>
5372
+ <!-- <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"/>
5088
5373
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
5089
5374
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5090
- </xsl:if>
5375
+ </xsl:if> -->
5091
5376
  <xsl:value-of select="$_doc_ident"/>
5092
5377
  </xsl:when>
5093
5378
  <xsl:otherwise>
5094
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5379
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5095
5380
  <xsl:if test="$type != ''">
5096
5381
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5097
- </xsl:if>
5382
+ </xsl:if> -->
5098
5383
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5099
5384
  </xsl:otherwise>
5100
5385
  </xsl:choose>
@@ -5535,20 +5820,40 @@
5535
5820
  </xsl:call-template>
5536
5821
  </xsl:if>
5537
5822
  </xsl:template><xsl:template name="getLocalizedString">
5538
- <xsl:param name="key"/>
5823
+ <xsl:param name="key"/>
5824
+ <xsl:param name="formatted">false</xsl:param>
5539
5825
 
5540
5826
  <xsl:variable name="curr_lang">
5541
5827
  <xsl:call-template name="getLang"/>
5542
5828
  </xsl:variable>
5543
5829
 
5544
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5830
+ <xsl:variable name="data_value">
5831
+ <xsl:choose>
5832
+ <xsl:when test="$formatted = 'true'">
5833
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5834
+ </xsl:when>
5835
+ <xsl:otherwise>
5836
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5837
+ </xsl:otherwise>
5838
+ </xsl:choose>
5839
+ </xsl:variable>
5545
5840
 
5546
5841
  <xsl:choose>
5547
- <xsl:when test="$data_value != ''">
5548
- <xsl:value-of select="$data_value"/>
5842
+ <xsl:when test="normalize-space($data_value) != ''">
5843
+ <xsl:choose>
5844
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5845
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5846
+ </xsl:choose>
5549
5847
  </xsl:when>
5550
5848
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5551
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5849
+ <xsl:choose>
5850
+ <xsl:when test="$formatted = 'true'">
5851
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5852
+ </xsl:when>
5853
+ <xsl:otherwise>
5854
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5855
+ </xsl:otherwise>
5856
+ </xsl:choose>
5552
5857
  </xsl:when>
5553
5858
  <xsl:otherwise>
5554
5859
  <xsl:variable name="key_">
@@ -5559,7 +5864,7 @@
5559
5864
  <xsl:value-of select="$key_"/>
5560
5865
  </xsl:otherwise>
5561
5866
  </xsl:choose>
5562
-
5867
+
5563
5868
  </xsl:template><xsl:template name="setTrackChangesStyles">
5564
5869
  <xsl:param name="isAdded"/>
5565
5870
  <xsl:param name="isDeleted"/>
@@ -5600,4 +5905,110 @@
5600
5905
  <xsl:value-of select="$align"/>
5601
5906
  </xsl:when>
5602
5907
  </xsl:choose>
5908
+ </xsl:template><xsl:template name="setTextAlignment">
5909
+ <xsl:param name="default">left</xsl:param>
5910
+ <xsl:attribute name="text-align">
5911
+ <xsl:choose>
5912
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5913
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5914
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5915
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5916
+ </xsl:choose>
5917
+ </xsl:attribute>
5918
+ </xsl:template><xsl:template name="number-to-words">
5919
+ <xsl:param name="number"/>
5920
+ <xsl:param name="first"/>
5921
+ <xsl:if test="$number != ''">
5922
+ <xsl:variable name="words">
5923
+ <words>
5924
+ <word cardinal="1">One-</word>
5925
+ <word ordinal="1">First </word>
5926
+ <word cardinal="2">Two-</word>
5927
+ <word ordinal="2">Second </word>
5928
+ <word cardinal="3">Three-</word>
5929
+ <word ordinal="3">Third </word>
5930
+ <word cardinal="4">Four-</word>
5931
+ <word ordinal="4">Fourth </word>
5932
+ <word cardinal="5">Five-</word>
5933
+ <word ordinal="5">Fifth </word>
5934
+ <word cardinal="6">Six-</word>
5935
+ <word ordinal="6">Sixth </word>
5936
+ <word cardinal="7">Seven-</word>
5937
+ <word ordinal="7">Seventh </word>
5938
+ <word cardinal="8">Eight-</word>
5939
+ <word ordinal="8">Eighth </word>
5940
+ <word cardinal="9">Nine-</word>
5941
+ <word ordinal="9">Ninth </word>
5942
+ <word ordinal="10">Tenth </word>
5943
+ <word ordinal="11">Eleventh </word>
5944
+ <word ordinal="12">Twelfth </word>
5945
+ <word ordinal="13">Thirteenth </word>
5946
+ <word ordinal="14">Fourteenth </word>
5947
+ <word ordinal="15">Fifteenth </word>
5948
+ <word ordinal="16">Sixteenth </word>
5949
+ <word ordinal="17">Seventeenth </word>
5950
+ <word ordinal="18">Eighteenth </word>
5951
+ <word ordinal="19">Nineteenth </word>
5952
+ <word cardinal="20">Twenty-</word>
5953
+ <word ordinal="20">Twentieth </word>
5954
+ <word cardinal="30">Thirty-</word>
5955
+ <word ordinal="30">Thirtieth </word>
5956
+ <word cardinal="40">Forty-</word>
5957
+ <word ordinal="40">Fortieth </word>
5958
+ <word cardinal="50">Fifty-</word>
5959
+ <word ordinal="50">Fiftieth </word>
5960
+ <word cardinal="60">Sixty-</word>
5961
+ <word ordinal="60">Sixtieth </word>
5962
+ <word cardinal="70">Seventy-</word>
5963
+ <word ordinal="70">Seventieth </word>
5964
+ <word cardinal="80">Eighty-</word>
5965
+ <word ordinal="80">Eightieth </word>
5966
+ <word cardinal="90">Ninety-</word>
5967
+ <word ordinal="90">Ninetieth </word>
5968
+ <word cardinal="100">Hundred-</word>
5969
+ <word ordinal="100">Hundredth </word>
5970
+ </words>
5971
+ </xsl:variable>
5972
+
5973
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5974
+
5975
+ <xsl:variable name="value">
5976
+ <xsl:choose>
5977
+ <xsl:when test="$ordinal != ''">
5978
+ <xsl:value-of select="$ordinal"/>
5979
+ </xsl:when>
5980
+ <xsl:otherwise>
5981
+ <xsl:choose>
5982
+ <xsl:when test="$number &lt; 100">
5983
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5984
+ <xsl:variable name="digit" select="substring($number,2)"/>
5985
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5986
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5987
+ </xsl:when>
5988
+ <xsl:otherwise>
5989
+ <!-- more 100 -->
5990
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5991
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5992
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5993
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5994
+ <xsl:call-template name="number-to-words">
5995
+ <xsl:with-param name="number" select="$digits"/>
5996
+ </xsl:call-template>
5997
+ </xsl:otherwise>
5998
+ </xsl:choose>
5999
+ </xsl:otherwise>
6000
+ </xsl:choose>
6001
+ </xsl:variable>
6002
+ <xsl:choose>
6003
+ <xsl:when test="$first = 'true'">
6004
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6005
+ <xsl:call-template name="capitalize">
6006
+ <xsl:with-param name="str" select="$value_lc"/>
6007
+ </xsl:call-template>
6008
+ </xsl:when>
6009
+ <xsl:otherwise>
6010
+ <xsl:value-of select="$value"/>
6011
+ </xsl:otherwise>
6012
+ </xsl:choose>
6013
+ </xsl:if>
5603
6014
  </xsl:template></xsl:stylesheet>