metanorma-csa 1.8.3 → 1.8.7

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: 1c7e132a7ba4bc10103b15b3e017a682872eef818912d69a24a0245364864c3f
4
- data.tar.gz: b1856f5f189efc7263ac72cc447d82809403cc8e1b1c42086fcd14f14d8ddc0a
3
+ metadata.gz: 9094d8995d85f10e6c8eddfce465454dcfe379e7db8efe451be85797e53561d8
4
+ data.tar.gz: 6a26595d2a01ff9d0eb8b06cb398d335c5677dbf199d9c6e783183537cdb4f08
5
5
  SHA512:
6
- metadata.gz: f0f0e53eb1e557d5a971f3049ec2bf8cdd717dab84779a000fae8d19d35850f930c7ff2b61b0f4f9a1e256106aa8e55d7e91f919424d0e4e8708468846d5ffe8
7
- data.tar.gz: f6d84227cde217a93dd6fb18b4e886b7e9708fe111706acb852f19ef992c00eb411eb706837f47cd980f2ada769faec575686ad48f37635cccd7d136196c9d7e
6
+ metadata.gz: cb9383ca3d2fe13856b32c444d4c045f068b0a43600bef990da214a4d73d13444e2b5cb9e142831e3c01325a0f28c5c908220d23b2c8ae27b6666396cef3c529
7
+ data.tar.gz: 19f78275afd29167bdc5813fc41fb155e9137e1dbece3ad3be8415f430244296ad2fafd1d3bee3ed41a845dce383968ea0922e4277f114f1b2e1fe2a5cdb9c87
@@ -16,19 +16,9 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '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
- include:
23
- - ruby: '3.0'
24
- os: 'ubuntu-latest'
25
- experimental: true
26
- - ruby: '3.0'
27
- os: 'windows-latest'
28
- experimental: true
29
- - ruby: '3.0'
30
- os: 'macos-latest'
31
- experimental: true
32
22
  steps:
33
23
  - uses: actions/checkout@v2
34
24
  with:
@@ -40,3 +30,14 @@ jobs:
40
30
  bundler-cache: true
41
31
 
42
32
  - run: bundle exec rake
33
+
34
+ tests-passed:
35
+ needs: rake
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: peter-evans/repository-dispatch@v1
39
+ with:
40
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
41
+ repository: ${{ github.repository }}
42
+ event-type: tests-passed
43
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
data/.hound.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  ruby:
2
- Enabled: true
4
+ enabled: true
3
5
  config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,12 +1,10 @@
1
- # This project follows the Ribose OSS style guide.
2
- # https://github.com/riboseinc/oss-guides
3
- # All project-specific additions and overrides should be specified in this file.
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
4
3
  inherit_from:
5
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
5
 
7
6
  # local repo-specific modifications
7
+ # ...
8
8
 
9
9
  AllCops:
10
- DisplayCopNames: false
11
- StyleGuideCopsOnly: false
12
- TargetRubyVersion: 2.4
10
+ TargetRubyVersion: 2.5
@@ -72,6 +72,9 @@
72
72
  <optional>
73
73
  <ref name="doctype"/>
74
74
  </optional>
75
+ <optional>
76
+ <ref name="docsubtype"/>
77
+ </optional>
75
78
  <ref name="editorialgroup"/>
76
79
  <zeroOrMore>
77
80
  <ref name="ics"/>
@@ -45,6 +45,11 @@
45
45
  <optional>
46
46
  <attribute name="alt"/>
47
47
  </optional>
48
+ <optional>
49
+ <attribute name="updatetype">
50
+ <data type="boolean"/>
51
+ </attribute>
52
+ </optional>
48
53
  <text/>
49
54
  </element>
50
55
  </define>
@@ -199,6 +204,18 @@
199
204
  </zeroOrMore>
200
205
  </element>
201
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>
202
219
  <define name="example">
203
220
  <element name="example">
204
221
  <attribute name="id">
@@ -543,6 +560,9 @@
543
560
  </define>
544
561
  <define name="BibDataExtensionType">
545
562
  <ref name="doctype"/>
563
+ <optional>
564
+ <ref name="docsubtype"/>
565
+ </optional>
546
566
  <optional>
547
567
  <ref name="editorialgroup"/>
548
568
  </optional>
@@ -890,6 +910,14 @@
890
910
  </define>
891
911
  </include>
892
912
  <!-- end overrides -->
913
+ <define name="docsubtype">
914
+ <element name="subdoctype">
915
+ <ref name="DocumentSubtype"/>
916
+ </element>
917
+ </define>
918
+ <define name="DocumentSubtype">
919
+ <text/>
920
+ </define>
893
921
  <define name="colgroup">
894
922
  <element name="colgroup">
895
923
  <oneOrMore>
@@ -939,7 +967,34 @@
939
967
  <define name="concept">
940
968
  <element name="concept">
941
969
  <optional>
942
- <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>
943
998
  </optional>
944
999
  <choice>
945
1000
  <ref name="eref"/>
@@ -965,6 +1020,9 @@
965
1020
  </attribute>
966
1021
  <attribute name="name"/>
967
1022
  <attribute name="action"/>
