metanorma-csa 1.8.4 → 1.8.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 336d7f47e040b261aff839d9a72a0aea35b619f63e92080826f60609632d1317
4
- data.tar.gz: d75ca439e62213b743bf7d332960bb85e08538e39a24bc52055aec264b4ef5af
3
+ metadata.gz: 55933818281eeb7a3afcc20e0fe8bd36384a593825a1e1d90a558a4f533131b3
4
+ data.tar.gz: 83a4b1c0e41f8b5b4b068a26f8956cf20b04bab1cc3a565d572936e3229656d3
5
5
  SHA512:
6
- metadata.gz: 11e0b4fdd0f904f437745c9dc3be1b233d6676c6a45c7507e94c5cefd058bdf203b4d5bde78103ae0e9bc2d207e7c4e509e19ff92174b1057091ab18b6cdfee1
7
- data.tar.gz: ed6db8db7dd3a9e25d7b859fb4017bb47cab99b80b6b1c4c7543eec4dc5235137d92cd22532fbba2f163dfba0164c6de14f730549e4ad84bed90c7e7b498c9f1
6
+ metadata.gz: 73b56afc526f229741eefb23a31ca242077da831857f2fabc04706a3b13129b2829a040453d0c959a247f6d44d72d8c2c6131947cc3e65f7dbc0b7d35c56ab40
7
+ data.tar.gz: fcd16d242bb9b74d7698566a23aec17c73dfbfdec439b4ede7e02557df9b5322e3822ed136367235a93450e00507fbb5e2336cd02c10b77defb9326faa576a2b
@@ -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>
@@ -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="'215.9mm'"/>
11
- <xsl:variable name="pageHeight" select="'279.4mm'"/>
10
+ <xsl:variable name="pageWidth" select="215.9"/>
11
+ <xsl:variable name="pageHeight" select="279.4"/>
12
+ <xsl:variable name="marginLeftRight1" select="25"/>
13
+ <xsl:variable name="marginLeftRight2" select="25"/>
14
+ <xsl:variable name="marginTop" select="25"/>
15
+ <xsl:variable name="marginBottom" select="21"/>
16
+
12
17
 
13
18
 
14
19
 
@@ -38,18 +43,18 @@
38
43
  <fo:root font-family="Azo Sans, STIX Two Math" font-size="10pt" xml:lang="{$lang}">
39
44
  <fo:layout-master-set>
40
45
  <!-- Cover page -->
41
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
46
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
42
47
  <fo:region-body margin-top="21mm" margin-bottom="21mm" margin-left="25mm" margin-right="25mm"/>
43
48
  <fo:region-before region-name="cover-page-header" extent="21mm" precedence="true"/>
44
49
  <fo:region-after region-name="footer" extent="21mm"/>
45
50
  </fo:simple-page-master>
46
51
 
47
- <fo:simple-page-master master-name="document" page-width="{$pageWidth}" page-height="{$pageHeight}">
48
- <fo:region-body margin-top="25mm" margin-bottom="21mm" margin-left="25mm" margin-right="25mm"/>
49
- <fo:region-before region-name="header" extent="25mm" precedence="true"/>
50
- <fo:region-after region-name="footer" extent="21mm"/>
51
- <fo:region-start region-name="left-region" extent="25mm"/>
52
- <fo:region-end region-name="right-region" extent="25mm"/>
52
+ <fo:simple-page-master master-name="document" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
53
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
54
+ <fo:region-before region-name="header" extent="{$marginTop}mm" precedence="true"/>
55
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
56
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
57
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
53
58
  </fo:simple-page-master>
54
59
 
55
60
  </fo:layout-master-set>
@@ -558,10 +563,11 @@
558
563
  <xsl:if test="position() = last()">: </xsl:if>
559
564
  </xsl:for-each>
560
565
  <!-- csa:docidentifier -->
561
- <xsl:if test="csa:docidentifier">
566
+ <!-- <xsl:if test="csa:docidentifier">
562
567
  <xsl:value-of select="csa:docidentifier/@type"/><xsl:text> </xsl:text>
563
568
  <xsl:value-of select="csa:docidentifier"/>
564
- </xsl:if>
569
+ </xsl:if> -->
570
+ <xsl:value-of select="csa:docidentifier"/>
565
571
  <xsl:apply-templates select="csa:note"/>
566
572
  <xsl:if test="csa:docidentifier">, </xsl:if>
567
573
  <fo:inline font-style="italic">
@@ -763,7 +769,7 @@
763
769
  <xsl:when test="csa:docidentifier/@type = 'ISO' and csa:formattedref"/>
764
770
  <xsl:when test="csa:docidentifier/@type = 'OGC' and csa:formattedref"/>
765
771
  <xsl:otherwise><fo:inline>
