metanorma-cc 1.7.5 → 1.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21d0ca9db55a0ac16cf9c7d2aa5e4d1e8d8e7d2934d067148284a2ff4e9dfb16
4
- data.tar.gz: c6e31128a7d2dd507b87b812b1b06aa26629d16c9264e73d58fb598e7dd80da1
3
+ metadata.gz: d6d309173c4998e196ca07f8ddfb3a5bb78f8b18583b81bcd9d9070178b5914c
4
+ data.tar.gz: 9f96d76ec9a043f2bd69e6a0e8a88b9372ffea4d4fb3da7779732a2bb77d704a
5
5
  SHA512:
6
- metadata.gz: 59e27ecbc3c0e3b878b21a22a1fbc5663c79eea90efcf73368266a12abcd085db5aec3b168212b63eeec7f2494e9cca79595c29e325f43f24a9c93ea1460ac9e
7
- data.tar.gz: 6120464f8d63a52365519449d463fecc78140d8bc35d47eeed568c8a39abf0a35f7ceec453f13dbbf26f97946c1ca4cc918b9b120e67ba4c68d225248eb9cb84
6
+ metadata.gz: 742f181837a9d074cc595bf8ee3aa12d73cff5954126eeb1367b135f0ae9164a041d8d096aff1525a724de8e6f9f705a84f1c5c747735471fec0635b42aeb2f7
7
+ data.tar.gz: 774c8fc6eca7ff7237a8acc436852e286ac1bc0d2129e9456a6c5eaa9590c408e1066a9e8efad730e4a1551c9886b6f13ce201d4f91d70f6b26de35272e01d34
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  steps:
@@ -204,6 +204,18 @@
204
204
  </zeroOrMore>
205
205
  </element>
206
206
  </define>
207
+ <define name="dt">
208
+ <element name="dt">
209
+ <optional>
210
+ <attribute name="id">
211
+ <data type="ID"/>
212
+ </attribute>
213
+ </optional>
214
+ <zeroOrMore>
215
+ <ref name="TextElement"/>
216
+ </zeroOrMore>
217
+ </element>
218
+ </define>
207
219
  <define name="example">
208
220
  <element name="example">
209
221
  <attribute name="id">
@@ -899,7 +911,7 @@
899
911
  </include>
900
912
  <!-- end overrides -->
901
913
  <define name="docsubtype">
902
- <element name="docsubtype">
914
+ <element name="subdoctype">
903
915
  <ref name="DocumentSubtype"/>
904
916
  </element>
905
917
  </define>
@@ -955,7 +967,34 @@
955
967
  <define name="concept">
956
968
  <element name="concept">
957
969
  <optional>
958
- <attribute name="term"/>
970
+ <attribute name="ital">
971
+ <data type="boolean"/>
972
+ </attribute>
973
+ </optional>
974
+ <optional>
975
+ <attribute name="ref">
976
+ <data type="boolean"/>
977
+ </attribute>
978
+ </optional>
979
+ <optional>
980
+ <element name="refterm">
981
+ <zeroOrMore>
982
+ <choice>
983
+ <ref name="PureTextElement"/>
984
+ <ref name="stem"/>
985
+ </choice>
986
+ </zeroOrMore>
987
+ </element>
988
+ </optional>
989
+ <optional>
990
+ <element name="renderterm">
991
+ <zeroOrMore>
992
+ <choice>
993
+ <ref name="PureTextElement"/>
994
+ <ref name="stem"/>
995
+ </choice>
996
+ </zeroOrMore>
997
+ </element>
959
998
  </optional>
960
999
  <choice>
961
1000
  <ref name="eref"/>
@@ -972,8 +1011,14 @@
972
1011
  <ref name="imagemap"/>
973
1012
  <ref name="svgmap"/>
974
1013
  <ref name="inputform"/>
1014
+ <ref name="toc"/>
975
1015
  </choice>
976
1016
  </define>
1017
+ <define name="toc">
1018
+ <element name="toc">
1019
+ <ref name="ul"/>
1020
+ </element>
1021
+ </define>
977
1022
  <define name="inputform">
978
1023
  <element name="form">
979
1024
  <attribute name="id">
@@ -981,6 +1026,9 @@
981
1026
  </attribute>
982
1027
  <attribute name="name"/>
983
1028
  <attribute name="action"/>
1029
+ <optional>
1030
+ <attribute name="class"/>
1031
+ </optional>
984
1032
  <zeroOrMore>
985
1033
  <choice>
986
1034
  <ref name="TextElement"/>
@@ -1212,6 +1260,12 @@
1212
1260
  <optional>
1213
1261
  <attribute name="type"/>
1214
1262
  </optional>
1263
+ <optional>
1264
+ <attribute name="identifier"/>
1265
+ </optional>
1266
+ <optional>
1267
+ <attribute name="prefix"/>
1268
+ </optional>
1215
1269
  <text/>
1216
1270
  </define>
1217
1271
  <define name="ics">
@@ -1473,26 +1527,26 @@
1473
1527
  <optional>
1474
1528
  <ref name="section-title"/>
1475
1529
  </optional>
1476
- <group>
1530
+ <choice>
1477
1531
  <choice>
1478
1532
  <group>
1479
- <zeroOrMore>
1533
+ <oneOrMore>
1480
1534
  <ref name="BasicBlock"/>