1023
+ <optional>
1024
+ <attribute name="class"/>
1025
+ </optional>
968
1026
  <zeroOrMore>
969
1027
  <choice>
970
1028
  <ref name="TextElement"/>
@@ -1457,26 +1515,26 @@
1457
1515
  <optional>
1458
1516
  <ref name="section-title"/>
1459
1517
  </optional>
1460
- <group>
1518
+ <choice>
1461
1519
  <choice>
1462
1520
  <group>
1463
- <zeroOrMore>
1521
+ <oneOrMore>
1464
1522
  <ref name="BasicBlock"/>
1465
- </zeroOrMore>
1523
+ </oneOrMore>
1466
1524
  <zeroOrMore>
1467
1525
  <ref name="note"/>
1468
1526
  </zeroOrMore>
1469
1527
  </group>
1470
1528
  <ref name="amend"/>
1471
1529
  </choice>
1472
- <zeroOrMore>
1530
+ <oneOrMore>
1473
1531
  <choice>
1474
1532
  <ref name="clause-subsection"/>
1475
1533
  <ref name="terms"/>
1476
1534
  <ref name="definitions"/>
1477
1535
  </choice>
1478
- </zeroOrMore>
1479
- </group>
1536
+ </oneOrMore>
1537
+ </choice>
1480
1538
  </define>
1481
1539
  <define name="Annex-Section">
1482
1540
  <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>
@@ -1041,6 +1047,7 @@
1041
1047
 
1042
1048
 
1043
1049
 
1050
+
1044
1051
  <xsl:attribute name="color">rgb(33, 94, 159)</xsl:attribute>
1045
1052
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1046
1053
 
@@ -1093,7 +1100,7 @@
1093
1100
 
1094
1101
 
1095
1102
 
1096
-
1103
+
1097
1104
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1098
1105
 
1099
1106
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1108,6 +1115,7 @@
1108
1115
 
1109
1116
 
1110
1117
 
1118
+
1111
1119
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1112
1120
 
1113
1121
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
@@ -1132,9 +1140,7 @@
1132
1140
 
1133
1141
 
1134
1142
 
1135
-
1136
-
1137
-
1143
+
1138
1144
 
1139
1145
 
1140
1146
 
@@ -1163,6 +1169,7 @@
1163
1169
 
1164
1170
 
1165
1171
 
1172
+
1166
1173
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1167
1174
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1168
1175
 
@@ -1178,6 +1185,9 @@
1178
1185
 
1179
1186
 
1180
1187
 
1188
+
1189
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1190
+
1181
1191
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1182
1192
 
1183
1193
 
@@ -1193,14 +1203,17 @@
1193
1203
 
1194
1204
 
1195
1205
 
1206
+
1196
1207
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1197
1208
 
1209
+
1198
1210
  <xsl:attribute name="color">rgb(33, 94, 159)</xsl:attribute>
1199
1211
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1200
1212
 
1201
1213
 
1202
1214
 
1203
1215
 
1216
+
1204
1217
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1205
1218
 
1206
1219
 
@@ -1222,6 +1235,7 @@
1222
1235
 
1223
1236
 
1224
1237
 
1238
+
1225
1239
  </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">
1226
1240
 
1227
1241
 
@@ -1265,10 +1279,12 @@
1265
1279
 
1266
1280
 
1267
1281
 
1282
+
1268
1283
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1269
1284
 
1270
1285
 
1271
1286
 
1287
+
1272
1288
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1273
1289
 
1274
1290
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1298,6 +1314,7 @@
1298
1314
 
1299
1315
 
1300
1316
 
1317
+
1301
1318
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1302
1319
 
1303
1320
  <xsl:attribute name="color">rgb(33, 94, 159)</xsl:attribute>
@@ -1305,6 +1322,7 @@
1305
1322
 
1306
1323
 
1307
1324
 
1325
+
1308
1326
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1309
1327
 
1310
1328
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1330,6 +1348,7 @@
1330
1348
 
1331
1349
 
1332
1350
 
1351
+
1333
1352
 
1334
1353
 
1335
1354
 
@@ -1375,8 +1394,10 @@
1375
1394
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1376
1395
 
1377
1396
 
1397
+
1378
1398
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1379
1399
 
1400
+
1380
1401
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1381
1402
 
1382
1403
  <xsl:attribute name="space-after">6pt</xsl:attribute>
@@ -1401,6 +1422,8 @@
1401
1422
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1402
1423
 
1403
1424
 
1425
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1426
+
1404
1427
  </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">
1405
1428
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1406
1429
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1411,14 +1434,15 @@
1411
1434
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1412
1435
 
1413
1436
  <!-- Normative references -->
1414
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1437
+ <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"/>
1415
1438
  <!-- Terms and definitions -->
1416
1439
  <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"/>
1417
1440
  <!-- Another main sections -->
1418
1441
  <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"/>
1419
1442
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1420
1443
  <!-- Bibliography -->
1421
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1444
+ <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"/>
1445
+
1422
1446
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1423
1447
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1424
1448
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1454,11 +1478,11 @@
1454
1478
  <xsl:variable name="table">