766
- <xsl:if test="csa:docidentifier/@type = 'OGC'">OGC </xsl:if>
772
+ <!-- <xsl:if test="csa:docidentifier/@type = 'OGC'">OGC </xsl:if> -->
767
773
  <xsl:value-of select="csa:docidentifier"/><xsl:apply-templates select="csa:note"/>, </fo:inline></xsl:otherwise>
768
774
  </xsl:choose>
769
775
  </xsl:if>
@@ -1094,7 +1100,7 @@
1094
1100
 
1095
1101
 
1096
1102
 
1097
-
1103
+
1098
1104
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1099
1105
 
1100
1106
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1163,7 +1169,10 @@
1163
1169
 
1164
1170
 
1165
1171
 
1166
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1172
+
1173
+ </xsl:attribute-set><xsl:variable name="table-border_">
1174
+
1175
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1167
1176
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1168
1177
 
1169
1178
 
@@ -1179,6 +1188,8 @@
1179
1188
 
1180
1189
 
1181
1190
 
1191
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1192
+
1182
1193
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1183
1194
 
1184
1195
 
@@ -1197,6 +1208,7 @@
1197
1208
 
1198
1209
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1199
1210
 
1211
+
1200
1212
  <xsl:attribute name="color">rgb(33, 94, 159)</xsl:attribute>
1201
1213
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1202
1214
 
@@ -1225,6 +1237,7 @@
1225
1237
 
1226
1238
 
1227
1239
 
1240
+
1228
1241
  </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">
1229
1242
 
1230
1243
 
@@ -1268,10 +1281,12 @@
1268
1281
 
1269
1282
 
1270
1283
 
1284
+
1271
1285
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1272
1286
 
1273
1287
 
1274
1288
 
1289
+
1275
1290
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1276
1291
 
1277
1292
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1335,6 +1350,7 @@
1335
1350
 
1336
1351
 
1337
1352
 
1353
+
1338
1354
 
1339
1355
 
1340
1356
 
@@ -1408,6 +1424,8 @@
1408
1424
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1409
1425
 
1410
1426
 
1427
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1428
+
1411
1429
  </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">
1412
1430
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1413
1431
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1418,14 +1436,15 @@
1418
1436
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1419
1437
 
1420
1438
  <!-- Normative references -->
1421
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1439
+ <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"/>
1422
1440
  <!-- Terms and definitions -->
1423
1441
  <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"/>
1424
1442
  <!-- Another main sections -->
1425
1443
  <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"/>
1426
1444
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1427
1445
  <!-- Bibliography -->
1428
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1446
+ <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"/>
1447
+
1429
1448
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1430
1449
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1431
1450
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1461,13 +1480,15 @@
1461
1480
  <xsl:variable name="table">
1462
1481
 
1463
1482
  <xsl:variable name="simple-table">
1464
- <xsl:call-template name="getSimpleTable"/>
1483
+ <xsl:call-template name="getSimpleTable"/>
1465
1484
  </xsl:variable>
1466
1485
 
1467
1486
  <!-- <xsl:if test="$namespace = 'bipm'">
1468
- <fo:block>&#xA0;</fo:block>
1487
+ <fo:block>&#xA0;</fo:block>
1469
1488
  </xsl:if> -->
1470
1489
 
1490
+
1491
+ <!-- Display table's name before table as standalone block -->
1471
1492
  <!-- $namespace = 'iso' or -->
1472
1493
 
1473
1494
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1541,6 +1562,12 @@
1541
1562
 
1542
1563
 
1543
1564
 
1565
+
1566
+
1567
+
1568
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1569
+
1570
+
1544
1571
  <xsl:variable name="table_width">
1545
1572
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1546
1573
  100%
@@ -1559,12 +1586,14 @@
1559
1586
 
1560
1587
 
1561
1588
 
1589
+
1562
1590
 
1563
1591
 
1564
1592
 
1565
1593
 
1566
1594
 
1567
1595
 
1596
+
1568
1597
  </xsl:variable>
1569
1598
 
1570
1599
 
@@ -1706,6 +1735,9 @@
1706
1735
  <fo:block xsl:use-attribute-sets="table-name-style">
1707
1736
 
1708
1737
 
1738
+
1739
+
1740
+
1709
1741
  <xsl:choose>
1710
1742
  <xsl:when test="$continued = 'true'">
1711
1743
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -1853,6 +1885,7 @@
1853
1885
  <!-- font-weight="bold" -->
1854
1886
  <fo:table-header>
1855
1887
 
1888
+
1856
1889
  <xsl:apply-templates/>
1857
1890
  </fo:table-header>
1858
1891
  </xsl:template><xsl:template name="table-header-title">
@@ -1977,6 +2010,8 @@
1977
2010
  </xsl:choose>
1978
2011
  </xsl:for-each>
1979
2012
 
2013
+
2014
+
1980
2015
  <xsl:choose>
1981
2016
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1982
2017
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2003,6 +2038,7 @@
2003
2038
 
2004
2039
 
2005
2040
 
2041
+
2006
2042
  <!-- fn will be processed inside 'note' processing -->