1481
- </zeroOrMore>
1535
+ </oneOrMore>
1482
1536
  <zeroOrMore>
1483
1537
  <ref name="note"/>
1484
1538
  </zeroOrMore>
1485
1539
  </group>
1486
1540
  <ref name="amend"/>
1487
1541
  </choice>
1488
- <zeroOrMore>
1542
+ <oneOrMore>
1489
1543
  <choice>
1490
1544
  <ref name="clause-subsection"/>
1491
1545
  <ref name="terms"/>
1492
1546
  <ref name="definitions"/>
1493
1547
  </choice>
1494
- </zeroOrMore>
1495
- </group>
1548
+ </oneOrMore>
1549
+ </choice>
1496
1550
  </define>
1497
1551
  <define name="Annex-Section">
1498
1552
  <optional>
@@ -64,9 +64,9 @@
64
64
  <optional>
65
65
  <ref name="label"/>
66
66
  </optional>
67
- <optional>
67
+ <zeroOrMore>
68
68
  <ref name="subject"/>
69
- </optional>
69
+ </zeroOrMore>
70
70
  <zeroOrMore>
71
71
  <ref name="reqinherit"/>
72
72
  </zeroOrMore>
@@ -80,6 +80,7 @@
80
80
  <ref name="verification"/>
81
81
  <ref name="import"/>
82
82
  <ref name="description"/>
83
+ <ref name="component"/>
83
84
  </choice>
84
85
  </zeroOrMore>
85
86
  <optional>
@@ -105,12 +106,16 @@
105
106
  </define>
106
107
  <define name="subject">
107
108
  <element name="subject">
108
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
109
112
  </element>
110
113
  </define>
111
114
  <define name="reqinherit">
112
115
  <element name="inherit">
113
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
114
119
  </element>
115
120
  </define>
116
121
  <define name="measurementtarget">
@@ -138,6 +143,12 @@
138
143
  <ref name="RequirementSubpart"/>
139
144
  </element>
140
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
141
152
  <define name="reqt_references">
142
153
  <element name="references">
143
154
  <oneOrMore>
@@ -7,8 +7,13 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
- <xsl:variable name="pageWidth" select="'210mm'"/>
11
- <xsl:variable name="pageHeight" select="'297mm'"/>
10
+ <xsl:variable name="pageWidth" select="210"/>
11
+ <xsl:variable name="pageHeight" select="297"/>
12
+ <xsl:variable name="marginLeftRight1" select="19"/>
13
+ <xsl:variable name="marginLeftRight2" select="19"/>
14
+ <xsl:variable name="marginTop" select="20.2"/>
15
+ <xsl:variable name="marginBottom" select="20.3"/>
16
+
12
17
 
13
18
 
14
19
 
@@ -42,7 +47,7 @@
42
47
  <fo:root font-family="Source Sans Pro, STIX Two Math, Source Han Sans" font-size="10.5pt" xml:lang="{$lang}">
43
48
  <fo:layout-master-set>
44
49
  <!-- Cover page -->
45
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
50
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
46
51
  <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
47
52
  <fo:region-before region-name="cover-page-header" extent="23.5mm"/>
48
53
  <fo:region-after extent="10mm"/>
@@ -53,27 +58,27 @@
53
58
  <!-- Document pages -->
54
59
 
55
60
  <!-- Preface odd pages -->
56
- <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
57
- <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
61
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
62
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
58
63
  <fo:region-before region-name="header-odd" extent="17mm"/>
59
64
  <fo:region-after region-name="footer-odd" extent="10mm"/>
60
- <fo:region-start region-name="left-region" extent="19mm"/>
61
- <fo:region-end region-name="right-region" extent="19mm"/>
65
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
66
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
62
67
  </fo:simple-page-master>
63
68
  <!-- Preface even pages -->
64
- <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
65
- <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
69
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
70
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
66
71
  <fo:region-before region-name="header-even" extent="17mm"/>
67
72
  <fo:region-after region-name="footer-even" extent="10mm"/>
68
- <fo:region-start region-name="left-region" extent="19mm"/>
69
- <fo:region-end region-name="right-region" extent="19mm"/>
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="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
72
- <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
76
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
73
78
  <fo:region-before region-name="header" extent="17mm"/>
74
79
  <fo:region-after region-name="footer" extent="10mm"/>
75
- <fo:region-start region-name="left" extent="19mm"/>
76
- <fo:region-end region-name="right" extent="19mm"/>
80
+ <fo:region-start region-name="left" extent="{$marginLeftRight1}mm"/>
81
+ <fo:region-end region-name="right" extent="{$marginLeftRight2}mm"/>
77
82
  </fo:simple-page-master>
78
83
  <fo:page-sequence-master master-name="preface">
79
84
  <fo:repeatable-page-master-alternatives>
@@ -84,20 +89,20 @@
84
89
  </fo:page-sequence-master>
85
90
 
86
91
  <!-- Document odd pages -->
87
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
88
- <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
89
- <fo:region-before region-name="header-odd" extent="20.2mm"/>
90
- <fo:region-after region-name="footer-odd" extent="20.3mm"/>
91
- <fo:region-start region-name="left-region" extent="19mm"/>
92
- <fo:region-end region-name="right-region" extent="19mm"/>
92
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
93
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
94
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
95
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
96
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
97
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
93
98
  </fo:simple-page-master>