1455
1479
 
1456
1480
  <xsl:variable name="simple-table">
1457
- <xsl:call-template name="getSimpleTable"/>
1481
+ <xsl:call-template name="getSimpleTable"/>
1458
1482
  </xsl:variable>
1459
1483
 
1460
1484
  <!-- <xsl:if test="$namespace = 'bipm'">
1461
- <fo:block>&#xA0;</fo:block>
1485
+ <fo:block>&#xA0;</fo:block>
1462
1486
  </xsl:if> -->
1463
1487
 
1464
1488
  <!-- $namespace = 'iso' or -->
@@ -1558,6 +1582,7 @@
1558
1582
 
1559
1583
 
1560
1584
 
1585
+
1561
1586
  </xsl:variable>
1562
1587
 
1563
1588
 
@@ -1699,6 +1724,9 @@
1699
1724
  <fo:block xsl:use-attribute-sets="table-name-style">
1700
1725
 
1701
1726
 
1727
+
1728
+
1729
+
1702
1730
  <xsl:choose>
1703
1731
  <xsl:when test="$continued = 'true'">
1704
1732
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -1846,6 +1874,7 @@
1846
1874
  <!-- font-weight="bold" -->
1847
1875
  <fo:table-header>
1848
1876
 
1877
+
1849
1878
  <xsl:apply-templates/>
1850
1879
  </fo:table-header>
1851
1880
  </xsl:template><xsl:template name="table-header-title">
@@ -1996,6 +2025,7 @@
1996
2025
 
1997
2026
 
1998
2027
 
2028
+
1999
2029
  <!-- fn will be processed inside 'note' processing -->
2000
2030
 
2001
2031
 
@@ -2004,6 +2034,10 @@
2004
2034
 
2005
2035
 
2006
2036
 
2037
+
2038
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2039
+
2040
+
2007
2041
  <!-- except gb -->
2008
2042
 
2009
2043
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2029,6 +2063,10 @@
2029
2063
  <!-- fn processing -->
2030
2064
  <xsl:call-template name="fn_display"/>
2031
2065
 
2066
+
2067
+ <!-- for PAS display Notes after footnotes -->
2068
+
2069
+
2032
2070
  </fo:table-cell>
2033
2071
  </fo:table-row>
2034
2072
  </fo:table-body>
@@ -2086,11 +2124,16 @@
2086
2124
  <xsl:if test="$parent-name = 'tfoot'">
2087
2125
 
2088
2126
 
2127
+
2089
2128
  </xsl:if>
2090
2129
 
2091
2130
 
2092
2131
 
2093
2132
 
2133
+
2134
+
2135
+
2136
+
2094
2137
  <!-- <xsl:if test="$namespace = 'bipm'">
2095
2138
  <xsl:attribute name="height">8mm</xsl:attribute>
2096
2139
  </xsl:if> -->
@@ -2120,6 +2163,7 @@
2120
2163
 
2121
2164
 
2122
2165
 
2166
+
2123
2167
  <xsl:if test="$lang = 'ar'">
2124
2168
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2125
2169
  </xsl:if>
@@ -2175,6 +2219,10 @@
2175
2219
 
2176
2220
 
2177
2221
 
2222
+
2223
+
2224
+
2225
+
2178
2226
  <xsl:if test=".//*[local-name() = 'table']">
2179
2227
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2180
2228
  </xsl:if>
@@ -2204,8 +2252,14 @@
2204
2252
 
2205
2253
 
2206
2254
 
2255
+
2256
+
2257
+ <!-- Table's note name (NOTE, for example) -->
2258
+
2207
2259
  <fo:inline padding-right="2mm">
2208
2260
 
2261
+
2262
+
2209
2263
 
2210
2264
 
2211
2265
 
@@ -2213,6 +2267,8 @@
2213
2267
 
2214
2268
  </fo:inline>
2215
2269
 
2270
+
2271
+
2216
2272
  <xsl:apply-templates mode="process"/>
2217
2273
  </fo:block>
2218
2274
 
@@ -2232,6 +2288,8 @@
2232
2288
  <xsl:variable name="reference" select="@reference"/>
2233
2289
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2234
2290
  <fo:block margin-bottom="12pt">
2291
+
2292
+
2235
2293
 
2236
2294
 
2237
2295
 
@@ -2245,9 +2303,11 @@
2245
2303
 
2246
2304
 
2247
2305
 
2306
+
2248
2307
  <xsl:value-of select="@reference"/>
2249
2308
 
2250
2309
 
2310
+
2251
2311
  </fo:inline>
2252
2312
  <fo:inline>
2253
2313
 
@@ -2388,11 +2448,16 @@
2388
2448
 
2389
2449
 
2390
2450
 
2451
+
2452
+
2453
+
2454
+
2391
2455
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2392
2456
 
2393
2457
 
2394
2458
  <xsl:value-of select="@reference"/>
2395
2459
 
2460
+
2396
2461
  </fo:basic-link>
2397
2462
  </fo:inline>
2398
2463
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2479,6 +2544,7 @@
2479
2544
 
2480
2545
 
2481
2546
 