2007
2043
 
2008
2044
 
@@ -2011,6 +2047,11 @@
2011
2047
 
2012
2048
 
2013
2049
 
2050
+
2051
+
2052
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2053
+
2054
+
2014
2055
  <!-- except gb -->
2015
2056
 
2016
2057
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2036,6 +2077,10 @@
2036
2077
  <!-- fn processing -->
2037
2078
  <xsl:call-template name="fn_display"/>
2038
2079
 
2080
+
2081
+ <!-- for PAS display Notes after footnotes -->
2082
+
2083
+
2039
2084
  </fo:table-cell>
2040
2085
  </fo:table-row>
2041
2086
  </fo:table-body>
@@ -2089,15 +2134,24 @@
2089
2134
 
2090
2135
 
2091
2136
 
2137
+
2138
+
2092
2139
  </xsl:if>
2093
2140
  <xsl:if test="$parent-name = 'tfoot'">
2094
2141
 
2095
2142
 
2143
+
2096
2144
  </xsl:if>
2097
2145
 
2098
2146
 
2099
2147
 
2100
2148
 
2149
+
2150
+
2151
+
2152
+
2153
+
2154
+
2101
2155
  <!-- <xsl:if test="$namespace = 'bipm'">
2102
2156
  <xsl:attribute name="height">8mm</xsl:attribute>
2103
2157
  </xsl:if> -->
@@ -2183,6 +2237,10 @@
2183
2237
 
2184
2238
 
2185
2239
 
2240
+
2241
+
2242
+
2243
+
2186
2244
  <xsl:if test=".//*[local-name() = 'table']">
2187
2245
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2188
2246
  </xsl:if>
@@ -2212,8 +2270,14 @@
2212
2270
 
2213
2271
 
2214
2272
 
2273
+
2274
+
2275
+ <!-- Table's note name (NOTE, for example) -->
2276
+
2215
2277
  <fo:inline padding-right="2mm">
2216
2278
 
2279
+
2280
+
2217
2281
 
2218
2282
 
2219
2283
 
@@ -2221,6 +2285,8 @@
2221
2285
 
2222
2286
  </fo:inline>
2223
2287
 
2288
+
2289
+
2224
2290
  <xsl:apply-templates mode="process"/>
2225
2291
  </fo:block>
2226
2292
 
@@ -2240,6 +2306,8 @@
2240
2306
  <xsl:variable name="reference" select="@reference"/>
2241
2307
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2242
2308
  <fo:block margin-bottom="12pt">
2309
+
2310
+
2243
2311
 
2244
2312
 
2245
2313
 
@@ -2253,9 +2321,11 @@
2253
2321
 
2254
2322
 
2255
2323
 
2324
+
2256
2325
  <xsl:value-of select="@reference"/>
2257
2326
 
2258
2327
 
2328
+
2259
2329
  </fo:inline>
2260
2330
  <fo:inline>
2261
2331
 
@@ -2396,11 +2466,16 @@
2396
2466
 
2397
2467
 
2398
2468
 
2469
+
2470
+
2471
+
2472
+
2399
2473
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2400
2474
 
2401
2475
 
2402
2476
  <xsl:value-of select="@reference"/>
2403
2477
 
2478
+
2404
2479
  </fo:basic-link>
2405
2480
  </fo:inline>
2406
2481
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2698,6 +2773,7 @@
2698
2773
 
2699
2774
  <fo:table-row>
2700
2775
 
2776
+
2701
2777
  <fo:table-cell>
2702
2778
 
2703
2779
  <fo:block margin-top="6pt">
@@ -2713,6 +2789,7 @@
2713
2789
 
2714
2790
 
2715
2791
 
2792
+
2716
2793
  <xsl:apply-templates/>
2717
2794
  <!-- <xsl:if test="$namespace = 'gb'">
2718
2795
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3260,7 +3337,15 @@
3260
3337
  <xsl:copy>
3261
3338
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3262
3339
  </xsl:copy>
3263
- <mathml:mspace width="0.5ex"/>
3340
+ <xsl:choose>
3341
+ <!-- if in msub, then don't add space -->
3342
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3343
+ <!-- if next char in digit, don't add space -->
3344
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3345
+ <xsl:otherwise>
3346
+ <mathml:mspace width="0.5ex"/>
3347
+ </xsl:otherwise>
3348
+ </xsl:choose>
3264
3349
  </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">
3265
3350
  <xsl:variable name="target">
3266
3351
  <xsl:choose>
@@ -3284,6 +3369,8 @@
3284
3369
  </xsl:variable>
3285
3370
  <fo:inline xsl:use-attribute-sets="link-style">
3286
3371
 
3372
+
3373
+
3287
3374
  <xsl:choose>
3288
3375
  <xsl:when test="$target_text = ''">
3289
3376
  <xsl:apply-templates/>
@@ -3392,6 +3479,7 @@
3392
3479
 
3393
3480
 