94
99
  <!-- Preface even pages -->
95
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
96
- <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
97
- <fo:region-before region-name="header-even" extent="20.2mm"/>
98
- <fo:region-after region-name="footer-even" extent="20.3mm"/>
99
- <fo:region-start region-name="left-region" extent="19mm"/>
100
- <fo:region-end region-name="right-region" extent="19mm"/>
100
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
101
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
102
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
103
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
104
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
105
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
101
106
  </fo:simple-page-master>
102
107
  <fo:page-sequence-master master-name="document">
103
108
  <fo:repeatable-page-master-alternatives>
@@ -1078,6 +1083,7 @@
1078
1083
 
1079
1084
 
1080
1085
 
1086
+
1081
1087
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1082
1088
 
1083
1089
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1086,7 +1092,9 @@
1086
1092
 
1087
1093
 
1088
1094
 
1089
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1095
+ </xsl:attribute-set><xsl:variable name="table-border_">
1096
+
1097
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1090
1098
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1091
1099
 
1092
1100
 
@@ -1134,6 +1142,7 @@
1134
1142
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1135
1143
 
1136
1144
 
1145
+
1137
1146
  <xsl:attribute name="color">blue</xsl:attribute>
1138
1147
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1139
1148
 
@@ -1352,14 +1361,15 @@
1352
1361
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1353
1362
 
1354
1363
  <!-- Normative references -->
1355
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1364
+ <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"/>
1356
1365
  <!-- Terms and definitions -->
1357
1366
  <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"/>
1358
1367
  <!-- Another main sections -->
1359
1368
  <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"/>
1360
1369
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1361
1370
  <!-- Bibliography -->
1362
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1371
+ <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"/>
1372
+
1363
1373
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1364
1374
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1365
1375
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1402,6 +1412,8 @@
1402
1412
  <fo:block>&#xA0;</fo:block>
1403
1413
  </xsl:if> -->
1404
1414
 
1415
+
1416
+ <!-- Display table's name before table as standalone block -->
1405
1417
  <!-- $namespace = 'iso' or -->
1406
1418
 
1407
1419
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1479,6 +1491,12 @@
1479
1491
 
1480
1492
 
1481
1493
 
1494
+
1495
+
1496
+
1497
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1498
+
1499
+
1482
1500
  <xsl:variable name="table_width">
1483
1501
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1484
1502
  100%
@@ -1497,6 +1515,7 @@
1497
1515
 
1498
1516
 
1499
1517
 
1518
+
1500
1519
 
1501
1520
 
1502
1521
 
@@ -1520,6 +1539,8 @@
1520
1539
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1521
1540
  </xsl:if>
1522
1541
 
1542
+
1543
+
1523
1544
  <xsl:choose>
1524
1545
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1525
1546
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -1807,9 +1828,9 @@
1807
1828
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1808
1829
  <xsl:with-param name="continued">true</xsl:with-param>
1809
1830
  </xsl:apply-templates>
1810
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1811
- <xsl:call-template name="fn_name_display"/>
1812
- </xsl:for-each>
1831
+
1832
+
1833
+
1813
1834
 
1814
1835
  </fo:table-cell>
1815
1836
  </fo:table-row>
@@ -1891,7 +1912,11 @@
1891
1912
 
1892
1913
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1893
1914
 
1894
- <xsl:if test="$isNoteOrFnExist = 'true'">
1915
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
1916
+
1917
+ </xsl:variable>
1918
+
1919
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
1895
1920
 
1896
1921
  <xsl:variable name="cols-count">
1897
1922
  <xsl:choose>
@@ -1920,6 +1945,8 @@
1920
1945
  </xsl:choose>
1921
1946
  </xsl:for-each>
1922
1947
 
1948
+
1949
+
1923
1950
  <xsl:choose>
1924
1951
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1925
1952
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1946,6 +1973,7 @@
1946
1973
 
1947
1974
 
1948
1975
 
1976
+
1949
1977
  <!-- fn will be processed inside 'note' processing -->
1950
1978
 
1951
1979
 
@@ -1954,6 +1982,11 @@
1954
1982
 
1955
1983
 
1956
1984
 
1985
+
1986
+
1987
+ <!-- for BSI (not PAS) display Notes before footnotes -->
1988
+
1989
+
1957
1990
  <!-- except gb -->
1958
1991
 
1959
1992
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -1979,6 +2012,10 @@
1979
2012
  <!-- fn processing -->
1980
2013
  <xsl:call-template name="fn_display"/>
1981
2014
 
2015
+
2016
+ <!-- for PAS display Notes after footnotes -->
2017
+
2018
+
1982
2019
  </fo:table-cell>
1983
2020
  </fo:table-row>
1984
2021
  </fo:table-body>
@@ -2020,6 +2057,19 @@
2020
2057
 
2021
2058
  </fo:table-body>
2022
2059
 
2060
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2061
+ <xsl:choose>
2062
+ <xsl:when test="substring-after(., '—') != ''">
2063
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2064
+ </xsl:when>
2065
+ <xsl:otherwise>
2066
+ <xsl:value-of select="."/>
2067
+ </xsl:otherwise>
2068
+ </xsl:choose>
2069
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2070
+ <xsl:apply-templates mode="presentation_name"/>
2071
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2072
+ <xsl:apply-templates select="."/>
2023
2073
  </xsl:template><xsl:template match="*[local-name()='tr']">