2547
+
2482
2548
  <xsl:variable name="title-key">
2483
2549
 
2484
2550
 
@@ -2689,6 +2755,7 @@
2689
2755
 
2690
2756
  <fo:table-row>
2691
2757
 
2758
+
2692
2759
  <fo:table-cell>
2693
2760
 
2694
2761
  <fo:block margin-top="6pt">
@@ -2704,6 +2771,7 @@
2704
2771
 
2705
2772
 
2706
2773
 
2774
+
2707
2775
  <xsl:apply-templates/>
2708
2776
  <!-- <xsl:if test="$namespace = 'gb'">
2709
2777
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2760,6 +2828,8 @@
2760
2828
 
2761
2829
  <xsl:apply-templates/>
2762
2830
  </fo:inline>
2831
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2832
+ <fo:inline padding-right="{@value}"> </fo:inline>
2763
2833
  </xsl:template><xsl:template match="*[local-name()='sup']">
2764
2834
  <fo:inline font-size="80%" vertical-align="super">
2765
2835
  <xsl:apply-templates/>
@@ -3249,9 +3319,27 @@
3249
3319
  <xsl:copy>
3250
3320
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3251
3321
  </xsl:copy>
3252
- <mathml:mspace width="0.5ex"/>
3322
+ <xsl:choose>
3323
+ <!-- if in msub, then don't add space -->
3324
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3325
+ <!-- if next char in digit, don't add space -->
3326
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3327
+ <xsl:otherwise>
3328
+ <mathml:mspace width="0.5ex"/>
3329
+ </xsl:otherwise>
3330
+ </xsl:choose>
3253
3331
  </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">
3254
3332
  <xsl:variable name="target">
3333
+ <xsl:choose>
3334
+ <xsl:when test="@updatetype = 'true'">
3335
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3336
+ </xsl:when>
3337
+ <xsl:otherwise>
3338
+ <xsl:value-of select="normalize-space(@target)"/>
3339
+ </xsl:otherwise>
3340
+ </xsl:choose>
3341
+ </xsl:variable>
3342
+ <xsl:variable name="target_text">
3255
3343
  <xsl:choose>
3256
3344
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3257
3345
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3263,20 +3351,22 @@
3263
3351
  </xsl:variable>
3264
3352
  <fo:inline xsl:use-attribute-sets="link-style">
3265
3353
 
3354
+
3355
+
3266
3356
  <xsl:choose>
3267
- <xsl:when test="$target = ''">
3357
+ <xsl:when test="$target_text = ''">
3268
3358
  <xsl:apply-templates/>
3269
3359
  </xsl:when>
3270
3360
  <xsl:otherwise>
3271
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3361
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3272
3362
  <xsl:choose>
3273
3363
  <xsl:when test="normalize-space(.) = ''">
3274
- <!-- <xsl:value-of select="$target"/> -->
3275
3364
  <xsl:call-template name="add-zero-spaces-link-java">
3276
- <xsl:with-param name="text" select="$target"/>
3365
+ <xsl:with-param name="text" select="$target_text"/>
3277
3366
  </xsl:call-template>
3278
3367
  </xsl:when>
3279
3368
  <xsl:otherwise>
3369
+ <!-- output text from <link>text</link> -->
3280
3370
  <xsl:apply-templates/>
3281
3371
  </xsl:otherwise>
3282
3372
  </xsl:choose>
@@ -3371,6 +3461,7 @@
3371
3461
 
3372
3462
 
3373
3463
 
3464
+
3374
3465
  <fo:block-container margin-left="0mm">
3375
3466
 
3376
3467
 
@@ -3418,6 +3509,7 @@
3418
3509
  </xsl:choose>
3419
3510
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3420
3511
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3512
+
3421
3513
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3422
3514
 
3423
3515
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3491,6 +3583,7 @@
3491
3583
  </xsl:call-template>
3492
3584
 
3493
3585
  <fo:block>
3586
+
3494
3587
  <xsl:apply-templates/>
3495
3588
  </fo:block>
3496
3589
  <xsl:call-template name="fn_display_figure"/>
@@ -3613,6 +3706,234 @@
3613
3706
  <xsl:param name="height"/>
3614
3707
  <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; "/>
3615
3708
  <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; "/>