3394
3481
 
3482
+
3395
3483
  <fo:block-container margin-left="0mm">
3396
3484
 
3397
3485
 
@@ -3439,6 +3527,7 @@
3439
3527
  </xsl:choose>
3440
3528
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3441
3529
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3530
+
3442
3531
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3443
3532
 
3444
3533
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3512,6 +3601,7 @@
3512
3601
  </xsl:call-template>
3513
3602
 
3514
3603
  <fo:block>
3604
+
3515
3605
  <xsl:apply-templates/>
3516
3606
  </fo:block>
3517
3607
  <xsl:call-template name="fn_display_figure"/>
@@ -3566,7 +3656,24 @@
3566
3656
  </fo:instream-foreign-object>
3567
3657
  </xsl:when>
3568
3658
  <xsl:otherwise>
3569
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3659
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3660
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3661
+
3662
+ <xsl:variable name="img_src">
3663
+ <xsl:choose>
3664
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3665
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3666
+ </xsl:choose>
3667
+ </xsl:variable>
3668
+
3669
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3670
+ <xsl:if test="number($scale) &lt; 100">
3671
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3672
+ </xsl:if>
3673
+
3674
+ </xsl:if>
3675
+
3676
+ </fo:external-graphic>
3570
3677
  </xsl:otherwise>
3571
3678
  </xsl:choose>
3572
3679
 
@@ -3634,6 +3741,253 @@
3634
3741
  <xsl:param name="height"/>
3635
3742
  <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; "/>
3636
3743
  <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; "/>