2024
2074
  <xsl:variable name="parent-name" select="local-name(..)"/>
2025
2075
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2032,10 +2082,13 @@
2032
2082
 
2033
2083
 
2034
2084
 
2085
+
2086
+
2035
2087
  </xsl:if>
2036
2088
  <xsl:if test="$parent-name = 'tfoot'">
2037
2089
 
2038
2090
 
2091
+
2039
2092
  </xsl:if>
2040
2093
 
2041
2094
 
@@ -2045,6 +2098,8 @@
2045
2098
 
2046
2099
 
2047
2100
 
2101
+
2102
+
2048
2103
  <!-- <xsl:if test="$namespace = 'bipm'">
2049
2104
  <xsl:attribute name="height">8mm</xsl:attribute>
2050
2105
  </xsl:if> -->
@@ -2133,6 +2188,7 @@
2133
2188
 
2134
2189
 
2135
2190
 
2191
+
2136
2192
  <xsl:if test=".//*[local-name() = 'table']">
2137
2193
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2138
2194
  </xsl:if>
@@ -2162,8 +2218,14 @@
2162
2218
 
2163
2219
 
2164
2220
 
2221
+
2222
+
2223
+ <!-- Table's note name (NOTE, for example) -->
2224
+
2165
2225
  <fo:inline padding-right="2mm">
2166
2226
 
2227
+
2228
+
2167
2229
 
2168
2230
 
2169
2231
 
@@ -2171,6 +2233,8 @@
2171
2233
 
2172
2234
  </fo:inline>
2173
2235
 
2236
+
2237
+
2174
2238
  <xsl:apply-templates mode="process"/>
2175
2239
  </fo:block>
2176
2240
 
@@ -2178,18 +2242,18 @@
2178
2242
  <xsl:apply-templates/>
2179
2243
  </xsl:template><xsl:template name="fn_display">
2180
2244
  <xsl:variable name="references">
2245
+
2181
2246
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2182
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2183
-
2184
-
2185
- <xsl:apply-templates/>
2186
- </fn>
2247
+ <xsl:call-template name="create_fn"/>
2187
2248
  </xsl:for-each>
2188
2249
  </xsl:variable>
2250
+
2189
2251
  <xsl:for-each select="xalan:nodeset($references)//fn">
2190
2252
  <xsl:variable name="reference" select="@reference"/>
2191
2253
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2192
2254
  <fo:block margin-bottom="12pt">
2255
+
2256
+
2193
2257
 
2194
2258
 
2195
2259
 
@@ -2205,9 +2269,11 @@
2205
2269
 
2206
2270
 
2207
2271
 
2272
+
2208
2273
  <xsl:value-of select="@reference"/>
2209
2274
 
2210
2275
 
2276
+
2211
2277
  </fo:inline>
2212
2278
  <fo:inline>
2213
2279
 
@@ -2217,6 +2283,12 @@
2217
2283
  </fo:block>
2218
2284
  </xsl:if>
2219
2285
  </xsl:for-each>
2286
+ </xsl:template><xsl:template name="create_fn">
2287
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2288
+
2289
+
2290
+ <xsl:apply-templates/>
2291
+ </fn>
2220
2292
  </xsl:template><xsl:template name="fn_name_display">
2221
2293
  <!-- <xsl:variable name="references">
2222
2294
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2349,11 +2421,15 @@
2349
2421
 
2350
2422
 
2351
2423
 
2424
+
2425
+
2426
+
2352
2427
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2353
2428
 
2354
2429
 
2355
2430
  <xsl:value-of select="@reference"/>
2356
2431
 
2432
+
2357
2433
  </fo:basic-link>
2358
2434
  </fo:inline>
2359
2435
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3213,19 +3289,6 @@
3213
3289
  <!-- replace start and end spaces to non-break space -->
3214
3290
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3215
3291
  </xsl:copy>
3216
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3217
- <xsl:copy>
3218
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3219
- </xsl:copy>
3220
- <xsl:choose>
3221
- <!-- if in msub, then don't add space -->
3222
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3223
- <!-- if next char in digit, don't add space -->
3224
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3225
- <xsl:otherwise>
3226
- <mathml:mspace width="0.5ex"/>
3227
- </xsl:otherwise>
3228
- </xsl:choose>
3229
3292
  </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">
3230
3293
  <xsl:variable name="target">
3231
3294
  <xsl:choose>
@@ -3250,6 +3313,7 @@
3250
3313
  <fo:inline xsl:use-attribute-sets="link-style">
3251
3314
 
3252
3315
 
3316
+
3253
3317
  <xsl:choose>
3254
3318
  <xsl:when test="$target_text = ''">
3255
3319
  <xsl:apply-templates/>
@@ -3358,6 +3422,7 @@
3358
3422
 
3359
3423
 
3360
3424
 
3425
+
3361
3426
  <fo:block-container margin-left="0mm">
3362
3427
 
3363
3428
 
@@ -3530,7 +3595,24 @@
3530
3595
  </fo:instream-foreign-object>
3531
3596
  </xsl:when>
3532
3597
  <xsl:otherwise>