3709
+ </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">
3710
+ <xsl:param name="name"/>
3711
+
3712
+ <xsl:variable name="svg_content">
3713
+ <xsl:apply-templates select="." mode="svg_update"/>
3714
+ </xsl:variable>
3715
+
3716
+ <xsl:variable name="alt-text">
3717
+ <xsl:choose>
3718
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3719
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3720
+ </xsl:when>
3721
+ <xsl:when test="normalize-space($name) != ''">
3722
+ <xsl:value-of select="$name"/>
3723
+ </xsl:when>
3724
+ <xsl:otherwise>Figure</xsl:otherwise>
3725
+ </xsl:choose>
3726
+ </xsl:variable>
3727
+
3728
+ <xsl:choose>
3729
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3730
+ <fo:block>
3731
+ <xsl:variable name="width" select="@width"/>
3732
+ <xsl:variable name="height" select="@height"/>
3733
+
3734
+ <xsl:variable name="scale_x">
3735
+ <xsl:choose>
3736
+ <xsl:when test="$width &gt; $width_effective_px">
3737
+ <xsl:value-of select="$width_effective_px div $width"/>
3738
+ </xsl:when>
3739
+ <xsl:otherwise>1</xsl:otherwise>
3740
+ </xsl:choose>
3741
+ </xsl:variable>
3742
+
3743
+ <xsl:variable name="scale_y">
3744
+ <xsl:choose>
3745
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3746
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3747
+ </xsl:when>
3748
+ <xsl:otherwise>1</xsl:otherwise>
3749
+ </xsl:choose>
3750
+ </xsl:variable>
3751
+
3752
+ <xsl:variable name="scale">
3753
+ <xsl:choose>
3754
+ <xsl:when test="$scale_y != 1">
3755
+ <xsl:value-of select="$scale_x * $scale_y"/>
3756
+ </xsl:when>
3757
+ <xsl:otherwise>
3758
+ <xsl:value-of select="$scale_x"/>
3759
+ </xsl:otherwise>
3760
+ </xsl:choose>
3761
+ </xsl:variable>
3762
+
3763
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3764
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3765
+
3766
+ <fo:table table-layout="fixed" width="100%">
3767
+ <fo:table-column column-width="proportional-column-width(1)"/>
3768
+ <fo:table-column column-width="{$width_scale}px"/>
3769
+ <fo:table-column column-width="proportional-column-width(1)"/>
3770
+ <fo:table-body>
3771
+ <fo:table-row>
3772
+ <fo:table-cell column-number="2">
3773
+ <fo:block>
3774
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3775
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3776
+ <fo:block line-height="0" font-size="0">
3777
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3778
+ <xsl:call-template name="bookmark"/>
3779
+ </xsl:for-each>
3780
+ </fo:block>
3781
+ </xsl:if>
3782
+ <fo:block text-depth="0" line-height="0" font-size="0">
3783
+
3784
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3785
+ <xsl:attribute name="width">100%</xsl:attribute>
3786
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3787
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3788
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3789
+
3790
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3791
+ </fo:instream-foreign-object>
3792
+ </fo:block>
3793
+
3794
+ <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">
3795
+ <xsl:with-param name="scale" select="$scale"/>
3796
+ </xsl:apply-templates>
3797
+ </fo:block-container>
3798
+ </fo:block>
3799
+ </fo:table-cell>
3800
+ </fo:table-row>
3801
+ </fo:table-body>
3802
+ </fo:table>
3803
+ </fo:block>
3804
+
3805
+ </xsl:when>
3806
+ <xsl:otherwise>
3807
+ <fo:block xsl:use-attribute-sets="image-style">
3808
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3809
+ <xsl:attribute name="width">100%</xsl:attribute>
3810
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3811
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3812
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3813
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3814
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3815
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3816
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3817
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3818
+ </xsl:if>
3819
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3820
+ <xsl:copy-of select="$svg_content"/>
3821
+ </fo:instream-foreign-object>
3822
+ </fo:block>
3823
+ </xsl:otherwise>
3824
+ </xsl:choose>
3825
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3826
+ <xsl:copy>
3827
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3828
+ </xsl:copy>
3829
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3830
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3831
+ <xsl:value-of select="."/>
3832
+ </xsl:attribute>
3833
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3834
+ <xsl:variable name="svg_content" select="document(@src)"/>
3835
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3836
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3837
+ <xsl:call-template name="image_svg">
3838
+ <xsl:with-param name="name" select="$name"/>
3839
+ </xsl:call-template>
3840
+ </xsl:for-each>
3841
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3842
+ <xsl:copy>
3843
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3844
+ </xsl:copy>
3845
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3846
+ <xsl:apply-templates mode="svg_remove_a"/>
3847
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3848
+ <xsl:param name="scale"/>
3849
+ <xsl:variable name="dest">
3850
+ <xsl:choose>
3851
+ <xsl:when test="starts-with(@href, '#')">
3852
+ <xsl:value-of select="substring-after(@href, '#')"/>
3853
+ </xsl:when>
3854
+ <xsl:otherwise>
3855
+ <xsl:value-of select="@href"/>
3856
+ </xsl:otherwise>
3857
+ </xsl:choose>
3858
+ </xsl:variable>
3859
+ <xsl:for-each select="./*[local-name() = 'rect']">
3860
+ <xsl:call-template name="insertSVGMapLink">
3861
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3862
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3863
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3864
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3865
+ <xsl:with-param name="dest" select="$dest"/>
3866
+ </xsl:call-template>
3867
+ </xsl:for-each>
3868
+
3869
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3870
+ <xsl:variable name="points">
3871
+ <xsl:call-template name="split">
3872
+ <xsl:with-param name="pText" select="@points"/>
3873
+ </xsl:call-template>
3874
+ </xsl:variable>
3875
+ <xsl:variable name="x_coords">
3876
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3877
+ <xsl:sort select="." data-type="number"/>
3878
+ <x><xsl:value-of select="."/></x>
3879
+ </xsl:for-each>
3880
+ </xsl:variable>
3881
+ <xsl:variable name="y_coords">
3882
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3883
+ <xsl:sort select="." data-type="number"/>
3884
+ <y><xsl:value-of select="."/></y>
3885
+ </xsl:for-each>
3886
+ </xsl:variable>
3887
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3888
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3889
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3890
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3891
+ <xsl:call-template name="insertSVGMapLink">
3892
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3893
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3894
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3895
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3896
+ <xsl:with-param name="dest" select="$dest"/>
3897
+ </xsl:call-template>
3898
+ </xsl:for-each>
3899
+
3900
+ <xsl:for-each select="./*[local-name() = 'circle']">
3901
+ <xsl:call-template name="insertSVGMapLink">
3902
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3903
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3904
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3905
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3906
+ <xsl:with-param name="dest" select="$dest"/>
3907
+ </xsl:call-template>
3908
+ </xsl:for-each>
3909
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3910
+ <xsl:call-template name="insertSVGMapLink">
3911
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3912
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3913
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3914
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3915
+ <xsl:with-param name="dest" select="$dest"/>
3916
+ </xsl:call-template>
3917
+ </xsl:for-each>
3918
+ </xsl:template><xsl:template name="insertSVGMapLink">
3919
+ <xsl:param name="left"/>
3920
+ <xsl:param name="top"/>
3921
+ <xsl:param name="width"/>
3922
+ <xsl:param name="height"/>
3923
+ <xsl:param name="dest"/>
3924
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3925
+ <fo:block font-size="1pt">
3926
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3927
+ <fo:inline-container inline-progression-dimension="100%">
3928
+ <fo:block-container height="{$height - 1}px" width="100%">
3929
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3930
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3931
+ </xsl:if> -->
3932
+ <fo:block> </fo:block></fo:block-container>
3933
+ </fo:inline-container>
3934
+ </fo:basic-link>
3935
+ </fo:block>
3936
+ </fo:block-container>
3616
3937
  </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">