3744
+ </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">
3745
+ <xsl:param name="name"/>
3746
+
3747
+ <xsl:variable name="svg_content">
3748
+ <xsl:apply-templates select="." mode="svg_update"/>
3749
+ </xsl:variable>
3750
+
3751
+ <xsl:variable name="alt-text">
3752
+ <xsl:choose>
3753
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3754
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3755
+ </xsl:when>
3756
+ <xsl:when test="normalize-space($name) != ''">
3757
+ <xsl:value-of select="$name"/>
3758
+ </xsl:when>
3759
+ <xsl:otherwise>Figure</xsl:otherwise>
3760
+ </xsl:choose>
3761
+ </xsl:variable>
3762
+
3763
+ <xsl:choose>
3764
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3765
+ <fo:block>
3766
+ <xsl:variable name="width" select="@width"/>
3767
+ <xsl:variable name="height" select="@height"/>
3768
+
3769
+ <xsl:variable name="scale_x">
3770
+ <xsl:choose>
3771
+ <xsl:when test="$width &gt; $width_effective_px">
3772
+ <xsl:value-of select="$width_effective_px div $width"/>
3773
+ </xsl:when>
3774
+ <xsl:otherwise>1</xsl:otherwise>
3775
+ </xsl:choose>
3776
+ </xsl:variable>
3777
+
3778
+ <xsl:variable name="scale_y">
3779
+ <xsl:choose>
3780
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3781
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3782
+ </xsl:when>
3783
+ <xsl:otherwise>1</xsl:otherwise>
3784
+ </xsl:choose>
3785
+ </xsl:variable>
3786
+
3787
+ <xsl:variable name="scale">
3788
+ <xsl:choose>
3789
+ <xsl:when test="$scale_y != 1">
3790
+ <xsl:value-of select="$scale_x * $scale_y"/>
3791
+ </xsl:when>
3792
+ <xsl:otherwise>
3793
+ <xsl:value-of select="$scale_x"/>
3794
+ </xsl:otherwise>
3795
+ </xsl:choose>
3796
+ </xsl:variable>
3797
+
3798
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3799
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3800
+
3801
+ <fo:table table-layout="fixed" width="100%">
3802
+ <fo:table-column column-width="proportional-column-width(1)"/>
3803
+ <fo:table-column column-width="{$width_scale}px"/>
3804
+ <fo:table-column column-width="proportional-column-width(1)"/>
3805
+ <fo:table-body>
3806
+ <fo:table-row>
3807
+ <fo:table-cell column-number="2">
3808
+ <fo:block>
3809
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3810
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3811
+ <fo:block line-height="0" font-size="0">
3812
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3813
+ <xsl:call-template name="bookmark"/>
3814
+ </xsl:for-each>
3815
+ </fo:block>
3816
+ </xsl:if>
3817
+ <fo:block text-depth="0" line-height="0" font-size="0">
3818
+
3819
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3820
+ <xsl:attribute name="width">100%</xsl:attribute>
3821
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3822
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3823
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3824
+
3825
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3826
+ </fo:instream-foreign-object>
3827
+ </fo:block>
3828
+
3829
+ <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">
3830
+ <xsl:with-param name="scale" select="$scale"/>
3831
+ </xsl:apply-templates>
3832
+ </fo:block-container>
3833
+ </fo:block>
3834
+ </fo:table-cell>
3835
+ </fo:table-row>
3836
+ </fo:table-body>
3837
+ </fo:table>
3838
+ </fo:block>
3839
+
3840
+ </xsl:when>
3841
+ <xsl:otherwise>
3842
+ <fo:block xsl:use-attribute-sets="image-style">
3843
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3844
+ <xsl:attribute name="width">100%</xsl:attribute>
3845
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3846
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3847
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3848
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3849
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3850
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3851
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3852
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3853
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3854
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3855
+ </xsl:if>
3856
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3857
+ <xsl:copy-of select="$svg_content"/>
3858
+ </fo:instream-foreign-object>
3859
+ </fo:block>
3860
+ </xsl:otherwise>
3861
+ </xsl:choose>
3862
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3863
+ <xsl:copy>
3864
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3865
+ </xsl:copy>
3866
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3867
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3868
+ <xsl:value-of select="."/>
3869
+ </xsl:attribute>
3870
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3871
+ <xsl:copy>
3872
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3873
+ <xsl:variable name="viewbox">
3874
+ <xsl:call-template name="split">
3875
+ <xsl:with-param name="pText" select="@viewBox"/>
3876
+ <xsl:with-param name="sep" select="' '"/>
3877
+ </xsl:call-template>
3878
+ </xsl:variable>
3879
+ <xsl:attribute name="width">
3880
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3881
+ </xsl:attribute>
3882
+ <xsl:attribute name="height">
3883
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3884
+ </xsl:attribute>
3885
+ <xsl:apply-templates mode="svg_update"/>
3886
+ </xsl:copy>
3887
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3888
+ <xsl:variable name="svg_content" select="document(@src)"/>
3889
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3890
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3891
+ <xsl:call-template name="image_svg">
3892
+ <xsl:with-param name="name" select="$name"/>
3893
+ </xsl:call-template>
3894
+ </xsl:for-each>
3895
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3896
+ <xsl:copy>
3897
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3898
+ </xsl:copy>
3899
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3900
+ <xsl:apply-templates mode="svg_remove_a"/>
3901
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3902
+ <xsl:param name="scale"/>
3903
+ <xsl:variable name="dest">
3904
+ <xsl:choose>
3905
+ <xsl:when test="starts-with(@href, '#')">
3906
+ <xsl:value-of select="substring-after(@href, '#')"/>
3907
+ </xsl:when>
3908
+ <xsl:otherwise>
3909
+ <xsl:value-of select="@href"/>
3910
+ </xsl:otherwise>
3911
+ </xsl:choose>
3912
+ </xsl:variable>
3913
+ <xsl:for-each select="./*[local-name() = 'rect']">
3914
+ <xsl:call-template name="insertSVGMapLink">
3915
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3916
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3917
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3918
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3919
+ <xsl:with-param name="dest" select="$dest"/>
3920
+ </xsl:call-template>
3921
+ </xsl:for-each>
3922
+
3923
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3924
+ <xsl:variable name="points">
3925
+ <xsl:call-template name="split">
3926
+ <xsl:with-param name="pText" select="@points"/>
3927
+ </xsl:call-template>
3928
+ </xsl:variable>
3929
+ <xsl:variable name="x_coords">
3930
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3931
+ <xsl:sort select="." data-type="number"/>
3932
+ <x><xsl:value-of select="."/></x>
3933
+ </xsl:for-each>
3934
+ </xsl:variable>
3935
+ <xsl:variable name="y_coords">
3936
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3937
+ <xsl:sort select="." data-type="number"/>
3938
+ <y><xsl:value-of select="."/></y>
3939
+ </xsl:for-each>
3940
+ </xsl:variable>
3941
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3942
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3943
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3944
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3945
+ <xsl:call-template name="insertSVGMapLink">
3946
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3947
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3948
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3949
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3950
+ <xsl:with-param name="dest" select="$dest"/>
3951
+ </xsl:call-template>
3952
+ </xsl:for-each>
3953
+
3954
+ <xsl:for-each select="./*[local-name() = 'circle']">
3955
+ <xsl:call-template name="insertSVGMapLink">
3956
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3957
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3958
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3959
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3960
+ <xsl:with-param name="dest" select="$dest"/>
3961
+ </xsl:call-template>
3962
+ </xsl:for-each>
3963
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3964
+ <xsl:call-template name="insertSVGMapLink">
3965
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3966
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3967
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3968
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3969
+ <xsl:with-param name="dest" select="$dest"/>
3970
+ </xsl:call-template>
3971
+ </xsl:for-each>
3972
+ </xsl:template><xsl:template name="insertSVGMapLink">
3973
+ <xsl:param name="left"/>
3974
+ <xsl:param name="top"/>
3975
+ <xsl:param name="width"/>
3976
+ <xsl:param name="height"/>
3977
+ <xsl:param name="dest"/>
3978
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3979
+ <fo:block font-size="1pt">
3980
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3981
+ <fo:inline-container inline-progression-dimension="100%">
3982
+ <fo:block-container height="{$height - 1}px" width="100%">
3983
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3984
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3985
+ </xsl:if> -->
3986
+ <fo:block> </fo:block></fo:block-container>
3987
+ </fo:inline-container>
3988
+ </fo:basic-link>
3989
+ </fo:block>
3990
+ </fo:block-container>
3637
3991
  </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">