3533
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3598
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3599
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3600
+
3601
+ <xsl:variable name="img_src">
3602
+ <xsl:choose>
3603
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3604
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3605
+ </xsl:choose>
3606
+ </xsl:variable>
3607
+
3608
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3609
+ <xsl:if test="number($scale) &lt; 100">
3610
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3611
+ </xsl:if>
3612
+
3613
+ </xsl:if>
3614
+
3615
+ </fo:external-graphic>
3534
3616
  </xsl:otherwise>
3535
3617
  </xsl:choose>
3536
3618
 
@@ -3598,6 +3680,253 @@
3598
3680
  <xsl:param name="height"/>
3599
3681
  <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; "/>
3600
3682
  <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; "/>
3683
+ </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">
3684
+ <xsl:param name="name"/>
3685
+
3686
+ <xsl:variable name="svg_content">
3687
+ <xsl:apply-templates select="." mode="svg_update"/>
3688
+ </xsl:variable>
3689
+
3690
+ <xsl:variable name="alt-text">
3691
+ <xsl:choose>
3692
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3693
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3694
+ </xsl:when>
3695
+ <xsl:when test="normalize-space($name) != ''">
3696
+ <xsl:value-of select="$name"/>
3697
+ </xsl:when>
3698
+ <xsl:otherwise>Figure</xsl:otherwise>
3699
+ </xsl:choose>
3700
+ </xsl:variable>
3701
+
3702
+ <xsl:choose>
3703
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3704
+ <fo:block>
3705
+ <xsl:variable name="width" select="@width"/>
3706
+ <xsl:variable name="height" select="@height"/>
3707
+
3708
+ <xsl:variable name="scale_x">
3709
+ <xsl:choose>
3710
+ <xsl:when test="$width &gt; $width_effective_px">
3711
+ <xsl:value-of select="$width_effective_px div $width"/>
3712
+ </xsl:when>
3713
+ <xsl:otherwise>1</xsl:otherwise>
3714
+ </xsl:choose>
3715
+ </xsl:variable>
3716
+
3717
+ <xsl:variable name="scale_y">
3718
+ <xsl:choose>
3719
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3720
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3721
+ </xsl:when>
3722
+ <xsl:otherwise>1</xsl:otherwise>
3723
+ </xsl:choose>
3724
+ </xsl:variable>
3725
+
3726
+ <xsl:variable name="scale">
3727
+ <xsl:choose>
3728
+ <xsl:when test="$scale_y != 1">
3729
+ <xsl:value-of select="$scale_x * $scale_y"/>
3730
+ </xsl:when>
3731
+ <xsl:otherwise>
3732
+ <xsl:value-of select="$scale_x"/>
3733
+ </xsl:otherwise>
3734
+ </xsl:choose>
3735
+ </xsl:variable>
3736
+
3737
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3738
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3739
+
3740
+ <fo:table table-layout="fixed" width="100%">
3741
+ <fo:table-column column-width="proportional-column-width(1)"/>
3742
+ <fo:table-column column-width="{$width_scale}px"/>
3743
+ <fo:table-column column-width="proportional-column-width(1)"/>
3744
+ <fo:table-body>
3745
+ <fo:table-row>
3746
+ <fo:table-cell column-number="2">
3747
+ <fo:block>
3748
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3749
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3750
+ <fo:block line-height="0" font-size="0">
3751
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3752
+ <xsl:call-template name="bookmark"/>
3753
+ </xsl:for-each>
3754
+ </fo:block>
3755
+ </xsl:if>
3756
+ <fo:block text-depth="0" line-height="0" font-size="0">
3757
+
3758
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3759
+ <xsl:attribute name="width">100%</xsl:attribute>
3760
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3761
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3762
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3763
+
3764
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3765
+ </fo:instream-foreign-object>
3766
+ </fo:block>
3767
+
3768
+ <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">
3769
+ <xsl:with-param name="scale" select="$scale"/>
3770
+ </xsl:apply-templates>
3771
+ </fo:block-container>
3772
+ </fo:block>
3773
+ </fo:table-cell>
3774
+ </fo:table-row>
3775
+ </fo:table-body>
3776
+ </fo:table>
3777
+ </fo:block>
3778
+
3779
+ </xsl:when>
3780
+ <xsl:otherwise>
3781
+ <fo:block xsl:use-attribute-sets="image-style">
3782
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3783
+ <xsl:attribute name="width">100%</xsl:attribute>
3784
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3785
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3786
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3787
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3788
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3789
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3790
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3791
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3792
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3793
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3794
+ </xsl:if>
3795
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3796
+ <xsl:copy-of select="$svg_content"/>
3797
+ </fo:instream-foreign-object>
3798
+ </fo:block>
3799
+ </xsl:otherwise>
3800
+ </xsl:choose>
3801
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3802
+ <xsl:copy>
3803
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3804
+ </xsl:copy>
3805
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3806
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3807
+ <xsl:value-of select="."/>
3808
+ </xsl:attribute>
3809
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3810
+ <xsl:copy>
3811
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3812
+ <xsl:variable name="viewbox">
3813
+ <xsl:call-template name="split">
3814
+ <xsl:with-param name="pText" select="@viewBox"/>
3815
+ <xsl:with-param name="sep" select="' '"/>
3816
+ </xsl:call-template>
3817
+ </xsl:variable>
3818
+ <xsl:attribute name="width">
3819
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3820
+ </xsl:attribute>
3821
+ <xsl:attribute name="height">
3822
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3823
+ </xsl:attribute>
3824
+ <xsl:apply-templates mode="svg_update"/>
3825
+ </xsl:copy>
3826
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3827
+ <xsl:variable name="svg_content" select="document(@src)"/>
3828
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3829
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3830
+ <xsl:call-template name="image_svg">
3831
+ <xsl:with-param name="name" select="$name"/>
3832
+ </xsl:call-template>
3833
+ </xsl:for-each>
3834
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3835
+ <xsl:copy>
3836
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3837
+ </xsl:copy>
3838
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3839
+ <xsl:apply-templates mode="svg_remove_a"/>
3840
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3841
+ <xsl:param name="scale"/>
3842
+ <xsl:variable name="dest">
3843
+ <xsl:choose>
3844
+ <xsl:when test="starts-with(@href, '#')">
3845
+ <xsl:value-of select="substring-after(@href, '#')"/>
3846
+ </xsl:when>
3847
+ <xsl:otherwise>
3848
+ <xsl:value-of select="@href"/>
3849
+ </xsl:otherwise>
3850
+ </xsl:choose>
3851
+ </xsl:variable>
3852
+ <xsl:for-each select="./*[local-name() = 'rect']">
3853
+ <xsl:call-template name="insertSVGMapLink">
3854
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3855
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3856
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3857
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3858
+ <xsl:with-param name="dest" select="$dest"/>
3859
+ </xsl:call-template>
3860
+ </xsl:for-each>
3861
+
3862
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3863
+ <xsl:variable name="points">
3864
+ <xsl:call-template name="split">
3865
+ <xsl:with-param name="pText" select="@points"/>
3866
+ </xsl:call-template>
3867
+ </xsl:variable>
3868
+ <xsl:variable name="x_coords">
3869
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3870
+ <xsl:sort select="." data-type="number"/>
3871
+ <x><xsl:value-of select="."/></x>
3872
+ </xsl:for-each>
3873
+ </xsl:variable>
3874
+ <xsl:variable name="y_coords">
3875
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3876
+ <xsl:sort select="." data-type="number"/>
3877
+ <y><xsl:value-of select="."/></y>
3878
+ </xsl:for-each>
3879
+ </xsl:variable>
3880
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3881
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3882
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3883
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3884
+ <xsl:call-template name="insertSVGMapLink">
3885
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3886
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3887
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3888
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3889
+ <xsl:with-param name="dest" select="$dest"/>
3890
+ </xsl:call-template>
3891
+ </xsl:for-each>
3892
+
3893
+ <xsl:for-each select="./*[local-name() = 'circle']">
3894
+ <xsl:call-template name="insertSVGMapLink">
3895
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3896
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3897
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3898
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3899
+ <xsl:with-param name="dest" select="$dest"/>
3900
+ </xsl:call-template>
3901
+ </xsl:for-each>
3902
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3903
+ <xsl:call-template name="insertSVGMapLink">
3904
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3905
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3906
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3907
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3908
+ <xsl:with-param name="dest" select="$dest"/>
3909
+ </xsl:call-template>
3910
+ </xsl:for-each>
3911
+ </xsl:template><xsl:template name="insertSVGMapLink">
3912
+ <xsl:param name="left"/>
3913
+ <xsl:param name="top"/>
3914
+ <xsl:param name="width"/>
3915
+ <xsl:param name="height"/>
3916
+ <xsl:param name="dest"/>
3917
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3918
+ <fo:block font-size="1pt">
3919
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3920
+ <fo:inline-container inline-progression-dimension="100%">
3921
+ <fo:block-container height="{$height - 1}px" width="100%">
3922
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3923
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3924
+ </xsl:if> -->
3925
+ <fo:block> </fo:block></fo:block-container>
3926
+ </fo:inline-container>
3927
+ </fo:basic-link>
3928
+ </fo:block>
3929
+ </fo:block-container>
3601
3930
  </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">