3617
3938
  <xsl:apply-templates mode="contents"/>
3618
3939
  <xsl:text> </xsl:text>
@@ -3641,28 +3962,39 @@
3641
3962
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3642
3963
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3643
3964
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3965
+ <xsl:if test="@bundle = 'true'">
3966
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3967
+ </xsl:if>
3644
3968
  <fo:bookmark-title>
3645
- <xsl:variable name="bookmark-title_">
3646
- <xsl:call-template name="getLangVersion">
3647
- <xsl:with-param name="lang" select="@lang"/>
3648
- <xsl:with-param name="doctype" select="@doctype"/>
3649
- <xsl:with-param name="title" select="@title-part"/>
3650
- </xsl:call-template>
3651
- </xsl:variable>
3652
3969
  <xsl:choose>
3653
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3654
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3655
- </xsl:when>
3656
- <xsl:otherwise>
3970
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3971
+ <xsl:variable name="bookmark-title_">
3972
+ <xsl:call-template name="getLangVersion">
3973
+ <xsl:with-param name="lang" select="@lang"/>
3974
+ <xsl:with-param name="doctype" select="@doctype"/>
3975
+ <xsl:with-param name="title" select="@title-part"/>
3976
+ </xsl:call-template>
3977
+ </xsl:variable>
3657
3978
  <xsl:choose>
3658
- <xsl:when test="@lang = 'en'">English</xsl:when>
3659
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3660
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3661
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3979
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3980
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3981
+ </xsl:when>
3982
+ <xsl:otherwise>
3983
+ <xsl:choose>
3984
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3985
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3986
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3987
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3988
+ </xsl:choose>
3989
+ </xsl:otherwise>
3662
3990
  </xsl:choose>
3991
+ </xsl:when>
3992
+ <xsl:otherwise>
3993
+ <xsl:value-of select="@title-part"/>
3663
3994
  </xsl:otherwise>
3664
3995
  </xsl:choose>
3665
3996
  </fo:bookmark-title>
3997
+
3666
3998
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3667
3999
 
3668
4000
  <xsl:call-template name="insertFigureBookmarks">
@@ -3761,20 +4093,28 @@
3761
4093
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3762
4094
  </xsl:choose>
3763
4095
  </xsl:template><xsl:template match="item" mode="bookmark">
3764
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3765
- <fo:bookmark-title>
3766
- <xsl:if test="@section != ''">
3767
- <xsl:value-of select="@section"/>
3768
- <xsl:text> </xsl:text>
3769
- </xsl:if>
3770
- <xsl:value-of select="normalize-space(title)"/>
3771
- </fo:bookmark-title>
3772
- <xsl:apply-templates mode="bookmark"/>
3773
- </fo:bookmark>
4096
+ <xsl:choose>
4097
+ <xsl:when test="@id != ''">
4098
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4099
+ <fo:bookmark-title>
4100
+ <xsl:if test="@section != ''">
4101
+ <xsl:value-of select="@section"/>
4102
+ <xsl:text> </xsl:text>
4103
+ </xsl:if>
4104
+ <xsl:value-of select="normalize-space(title)"/>
4105
+ </fo:bookmark-title>
4106
+ <xsl:apply-templates mode="bookmark"/>
4107
+ </fo:bookmark>
4108
+ </xsl:when>
4109
+ <xsl:otherwise>
4110
+ <xsl:apply-templates mode="bookmark"/>
4111
+ </xsl:otherwise>
4112
+ </xsl:choose>
3774
4113
  </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">