3638
3992
  <xsl:apply-templates mode="contents"/>
3639
3993
  <xsl:text> </xsl:text>
@@ -3662,28 +4016,39 @@
3662
4016
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3663
4017
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3664
4018
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4019
+ <xsl:if test="@bundle = 'true'">
4020
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4021
+ </xsl:if>
3665
4022
  <fo:bookmark-title>
3666
- <xsl:variable name="bookmark-title_">
3667
- <xsl:call-template name="getLangVersion">
3668
- <xsl:with-param name="lang" select="@lang"/>
3669
- <xsl:with-param name="doctype" select="@doctype"/>
3670
- <xsl:with-param name="title" select="@title-part"/>
3671
- </xsl:call-template>
3672
- </xsl:variable>
3673
4023
  <xsl:choose>
3674
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3675
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3676
- </xsl:when>
3677
- <xsl:otherwise>
4024
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4025
+ <xsl:variable name="bookmark-title_">
4026
+ <xsl:call-template name="getLangVersion">
4027
+ <xsl:with-param name="lang" select="@lang"/>
4028
+ <xsl:with-param name="doctype" select="@doctype"/>
4029
+ <xsl:with-param name="title" select="@title-part"/>
4030
+ </xsl:call-template>
4031
+ </xsl:variable>
3678
4032
  <xsl:choose>
3679
- <xsl:when test="@lang = 'en'">English</xsl:when>
3680
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3681
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3682
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4033
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4034
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4035
+ </xsl:when>
4036
+ <xsl:otherwise>
4037
+ <xsl:choose>
4038
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4039
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4040
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4041
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4042
+ </xsl:choose>
4043
+ </xsl:otherwise>
3683
4044
  </xsl:choose>
4045
+ </xsl:when>
4046
+ <xsl:otherwise>
4047
+ <xsl:value-of select="@title-part"/>
3684
4048
  </xsl:otherwise>
3685
4049
  </xsl:choose>
3686
4050
  </fo:bookmark-title>
4051
+
3687
4052
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3688
4053
 
3689
4054
  <xsl:call-template name="insertFigureBookmarks">
@@ -3782,20 +4147,28 @@
3782
4147
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3783
4148
  </xsl:choose>
3784
4149
  </xsl:template><xsl:template match="item" mode="bookmark">
3785
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3786
- <fo:bookmark-title>
3787
- <xsl:if test="@section != ''">
3788
- <xsl:value-of select="@section"/>
3789
- <xsl:text> </xsl:text>
3790
- </xsl:if>
3791
- <xsl:value-of select="normalize-space(title)"/>
3792
- </fo:bookmark-title>
3793
- <xsl:apply-templates mode="bookmark"/>
3794
- </fo:bookmark>
4150
+ <xsl:choose>
4151
+ <xsl:when test="@id != ''">
4152
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4153
+ <fo:bookmark-title>
4154
+ <xsl:if test="@section != ''">
4155
+ <xsl:value-of select="@section"/>
4156
+ <xsl:text> </xsl:text>
4157
+ </xsl:if>
4158
+ <xsl:value-of select="normalize-space(title)"/>
4159
+ </fo:bookmark-title>
4160
+ <xsl:apply-templates mode="bookmark"/>
4161
+ </fo:bookmark>
4162
+ </xsl:when>
4163
+ <xsl:otherwise>
4164
+ <xsl:apply-templates mode="bookmark"/>
4165
+ </xsl:otherwise>
4166
+ </xsl:choose>
3795
4167
  </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">
3796
4168
  <xsl:if test="normalize-space() != ''">
3797
4169
  <fo:block xsl:use-attribute-sets="figure-name-style">
3798
4170
 
4171
+
3799
4172
  <xsl:apply-templates/>
3800
4173
  </fo:block>
3801
4174
  </xsl:if>
@@ -3876,6 +4249,7 @@
3876
4249
 
3877
4250
  <fo:block-container margin-left="0mm">
3878
4251
  <xsl:copy-of select="@id"/>
4252
+
3879
4253
  <xsl:if test="parent::*[local-name() = 'note']">
3880
4254
  <xsl:attribute name="margin-left">
3881
4255
  <xsl:choose>
@@ -3886,7 +4260,9 @@
3886
4260
 
3887
4261
  </xsl:if>
3888
4262
  <fo:block-container margin-left="0mm">
3889
-
4263
+
4264
+
4265
+
3890
4266
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3891
4267
  <xsl:variable name="_font-size">
3892
4268
  10
@@ -3915,10 +4291,14 @@
3915
4291
  </xsl:choose>