3602
3931
  <xsl:apply-templates mode="contents"/>
3603
3932
  <xsl:text> </xsl:text>
@@ -3626,28 +3955,39 @@
3626
3955
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3627
3956
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3628
3957
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3958
+ <xsl:if test="@bundle = 'true'">
3959
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3960
+ </xsl:if>
3629
3961
  <fo:bookmark-title>
3630
- <xsl:variable name="bookmark-title_">
3631
- <xsl:call-template name="getLangVersion">
3632
- <xsl:with-param name="lang" select="@lang"/>
3633
- <xsl:with-param name="doctype" select="@doctype"/>
3634
- <xsl:with-param name="title" select="@title-part"/>
3635
- </xsl:call-template>
3636
- </xsl:variable>
3637
3962
  <xsl:choose>
3638
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3639
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3640
- </xsl:when>
3641
- <xsl:otherwise>
3963
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3964
+ <xsl:variable name="bookmark-title_">
3965
+ <xsl:call-template name="getLangVersion">
3966
+ <xsl:with-param name="lang" select="@lang"/>
3967
+ <xsl:with-param name="doctype" select="@doctype"/>
3968
+ <xsl:with-param name="title" select="@title-part"/>
3969
+ </xsl:call-template>
3970
+ </xsl:variable>
3642
3971
  <xsl:choose>
3643
- <xsl:when test="@lang = 'en'">English</xsl:when>
3644
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3645
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3646
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3972
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3973
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3974
+ </xsl:when>
3975
+ <xsl:otherwise>
3976
+ <xsl:choose>
3977
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3978
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3979
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3980
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3981
+ </xsl:choose>
3982
+ </xsl:otherwise>
3647
3983
  </xsl:choose>