3775
4114
  <xsl:if test="normalize-space() != ''">
3776
4115
  <fo:block xsl:use-attribute-sets="figure-name-style">
3777
4116
 
4117
+
3778
4118
  <xsl:apply-templates/>
3779
4119
  </fo:block>
3780
4120
  </xsl:if>
@@ -3854,6 +4194,8 @@
3854
4194
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3855
4195
 
3856
4196
  <fo:block-container margin-left="0mm">
4197
+ <xsl:copy-of select="@id"/>
4198
+
3857
4199
  <xsl:if test="parent::*[local-name() = 'note']">
3858
4200
  <xsl:attribute name="margin-left">
3859
4201
  <xsl:choose>
@@ -3864,7 +4206,9 @@
3864
4206
 
3865
4207
  </xsl:if>
3866
4208
  <fo:block-container margin-left="0mm">
3867
-
4209
+
4210
+
4211
+
3868
4212
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3869
4213
  <xsl:variable name="_font-size">
3870
4214
  10
@@ -3893,10 +4237,14 @@
3893
4237
  </xsl:choose>
3894
4238
  </xsl:attribute>
3895
4239
  </xsl:if>
3896
- <xsl:apply-templates/>
3897
- </fo:block>
4240
+
4241
+ <xsl:apply-templates/>
4242
+ </fo:block>
4243
+
4244
+
3898
4245
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3899
4246
 
4247
+
3900
4248
  </fo:block-container>
3901
4249
  </fo:block-container>
3902
4250
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4131,6 +4479,7 @@
4131
4479
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4132
4480
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4133
4481
 
4482
+
4134
4483
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4135
4484
 
4136
4485
  <xsl:variable name="element">
@@ -4240,12 +4589,15 @@
4240
4589
 
4241
4590
 
4242
4591
 
4592
+
4593
+
4594
+
4243
4595
  <xsl:call-template name="getTitle">
4244
4596
  <xsl:with-param name="name" select="'title-source'"/>
4245
4597
  </xsl:call-template>
4598
+ <xsl:text>: </xsl:text>
4246
4599
 
4247
4600
 
4248
- <xsl:text>: </xsl:text>
4249
4601
  </fo:inline>
4250
4602
 
4251
4603
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -4316,7 +4668,9 @@
4316
4668
 
4317
4669
 
4318
4670
  </xsl:if>
4319
-
4671
+
4672
+
4673
+
4320
4674
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4321
4675
  <xsl:if test="normalize-space(@citeas) = ''">
4322
4676
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4325,6 +4679,7 @@
4325
4679
 
4326
4680
 
4327
4681
 
4682
+
4328
4683
  </xsl:if>
4329
4684
 
4330
4685
  <xsl:apply-templates/>
@@ -4363,6 +4718,7 @@
4363
4718
 
4364
4719
 
4365
4720
 
4721
+
4366
4722
  </xsl:variable>
4367
4723
 
4368
4724
  <xsl:variable name="padding-right">
@@ -4464,6 +4820,7 @@
4464
4820
  <xsl:call-template name="setId"/>
4465
4821
 
4466
4822
 
4823
+
4467
4824
  <xsl:apply-templates/>
4468
4825
  </fo:block>
4469
4826
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4710,17 +5067,17 @@
4710
5067
  <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')]"/>
4711
5068
  <xsl:choose>
4712
5069
  <xsl:when test="normalize-space($_doc_ident) != ''">
4713
- <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"/>
5070
+ <!-- <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"/>
4714
5071
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4715
5072
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4716
- </xsl:if>
5073
+ </xsl:if> -->
4717
5074
  <xsl:value-of select="$_doc_ident"/>
4718
5075
  </xsl:when>
4719
5076
  <xsl:otherwise>
4720
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5077
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4721
5078
  <xsl:if test="$type != ''">
4722
5079
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4723
- </xsl:if>
5080
+ </xsl:if> -->
4724
5081
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4725
5082
  </xsl:otherwise>
4726
5083
  </xsl:choose>
@@ -5033,6 +5390,9 @@
5033
5390
  <xsl:when test="parent::*[local-name() = 'preface']">
5034
5391
  <xsl:value-of select="$level_total - 1"/>
5035
5392
  </xsl:when>
5393
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5394
+ <xsl:value-of select="$level_total - 1"/>
5395
+ </xsl:when>
5036
5396
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5037
5397
  <xsl:value-of select="$level_total - 2"/>
5038
5398
  </xsl:when>
@@ -5173,7 +5533,14 @@
5173
5533
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5174
5534
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5175
5535
  </xsl:when>
5176
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5536
+ <xsl:otherwise>
5537
+ <xsl:variable name="key_">
5538
+ <xsl:call-template name="capitalize">
5539
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5540
+ </xsl:call-template>
5541
+ </xsl:variable>
5542
+ <xsl:value-of select="$key_"/>
5543
+ </xsl:otherwise>
5177
5544
  </xsl:choose>