3916
4292
  </xsl:attribute>
3917
4293
  </xsl:if>
3918
- <xsl:apply-templates/>
3919
- </fo:block>
4294
+
4295
+ <xsl:apply-templates/>
4296
+ </fo:block>
4297
+
4298
+
3920
4299
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3921
4300
 
4301
+
3922
4302
  </fo:block-container>
3923
4303
  </fo:block-container>
3924
4304
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4264,6 +4644,8 @@
4264
4644
 
4265
4645
 
4266
4646
 
4647
+
4648
+
4267
4649
  <xsl:call-template name="getTitle">
4268
4650
  <xsl:with-param name="name" select="'title-source'"/>
4269
4651
  </xsl:call-template>
@@ -4340,7 +4722,9 @@
4340
4722
 
4341
4723
 
4342
4724
  </xsl:if>
4343
-
4725
+
4726
+
4727
+
4344
4728
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4345
4729
  <xsl:if test="normalize-space(@citeas) = ''">
4346
4730
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4349,6 +4733,7 @@
4349
4733
 
4350
4734
 
4351
4735
 
4736
+
4352
4737
  </xsl:if>
4353
4738
 
4354
4739
  <xsl:apply-templates/>
@@ -4489,6 +4874,7 @@
4489
4874
  <xsl:call-template name="setId"/>
4490
4875
 
4491
4876
 
4877
+
4492
4878
  <xsl:apply-templates/>
4493
4879
  </fo:block>
4494
4880
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4735,17 +5121,17 @@
4735
5121
  <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')]"/>
4736
5122
  <xsl:choose>
4737
5123
  <xsl:when test="normalize-space($_doc_ident) != ''">
4738
- <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"/>
5124
+ <!-- <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"/>
4739
5125
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4740
5126
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4741
- </xsl:if>
5127
+ </xsl:if> -->
4742
5128
  <xsl:value-of select="$_doc_ident"/>
4743
5129
  </xsl:when>
4744
5130
  <xsl:otherwise>
4745
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5131
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4746
5132
  <xsl:if test="$type != ''">
4747
5133
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4748
- </xsl:if>
5134
+ </xsl:if> -->
4749
5135
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4750
5136
  </xsl:otherwise>
4751
5137
  </xsl:choose>
@@ -5186,20 +5572,40 @@
5186
5572
  </xsl:call-template>
5187
5573
  </xsl:if>
5188
5574
  </xsl:template><xsl:template name="getLocalizedString">
5189
- <xsl:param name="key"/>
5575
+ <xsl:param name="key"/>
5576
+ <xsl:param name="formatted">false</xsl:param>
5190
5577
 
5191
5578
  <xsl:variable name="curr_lang">
5192
5579
  <xsl:call-template name="getLang"/>
5193
5580
  </xsl:variable>
5194
5581
 
5195
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5582
+ <xsl:variable name="data_value">
5583
+ <xsl:choose>
5584
+ <xsl:when test="$formatted = 'true'">
5585
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5586
+ </xsl:when>
5587
+ <xsl:otherwise>
5588
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5589
+ </xsl:otherwise>
5590
+ </xsl:choose>
5591
+ </xsl:variable>
5196
5592
 
5197
5593
  <xsl:choose>
5198
- <xsl:when test="$data_value != ''">
5199
- <xsl:value-of select="$data_value"/>
5594
+ <xsl:when test="normalize-space($data_value) != ''">
5595
+ <xsl:choose>
5596
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5597
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5598
+ </xsl:choose>
5200
5599
  </xsl:when>
5201
5600
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5202
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5601
+ <xsl:choose>
5602
+ <xsl:when test="$formatted = 'true'">
5603
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5604
+ </xsl:when>
5605
+ <xsl:otherwise>
5606
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5607
+ </xsl:otherwise>
5608
+ </xsl:choose>
5203
5609
  </xsl:when>
5204
5610
  <xsl:otherwise>
5205
5611
  <xsl:variable name="key_">
@@ -5210,7 +5616,7 @@
5210
5616
  <xsl:value-of select="$key_"/>
5211
5617
  </xsl:otherwise>
5212
5618
  </xsl:choose>
5213
-
5619
+
5214
5620
  </xsl:template><xsl:template name="setTrackChangesStyles">
5215
5621
  <xsl:param name="isAdded"/>
5216
5622
  <xsl:param name="isDeleted"/>
@@ -5251,4 +5657,110 @@
5251
5657
  <xsl:value-of select="$align"/>
5252
5658
  </xsl:when>
5253
5659
  </xsl:choose>