3984
+ </xsl:when>
3985
+ <xsl:otherwise>
3986
+ <xsl:value-of select="@title-part"/>
3648
3987
  </xsl:otherwise>
3649
3988
  </xsl:choose>
3650
3989
  </fo:bookmark-title>
3990
+
3651
3991
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3652
3992
 
3653
3993
  <xsl:call-template name="insertFigureBookmarks">
@@ -3746,16 +4086,23 @@
3746
4086
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3747
4087
  </xsl:choose>
3748
4088
  </xsl:template><xsl:template match="item" mode="bookmark">
3749
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3750
- <fo:bookmark-title>
3751
- <xsl:if test="@section != ''">
3752
- <xsl:value-of select="@section"/>
3753
- <xsl:text> </xsl:text>
3754
- </xsl:if>
3755
- <xsl:value-of select="normalize-space(title)"/>
3756
- </fo:bookmark-title>
3757
- <xsl:apply-templates mode="bookmark"/>
3758
- </fo:bookmark>
4089
+ <xsl:choose>
4090
+ <xsl:when test="@id != ''">
4091
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4092
+ <fo:bookmark-title>
4093
+ <xsl:if test="@section != ''">
4094
+ <xsl:value-of select="@section"/>
4095
+ <xsl:text> </xsl:text>
4096
+ </xsl:if>
4097
+ <xsl:value-of select="normalize-space(title)"/>
4098
+ </fo:bookmark-title>
4099
+ <xsl:apply-templates mode="bookmark"/>
4100
+ </fo:bookmark>
4101
+ </xsl:when>
4102
+ <xsl:otherwise>
4103
+ <xsl:apply-templates mode="bookmark"/>
4104
+ </xsl:otherwise>
4105
+ </xsl:choose>
3759
4106
  </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">
3760
4107
  <xsl:if test="normalize-space() != ''">
3761
4108
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4121,7 +4468,19 @@
4121
4468
  </fo:inline>
4122
4469
  </xsl:if>
4123
4470
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4124
- <fo:inline><xsl:apply-templates/></fo:inline>
4471
+ <xsl:variable name="element">inline
4472
+
4473
+ </xsl:variable>
4474
+ <xsl:choose>
4475
+ <xsl:when test="contains($element, 'block')">
4476
+ <fo:block xsl:use-attribute-sets="example-p-style">
4477
+ <xsl:apply-templates/>
4478
+ </fo:block>
4479
+ </xsl:when>
4480
+ <xsl:otherwise>
4481
+ <fo:inline><xsl:apply-templates/></fo:inline>
4482
+ </xsl:otherwise>
4483
+ </xsl:choose>
4125
4484
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4126
4485
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4127
4486
 
@@ -4314,7 +4673,9 @@
4314
4673
 
4315
4674
 
4316
4675
  </xsl:if>
4317
-
4676
+
4677
+
4678
+
4318
4679
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4319
4680
  <xsl:if test="normalize-space(@citeas) = ''">
4320
4681
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4326,6 +4687,7 @@
4326
4687
 
4327
4688
 
4328
4689
 
4690
+
4329
4691
  </xsl:if>
4330
4692
 
4331
4693
  <xsl:apply-templates/>
@@ -4705,7 +5067,6 @@
4705
5067
  </xsl:template><xsl:template name="processBibitem">
4706
5068
 
4707
5069
 
4708
- <!-- end BIPM bibitem processing-->
4709
5070
 
4710
5071
 
4711
5072
 
@@ -5170,20 +5531,40 @@
5170
5531
  </xsl:call-template>
5171
5532
  </xsl:if>
5172
5533
  </xsl:template><xsl:template name="getLocalizedString">
5173
- <xsl:param name="key"/>
5534
+ <xsl:param name="key"/>
5535
+ <xsl:param name="formatted">false</xsl:param>
5174
5536
 
5175
5537
  <xsl:variable name="curr_lang">
5176
5538
  <xsl:call-template name="getLang"/>
5177
5539
  </xsl:variable>
5178
5540
 
5179
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5541
+ <xsl:variable name="data_value">
5542
+ <xsl:choose>
5543
+ <xsl:when test="$formatted = 'true'">
5544
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5545
+ </xsl:when>
5546
+ <xsl:otherwise>
5547
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5548
+ </xsl:otherwise>
5549
+ </xsl:choose>
5550
+ </xsl:variable>
5180
5551
 
5181
5552
  <xsl:choose>
5182
- <xsl:when test="$data_value != ''">
5183
- <xsl:value-of select="$data_value"/>
5553
+ <xsl:when test="normalize-space($data_value) != ''">
5554
+ <xsl:choose>
5555
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5556
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5557
+ </xsl:choose>
5184
5558
  </xsl:when>
5185
5559
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5186
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5560
+ <xsl:choose>
5561
+ <xsl:when test="$formatted = 'true'">
5562
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5563
+ </xsl:when>
5564
+ <xsl:otherwise>
5565
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5566
+ </xsl:otherwise>
5567
+ </xsl:choose>
5187
5568
  </xsl:when>
5188
5569
  <xsl:otherwise>
5189
5570
  <xsl:variable name="key_">
@@ -5194,7 +5575,7 @@
5194
5575
  <xsl:value-of select="$key_"/>