5178
5545
 
5179
5546
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -5216,4 +5583,110 @@
5216
5583
  <xsl:value-of select="$align"/>
5217
5584
  </xsl:when>
5218
5585
  </xsl:choose>
5586
+ </xsl:template><xsl:template name="setTextAlignment">
5587
+ <xsl:param name="default">left</xsl:param>
5588
+ <xsl:attribute name="text-align">
5589
+ <xsl:choose>
5590
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5591
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5592
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5593
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5594
+ </xsl:choose>
5595
+ </xsl:attribute>
5596
+ </xsl:template><xsl:template name="number-to-words">
5597
+ <xsl:param name="number"/>
5598
+ <xsl:param name="first"/>
5599
+ <xsl:if test="$number != ''">
5600
+ <xsl:variable name="words">
5601
+ <words>
5602
+ <word cardinal="1">One-</word>
5603
+ <word ordinal="1">First </word>
5604
+ <word cardinal="2">Two-</word>
5605
+ <word ordinal="2">Second </word>
5606
+ <word cardinal="3">Three-</word>
5607
+ <word ordinal="3">Third </word>
5608
+ <word cardinal="4">Four-</word>
5609
+ <word ordinal="4">Fourth </word>
5610
+ <word cardinal="5">Five-</word>
5611
+ <word ordinal="5">Fifth </word>
5612
+ <word cardinal="6">Six-</word>
5613
+ <word ordinal="6">Sixth </word>
5614
+ <word cardinal="7">Seven-</word>
5615
+ <word ordinal="7">Seventh </word>
5616
+ <word cardinal="8">Eight-</word>
5617
+ <word ordinal="8">Eighth </word>
5618
+ <word cardinal="9">Nine-</word>
5619
+ <word ordinal="9">Ninth </word>
5620
+ <word ordinal="10">Tenth </word>
5621
+ <word ordinal="11">Eleventh </word>
5622
+ <word ordinal="12">Twelfth </word>
5623
+ <word ordinal="13">Thirteenth </word>
5624
+ <word ordinal="14">Fourteenth </word>
5625
+ <word ordinal="15">Fifteenth </word>
5626
+ <word ordinal="16">Sixteenth </word>
5627
+ <word ordinal="17">Seventeenth </word>
5628
+ <word ordinal="18">Eighteenth </word>
5629
+ <word ordinal="19">Nineteenth </word>
5630
+ <word cardinal="20">Twenty-</word>
5631
+ <word ordinal="20">Twentieth </word>
5632
+ <word cardinal="30">Thirty-</word>
5633
+ <word ordinal="30">Thirtieth </word>
5634
+ <word cardinal="40">Forty-</word>
5635
+ <word ordinal="40">Fortieth </word>
5636
+ <word cardinal="50">Fifty-</word>
5637
+ <word ordinal="50">Fiftieth </word>
5638
+ <word cardinal="60">Sixty-</word>
5639
+ <word ordinal="60">Sixtieth </word>
5640
+ <word cardinal="70">Seventy-</word>
5641
+ <word ordinal="70">Seventieth </word>
5642
+ <word cardinal="80">Eighty-</word>
5643
+ <word ordinal="80">Eightieth </word>
5644
+ <word cardinal="90">Ninety-</word>
5645
+ <word ordinal="90">Ninetieth </word>
5646
+ <word cardinal="100">Hundred-</word>
5647
+ <word ordinal="100">Hundredth </word>
5648
+ </words>
5649
+ </xsl:variable>
5650
+
5651
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5652
+
5653
+ <xsl:variable name="value">
5654
+ <xsl:choose>
5655
+ <xsl:when test="$ordinal != ''">
5656
+ <xsl:value-of select="$ordinal"/>
5657
+ </xsl:when>
5658
+ <xsl:otherwise>
5659
+ <xsl:choose>
5660
+ <xsl:when test="$number &lt; 100">
5661
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5662
+ <xsl:variable name="digit" select="substring($number,2)"/>
5663
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5664
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5665
+ </xsl:when>
5666
+ <xsl:otherwise>
5667
+ <!-- more 100 -->
5668
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5669
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5670
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5671
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5672
+ <xsl:call-template name="number-to-words">
5673
+ <xsl:with-param name="number" select="$digits"/>
5674
+ </xsl:call-template>
5675
+ </xsl:otherwise>
5676
+ </xsl:choose>
5677
+ </xsl:otherwise>
5678
+ </xsl:choose>
5679
+ </xsl:variable>
5680
+ <xsl:choose>
5681
+ <xsl:when test="$first = 'true'">
5682
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5683
+ <xsl:call-template name="capitalize">
5684
+ <xsl:with-param name="str" select="$value_lc"/>
5685
+ </xsl:call-template>
5686
+ </xsl:when>
5687
+ <xsl:otherwise>
5688
+ <xsl:value-of select="$value"/>
5689
+ </xsl:otherwise>
5690
+ </xsl:choose>
5691
+ </xsl:if>
5219
5692
  </xsl:template></xsl:stylesheet>