5660
+ </xsl:template><xsl:template name="setTextAlignment">
5661
+ <xsl:param name="default">left</xsl:param>
5662
+ <xsl:attribute name="text-align">
5663
+ <xsl:choose>
5664
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5665
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5666
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5667
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5668
+ </xsl:choose>
5669
+ </xsl:attribute>
5670
+ </xsl:template><xsl:template name="number-to-words">
5671
+ <xsl:param name="number"/>
5672
+ <xsl:param name="first"/>
5673
+ <xsl:if test="$number != ''">
5674
+ <xsl:variable name="words">
5675
+ <words>
5676
+ <word cardinal="1">One-</word>
5677
+ <word ordinal="1">First </word>
5678
+ <word cardinal="2">Two-</word>
5679
+ <word ordinal="2">Second </word>
5680
+ <word cardinal="3">Three-</word>
5681
+ <word ordinal="3">Third </word>
5682
+ <word cardinal="4">Four-</word>
5683
+ <word ordinal="4">Fourth </word>
5684
+ <word cardinal="5">Five-</word>
5685
+ <word ordinal="5">Fifth </word>
5686
+ <word cardinal="6">Six-</word>
5687
+ <word ordinal="6">Sixth </word>
5688
+ <word cardinal="7">Seven-</word>
5689
+ <word ordinal="7">Seventh </word>
5690
+ <word cardinal="8">Eight-</word>
5691
+ <word ordinal="8">Eighth </word>
5692
+ <word cardinal="9">Nine-</word>
5693
+ <word ordinal="9">Ninth </word>
5694
+ <word ordinal="10">Tenth </word>
5695
+ <word ordinal="11">Eleventh </word>
5696
+ <word ordinal="12">Twelfth </word>
5697
+ <word ordinal="13">Thirteenth </word>
5698
+ <word ordinal="14">Fourteenth </word>
5699
+ <word ordinal="15">Fifteenth </word>
5700
+ <word ordinal="16">Sixteenth </word>
5701
+ <word ordinal="17">Seventeenth </word>
5702
+ <word ordinal="18">Eighteenth </word>
5703
+ <word ordinal="19">Nineteenth </word>
5704
+ <word cardinal="20">Twenty-</word>
5705
+ <word ordinal="20">Twentieth </word>
5706
+ <word cardinal="30">Thirty-</word>
5707
+ <word ordinal="30">Thirtieth </word>
5708
+ <word cardinal="40">Forty-</word>
5709
+ <word ordinal="40">Fortieth </word>
5710
+ <word cardinal="50">Fifty-</word>
5711
+ <word ordinal="50">Fiftieth </word>
5712
+ <word cardinal="60">Sixty-</word>
5713
+ <word ordinal="60">Sixtieth </word>
5714
+ <word cardinal="70">Seventy-</word>
5715
+ <word ordinal="70">Seventieth </word>
5716
+ <word cardinal="80">Eighty-</word>
5717
+ <word ordinal="80">Eightieth </word>
5718
+ <word cardinal="90">Ninety-</word>
5719
+ <word ordinal="90">Ninetieth </word>
5720
+ <word cardinal="100">Hundred-</word>
5721
+ <word ordinal="100">Hundredth </word>
5722
+ </words>
5723
+ </xsl:variable>
5724
+
5725
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5726
+
5727
+ <xsl:variable name="value">
5728
+ <xsl:choose>
5729
+ <xsl:when test="$ordinal != ''">
5730
+ <xsl:value-of select="$ordinal"/>
5731
+ </xsl:when>
5732
+ <xsl:otherwise>
5733
+ <xsl:choose>
5734
+ <xsl:when test="$number &lt; 100">
5735
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5736
+ <xsl:variable name="digit" select="substring($number,2)"/>
5737
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5738
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5739
+ </xsl:when>
5740
+ <xsl:otherwise>
5741
+ <!-- more 100 -->
5742
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5743
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5744
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5745
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5746
+ <xsl:call-template name="number-to-words">
5747
+ <xsl:with-param name="number" select="$digits"/>
5748
+ </xsl:call-template>
5749
+ </xsl:otherwise>
5750
+ </xsl:choose>
5751
+ </xsl:otherwise>
5752
+ </xsl:choose>
5753
+ </xsl:variable>
5754
+ <xsl:choose>
5755
+ <xsl:when test="$first = 'true'">
5756
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5757
+ <xsl:call-template name="capitalize">
5758
+ <xsl:with-param name="str" select="$value_lc"/>
5759
+ </xsl:call-template>
5760
+ </xsl:when>
5761
+ <xsl:otherwise>
5762
+ <xsl:value-of select="$value"/>
5763
+ </xsl:otherwise>
5764
+ </xsl:choose>
5765
+ </xsl:if>
5254
5766
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "1.8.4".freeze
3
+ VERSION = "1.8.8".freeze
4
4
  end
5
5
  end
@@ -26,9 +26,9 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "exe"
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
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-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.8.8
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-07 00:00:00.000000000 Z
11
+ date: 2021-08-02 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
@@ -241,7 +241,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
241
  requirements:
242
242
  - - ">="
243
243
  - !ruby/object:Gem::Version
244
- version: 2.4.0
244
+ version: 2.5.0
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  requirements:
247
247
  - - ">="