5195
5576
  </xsl:otherwise>
5196
5577
  </xsl:choose>
5197
-
5578
+
5198
5579
  </xsl:template><xsl:template name="setTrackChangesStyles">
5199
5580
  <xsl:param name="isAdded"/>
5200
5581
  <xsl:param name="isDeleted"/>
@@ -5245,4 +5626,100 @@
5245
5626
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5246
5627
  </xsl:choose>
5247
5628
  </xsl:attribute>
5629
+ </xsl:template><xsl:template name="number-to-words">
5630
+ <xsl:param name="number"/>
5631
+ <xsl:param name="first"/>
5632
+ <xsl:if test="$number != ''">
5633
+ <xsl:variable name="words">
5634
+ <words>
5635
+ <word cardinal="1">One-</word>
5636
+ <word ordinal="1">First </word>
5637
+ <word cardinal="2">Two-</word>
5638
+ <word ordinal="2">Second </word>
5639
+ <word cardinal="3">Three-</word>
5640
+ <word ordinal="3">Third </word>
5641
+ <word cardinal="4">Four-</word>
5642
+ <word ordinal="4">Fourth </word>
5643
+ <word cardinal="5">Five-</word>
5644
+ <word ordinal="5">Fifth </word>
5645
+ <word cardinal="6">Six-</word>
5646
+ <word ordinal="6">Sixth </word>
5647
+ <word cardinal="7">Seven-</word>
5648
+ <word ordinal="7">Seventh </word>
5649
+ <word cardinal="8">Eight-</word>
5650
+ <word ordinal="8">Eighth </word>
5651
+ <word cardinal="9">Nine-</word>
5652
+ <word ordinal="9">Ninth </word>
5653
+ <word ordinal="10">Tenth </word>
5654
+ <word ordinal="11">Eleventh </word>
5655
+ <word ordinal="12">Twelfth </word>
5656
+ <word ordinal="13">Thirteenth </word>
5657
+ <word ordinal="14">Fourteenth </word>
5658
+ <word ordinal="15">Fifteenth </word>
5659
+ <word ordinal="16">Sixteenth </word>
5660
+ <word ordinal="17">Seventeenth </word>
5661
+ <word ordinal="18">Eighteenth </word>
5662
+ <word ordinal="19">Nineteenth </word>
5663
+ <word cardinal="20">Twenty-</word>
5664
+ <word ordinal="20">Twentieth </word>
5665
+ <word cardinal="30">Thirty-</word>
5666
+ <word ordinal="30">Thirtieth </word>
5667
+ <word cardinal="40">Forty-</word>
5668
+ <word ordinal="40">Fortieth </word>
5669
+ <word cardinal="50">Fifty-</word>
5670
+ <word ordinal="50">Fiftieth </word>
5671
+ <word cardinal="60">Sixty-</word>
5672
+ <word ordinal="60">Sixtieth </word>
5673
+ <word cardinal="70">Seventy-</word>
5674
+ <word ordinal="70">Seventieth </word>
5675
+ <word cardinal="80">Eighty-</word>
5676
+ <word ordinal="80">Eightieth </word>
5677
+ <word cardinal="90">Ninety-</word>
5678
+ <word ordinal="90">Ninetieth </word>
5679
+ <word cardinal="100">Hundred-</word>
5680
+ <word ordinal="100">Hundredth </word>
5681
+ </words>
5682
+ </xsl:variable>
5683
+
5684
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5685
+
5686
+ <xsl:variable name="value">
5687
+ <xsl:choose>
5688
+ <xsl:when test="$ordinal != ''">
5689
+ <xsl:value-of select="$ordinal"/>
5690
+ </xsl:when>
5691
+ <xsl:otherwise>
5692
+ <xsl:choose>
5693
+ <xsl:when test="$number &lt; 100">
5694
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5695
+ <xsl:variable name="digit" select="substring($number,2)"/>
5696
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5697
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5698
+ </xsl:when>
5699
+ <xsl:otherwise>
5700
+ <!-- more 100 -->
5701
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5702
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5703
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5704
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5705
+ <xsl:call-template name="number-to-words">
5706
+ <xsl:with-param name="number" select="$digits"/>
5707
+ </xsl:call-template>
5708
+ </xsl:otherwise>
5709
+ </xsl:choose>
5710
+ </xsl:otherwise>
5711
+ </xsl:choose>
5712
+ </xsl:variable>
5713
+ <xsl:choose>
5714
+ <xsl:when test="$first = 'true'">
5715
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5716
+ <xsl:call-template name="capitalize">
5717
+ <xsl:with-param name="str" select="$value_lc"/>
5718
+ </xsl:call-template>
5719
+ </xsl:when>
5720
+ <xsl:otherwise>
5721
+ <xsl:value-of select="$value"/>
5722
+ </xsl:otherwise>
5723
+ </xsl:choose>
5724
+ </xsl:if>
5248
5725
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "1.7.5".freeze
3
+ VERSION = "1.7.9".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
- spec.add_dependency "metanorma-generic", "~> 1.10.0"
31
+ spec.add_dependency "metanorma-generic", "~> 1.10.2"
32
32
 
33
33
  spec.add_development_dependency "byebug", "~> 9.1"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.10.0
19
+ version: 1.10.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.10.0
26
+ version: 1.10.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement