metanorma-m3aawg 1.7.3 → 1.7.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: fdbb2f2eecda7549e307a465831998882079ebe7ed26100790809a89bd7952a9
4
- data.tar.gz: 9f96d2ad4b74b4a953d908690b1b307c5c9f0994514d98a2bd5b84e992f43f5c
3
+ metadata.gz: f2718623699a961654c3aed9430df2beef16e18544c4a463c44b3d4afce02ca5
4
+ data.tar.gz: 808dfb9d60aa697293bae880182d7b8273690d8183c2a35796b6c6f8ec977c6e
5
5
  SHA512:
6
- metadata.gz: 8f5a64a375bea2db893b472e54a9792ed5408dfd337e043620a573f02159ddd5776cbeadd58838f0aed5423da83c0f302a0bf6b31c8724f95376a36e7b98db57
7
- data.tar.gz: 8b5989657e3ab1b26ddb504c55099bea13af39046060a37b9aa5ff036dddd4c29c3fae5f37c001d96b01c0ba6d65d86a85f2d6373cf7773b73c05690a912e4e6
6
+ metadata.gz: 3c3dc4dc5c01a4fab285b83833576f0b6093cf89a60398656d74db052868fd4cd05bf0187b924a32528d053a861e815c2af1d84de2dbded88fd003f34ab3eb5d
7
+ data.tar.gz: 501946f4453f523780a5894ca0662f70d35f1a3b21f134e6e9b8407507317b86ebb4ef9ccb1b6651b09b4939f83757fea6f06aafd7682cbc73a0da70d20be0ac
@@ -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
@@ -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>
@@ -14,8 +14,12 @@
14
14
 
15
15
 
16
16
  <xsl:variable name="debug">false</xsl:variable>
17
- <xsl:variable name="pageWidth" select="'215.9mm'"/>
18
- <xsl:variable name="pageHeight" select="'279.4mm'"/>
17
+ <xsl:variable name="pageWidth" select="215.9"/>
18
+ <xsl:variable name="pageHeight" select="279.4"/>
19
+ <xsl:variable name="marginLeftRight1" select="17.3"/>
20
+ <xsl:variable name="marginLeftRight2" select="17.3"/>
21
+ <xsl:variable name="marginTop" select="35"/>
22
+ <xsl:variable name="marginBottom" select="23"/>
19
23
 
20
24
  <xsl:variable name="title-en" select="/m3d:m3d-standard/m3d:bibdata/m3d:title[@language = 'en']"/>
21
25
  <!-- Example:
@@ -39,7 +43,7 @@
39
43
  <fo:layout-master-set>
40
44
 
41
45
  <!-- cover page -->
42
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
46
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
43
47
  <fo:region-body margin-top="31mm" margin-bottom="32mm" margin-left="17.3mm" margin-right="22mm"/>
44
48
  <fo:region-before region-name="cover-header" extent="31mm"/>
45
49
  <fo:region-after region-name="cover-footer" extent="32mm"/>
@@ -48,17 +52,17 @@
48
52
  </fo:simple-page-master>
49
53
 
50
54
  <!-- contents pages -->
51
- <fo:simple-page-master master-name="page" page-width="{$pageWidth}" page-height="{$pageHeight}">
52
- <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="17.3mm" margin-right="17.3mm"/>
53
- <fo:region-before region-name="header" extent="35mm"/>
54
- <fo:region-after region-name="footer" extent="23mm"/>
55
- <fo:region-start region-name="left-region" extent="17.3mm"/>
56
- <fo:region-end region-name="right-region" extent="17.3mm"/>
55
+ <fo:simple-page-master master-name="page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
57
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
58
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
59
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
60
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
57
61
  </fo:simple-page-master>
58
62
 
59
- <fo:simple-page-master master-name="last" page-width="{$pageWidth}" page-height="{$pageHeight}">
60
- <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="17.3mm" margin-right="17.3mm"/>
61
- <fo:region-before region-name="header" extent="35mm"/>
63
+ <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
64
+ <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
65
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
62
66
  <fo:region-after region-name="footer-last" extent="53mm"/>
63
67
  <fo:region-start region-name="left-region" extent="17.3mm"/>
64
68
  <fo:region-end region-name="right-region" extent="17.3mm"/>
@@ -1058,6 +1062,7 @@
1058
1062
 
1059
1063
 
1060
1064
 
1065
+
1061
1066
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1062
1067
  <xsl:attribute name="white-space">pre</xsl:attribute>
1063
1068
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1106,7 +1111,7 @@
1106
1111
  <xsl:attribute name="text-align">justify</xsl:attribute>
1107
1112
 
1108
1113
 
1109
-
1114
+
1110
1115
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1111
1116
 
1112
1117
 
@@ -1122,6 +1127,7 @@
1122
1127
 
1123
1128
 
1124
1129
 
1130
+
1125
1131
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1126
1132
 
1127
1133
 
@@ -1141,9 +1147,7 @@
1141
1147
 
1142
1148
 
1143
1149
 
1144
-
1145
-
1146
-
1150
+
1147
1151
 
1148
1152
 
1149
1153
 
@@ -1174,6 +1178,7 @@
1174
1178
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1175
1179
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1176
1180
 
1181
+
1177
1182
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1178
1183
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1179
1184
 
@@ -1193,6 +1198,9 @@
1193
1198
 
1194
1199
 
1195
1200
 
1201
+
1202
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1203
+
1196
1204
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1197
1205
 
1198
1206
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1215,11 +1223,14 @@
1215
1223
 
1216
1224
 
1217
1225
 
1226
+
1218
1227
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1219
1228
 
1220
1229
 
1221
1230
 
1222
1231
 
1232
+
1233
+
1223
1234
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1224
1235
 
1225
1236
 
@@ -1241,6 +1252,7 @@
1241
1252
 
1242
1253
 
1243
1254
 
1255
+
1244
1256
  </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">
1245
1257
 
1246
1258
 
@@ -1282,10 +1294,12 @@
1282
1294
 
1283
1295
 
1284
1296
 
1297
+
1285
1298
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1286
1299
 
1287
1300
 
1288
1301
 
1302
+
1289
1303
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1290
1304
 
1291
1305
 
@@ -1311,10 +1325,12 @@
1311
1325
 
1312
1326
 
1313
1327
 
1328
+
1314
1329
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1315
1330
 
1316
1331
 
1317
1332
 
1333
+
1318
1334
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1319
1335
 
1320
1336
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1338,6 +1354,7 @@
1338
1354
 
1339
1355
 
1340
1356
 
1357
+
1341
1358
 
1342
1359
 
1343
1360
 
@@ -1384,8 +1401,10 @@
1384
1401
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1385
1402
 
1386
1403
 
1404
+
1387
1405
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1388
1406
 
1407
+
1389
1408
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1390
1409
 
1391
1410
 
@@ -1408,6 +1427,8 @@
1408
1427
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1409
1428
 
1410
1429
 
1430
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1431
+
1411
1432
  </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
1433
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1413
1434
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1418,14 +1439,15 @@
1418
1439
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1419
1440
 
1420
1441
  <!-- Normative references -->
1421
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1442
+ <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
1443
  <!-- Terms and definitions -->
1423
1444
  <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
1445
  <!-- Another main sections -->
1425
1446
  <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
1447
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1427
1448
  <!-- Bibliography -->
1428
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1449
+ <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"/>
1450
+
1429
1451
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1430
1452
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1431
1453
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1465,11 +1487,11 @@
1465
1487
  <xsl:variable name="table">
1466
1488
 
1467
1489
  <xsl:variable name="simple-table">
1468
- <xsl:call-template name="getSimpleTable"/>
1490
+ <xsl:call-template name="getSimpleTable"/>
1469
1491
  </xsl:variable>
1470
1492
 
1471
1493
  <!-- <xsl:if test="$namespace = 'bipm'">
1472
- <fo:block>&#xA0;</fo:block>
1494
+ <fo:block>&#xA0;</fo:block>
1473
1495
  </xsl:if> -->
1474
1496
 
1475
1497
  <!-- $namespace = 'iso' or -->
@@ -1571,6 +1593,7 @@
1571
1593
 
1572
1594
 
1573
1595
 
1596
+
1574
1597
  </xsl:variable>
1575
1598
 
1576
1599
 
@@ -1712,6 +1735,9 @@
1712
1735
  <fo:block xsl:use-attribute-sets="table-name-style">
1713
1736
 
1714
1737
 
1738
+
1739
+
1740
+
1715
1741
  <xsl:choose>
1716
1742
  <xsl:when test="$continued = 'true'">
1717
1743
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -1859,6 +1885,7 @@
1859
1885
  <!-- font-weight="bold" -->
1860
1886
  <fo:table-header>
1861
1887
 
1888
+
1862
1889
  <xsl:apply-templates/>
1863
1890
  </fo:table-header>
1864
1891
  </xsl:template><xsl:template name="table-header-title">
@@ -2009,6 +2036,7 @@
2009
2036
 
2010
2037
 
2011
2038
 
2039
+
2012
2040
  <!-- fn will be processed inside 'note' processing -->
2013
2041
 
2014
2042
 
@@ -2017,6 +2045,10 @@
2017
2045
 
2018
2046
 
2019
2047
 
2048
+
2049
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2050
+
2051
+
2020
2052
  <!-- except gb -->
2021
2053
 
2022
2054
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2042,6 +2074,10 @@
2042
2074
  <!-- fn processing -->
2043
2075
  <xsl:call-template name="fn_display"/>
2044
2076
 
2077
+
2078
+ <!-- for PAS display Notes after footnotes -->
2079
+
2080
+
2045
2081
  </fo:table-cell>
2046
2082
  </fo:table-row>
2047
2083
  </fo:table-body>
@@ -2099,11 +2135,16 @@
2099
2135
  <xsl:if test="$parent-name = 'tfoot'">
2100
2136
 
2101
2137
 
2138
+
2102
2139
  </xsl:if>
2103
2140
 
2104
2141
 
2105
2142
 
2106
2143
 
2144
+
2145
+
2146
+
2147
+
2107
2148
  <!-- <xsl:if test="$namespace = 'bipm'">
2108
2149
  <xsl:attribute name="height">8mm</xsl:attribute>
2109
2150
  </xsl:if> -->
@@ -2133,6 +2174,7 @@
2133
2174
 
2134
2175
 
2135
2176
 
2177
+
2136
2178
  <xsl:if test="$lang = 'ar'">
2137
2179
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2138
2180
  </xsl:if>
@@ -2188,6 +2230,10 @@
2188
2230
 
2189
2231
 
2190
2232
 
2233
+
2234
+
2235
+
2236
+
2191
2237
  <xsl:if test=".//*[local-name() = 'table']">
2192
2238
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2193
2239
  </xsl:if>
@@ -2217,8 +2263,14 @@
2217
2263
 
2218
2264
 
2219
2265
 
2266
+
2267
+
2268
+ <!-- Table's note name (NOTE, for example) -->
2269
+
2220
2270
  <fo:inline padding-right="2mm">
2221
2271
 
2272
+
2273
+
2222
2274
 
2223
2275
 
2224
2276
 
@@ -2226,6 +2278,8 @@
2226
2278
 
2227
2279
  </fo:inline>
2228
2280
 
2281
+
2282
+
2229
2283
  <xsl:apply-templates mode="process"/>
2230
2284
  </fo:block>
2231
2285
 
@@ -2245,6 +2299,8 @@
2245
2299
  <xsl:variable name="reference" select="@reference"/>
2246
2300
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2247
2301
  <fo:block margin-bottom="12pt">
2302
+
2303
+
2248
2304
 
2249
2305
 
2250
2306
 
@@ -2260,9 +2316,11 @@
2260
2316
 
2261
2317
 
2262
2318
 
2319
+
2263
2320
  <xsl:value-of select="@reference"/>
2264
2321
 
2265
2322
 
2323
+
2266
2324
  </fo:inline>
2267
2325
  <fo:inline>
2268
2326
 
@@ -2403,11 +2461,16 @@
2403
2461
 
2404
2462
 
2405
2463
 
2464
+
2465
+
2466
+
2467
+
2406
2468
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2407
2469
 
2408
2470
 
2409
2471
  <xsl:value-of select="@reference"/>
2410
2472
 
2473
+
2411
2474
  </fo:basic-link>
2412
2475
  </fo:inline>
2413
2476
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2494,6 +2557,7 @@
2494
2557
 
2495
2558
 
2496
2559
 
2560
+
2497
2561
  <xsl:variable name="title-key">
2498
2562
 
2499
2563
 
@@ -2704,6 +2768,7 @@
2704
2768
 
2705
2769
  <fo:table-row>
2706
2770
 
2771
+
2707
2772
  <fo:table-cell>
2708
2773
 
2709
2774
  <fo:block margin-top="6pt">
@@ -2719,6 +2784,7 @@
2719
2784
 
2720
2785
 
2721
2786
 
2787
+
2722
2788
  <xsl:apply-templates/>
2723
2789
  <!-- <xsl:if test="$namespace = 'gb'">
2724
2790
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2775,6 +2841,8 @@
2775
2841
 
2776
2842
  <xsl:apply-templates/>
2777
2843
  </fo:inline>
2844
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2845
+ <fo:inline padding-right="{@value}"> </fo:inline>
2778
2846
  </xsl:template><xsl:template match="*[local-name()='sup']">
2779
2847
  <fo:inline font-size="80%" vertical-align="super">
2780
2848
  <xsl:apply-templates/>
@@ -3269,9 +3337,27 @@
3269
3337
  <xsl:copy>
3270
3338
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3271
3339
  </xsl:copy>
3272
- <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>
3273
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">
3274
3350
  <xsl:variable name="target">
3351
+ <xsl:choose>
3352
+ <xsl:when test="@updatetype = 'true'">
3353
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3354
+ </xsl:when>
3355
+ <xsl:otherwise>
3356
+ <xsl:value-of select="normalize-space(@target)"/>
3357
+ </xsl:otherwise>
3358
+ </xsl:choose>
3359
+ </xsl:variable>
3360
+ <xsl:variable name="target_text">
3275
3361
  <xsl:choose>
3276
3362
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3277
3363
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3283,20 +3369,22 @@
3283
3369
  </xsl:variable>
3284
3370
  <fo:inline xsl:use-attribute-sets="link-style">
3285
3371
 
3372
+
3373
+
3286
3374
  <xsl:choose>
3287
- <xsl:when test="$target = ''">
3375
+ <xsl:when test="$target_text = ''">
3288
3376
  <xsl:apply-templates/>
3289
3377
  </xsl:when>
3290
3378
  <xsl:otherwise>
3291
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3379
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3292
3380
  <xsl:choose>
3293
3381
  <xsl:when test="normalize-space(.) = ''">
3294
- <!-- <xsl:value-of select="$target"/> -->
3295
3382
  <xsl:call-template name="add-zero-spaces-link-java">
3296
- <xsl:with-param name="text" select="$target"/>
3383
+ <xsl:with-param name="text" select="$target_text"/>
3297
3384
  </xsl:call-template>
3298
3385
  </xsl:when>
3299
3386
  <xsl:otherwise>
3387
+ <!-- output text from <link>text</link> -->
3300
3388
  <xsl:apply-templates/>
3301
3389
  </xsl:otherwise>
3302
3390
  </xsl:choose>
@@ -3391,6 +3479,7 @@
3391
3479
 
3392
3480
 
3393
3481
 
3482
+
3394
3483
  <fo:block-container margin-left="0mm">
3395
3484
 
3396
3485
 
@@ -3434,6 +3523,7 @@
3434
3523
  </xsl:choose>
3435
3524
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3436
3525
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3526
+
3437
3527
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3438
3528
 
3439
3529
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3513,6 +3603,7 @@
3513
3603
  </xsl:call-template>
3514
3604
 
3515
3605
  <fo:block>
3606
+
3516
3607
  <xsl:apply-templates/>
3517
3608
  </fo:block>
3518
3609
  <xsl:call-template name="fn_display_figure"/>
@@ -3635,6 +3726,234 @@
3635
3726
  <xsl:param name="height"/>
3636
3727
  <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; "/>
3637
3728
  <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; "/>
3729
+ </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">
3730
+ <xsl:param name="name"/>
3731
+
3732
+ <xsl:variable name="svg_content">
3733
+ <xsl:apply-templates select="." mode="svg_update"/>
3734
+ </xsl:variable>
3735
+
3736
+ <xsl:variable name="alt-text">
3737
+ <xsl:choose>
3738
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3739
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3740
+ </xsl:when>
3741
+ <xsl:when test="normalize-space($name) != ''">
3742
+ <xsl:value-of select="$name"/>
3743
+ </xsl:when>
3744
+ <xsl:otherwise>Figure</xsl:otherwise>
3745
+ </xsl:choose>
3746
+ </xsl:variable>
3747
+
3748
+ <xsl:choose>
3749
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3750
+ <fo:block>
3751
+ <xsl:variable name="width" select="@width"/>
3752
+ <xsl:variable name="height" select="@height"/>
3753
+
3754
+ <xsl:variable name="scale_x">
3755
+ <xsl:choose>
3756
+ <xsl:when test="$width &gt; $width_effective_px">
3757
+ <xsl:value-of select="$width_effective_px div $width"/>
3758
+ </xsl:when>
3759
+ <xsl:otherwise>1</xsl:otherwise>
3760
+ </xsl:choose>
3761
+ </xsl:variable>
3762
+
3763
+ <xsl:variable name="scale_y">
3764
+ <xsl:choose>
3765
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3766
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3767
+ </xsl:when>
3768
+ <xsl:otherwise>1</xsl:otherwise>
3769
+ </xsl:choose>
3770
+ </xsl:variable>
3771
+
3772
+ <xsl:variable name="scale">
3773
+ <xsl:choose>
3774
+ <xsl:when test="$scale_y != 1">
3775
+ <xsl:value-of select="$scale_x * $scale_y"/>
3776
+ </xsl:when>
3777
+ <xsl:otherwise>
3778
+ <xsl:value-of select="$scale_x"/>
3779
+ </xsl:otherwise>
3780
+ </xsl:choose>
3781
+ </xsl:variable>
3782
+
3783
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3784
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3785
+
3786
+ <fo:table table-layout="fixed" width="100%">
3787
+ <fo:table-column column-width="proportional-column-width(1)"/>
3788
+ <fo:table-column column-width="{$width_scale}px"/>
3789
+ <fo:table-column column-width="proportional-column-width(1)"/>
3790
+ <fo:table-body>
3791
+ <fo:table-row>
3792
+ <fo:table-cell column-number="2">
3793
+ <fo:block>
3794
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3795
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3796
+ <fo:block line-height="0" font-size="0">
3797
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3798
+ <xsl:call-template name="bookmark"/>
3799
+ </xsl:for-each>
3800
+ </fo:block>
3801
+ </xsl:if>
3802
+ <fo:block text-depth="0" line-height="0" font-size="0">
3803
+
3804
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3805
+ <xsl:attribute name="width">100%</xsl:attribute>
3806
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3807
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3808
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3809
+
3810
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3811
+ </fo:instream-foreign-object>
3812
+ </fo:block>
3813
+
3814
+ <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">
3815
+ <xsl:with-param name="scale" select="$scale"/>
3816
+ </xsl:apply-templates>
3817
+ </fo:block-container>
3818
+ </fo:block>
3819
+ </fo:table-cell>
3820
+ </fo:table-row>
3821
+ </fo:table-body>
3822
+ </fo:table>
3823
+ </fo:block>
3824
+
3825
+ </xsl:when>
3826
+ <xsl:otherwise>
3827
+ <fo:block xsl:use-attribute-sets="image-style">
3828
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3829
+ <xsl:attribute name="width">100%</xsl:attribute>
3830
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3831
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3832
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3833
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3834
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3835
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3836
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3837
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3838
+ </xsl:if>
3839
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3840
+ <xsl:copy-of select="$svg_content"/>
3841
+ </fo:instream-foreign-object>
3842
+ </fo:block>
3843
+ </xsl:otherwise>
3844
+ </xsl:choose>
3845
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3846
+ <xsl:copy>
3847
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3848
+ </xsl:copy>
3849
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3850
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3851
+ <xsl:value-of select="."/>
3852
+ </xsl:attribute>
3853
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3854
+ <xsl:variable name="svg_content" select="document(@src)"/>
3855
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3856
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3857
+ <xsl:call-template name="image_svg">
3858
+ <xsl:with-param name="name" select="$name"/>
3859
+ </xsl:call-template>
3860
+ </xsl:for-each>
3861
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3862
+ <xsl:copy>
3863
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3864
+ </xsl:copy>
3865
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3866
+ <xsl:apply-templates mode="svg_remove_a"/>
3867
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3868
+ <xsl:param name="scale"/>
3869
+ <xsl:variable name="dest">
3870
+ <xsl:choose>
3871
+ <xsl:when test="starts-with(@href, '#')">
3872
+ <xsl:value-of select="substring-after(@href, '#')"/>
3873
+ </xsl:when>
3874
+ <xsl:otherwise>
3875
+ <xsl:value-of select="@href"/>
3876
+ </xsl:otherwise>
3877
+ </xsl:choose>
3878
+ </xsl:variable>
3879
+ <xsl:for-each select="./*[local-name() = 'rect']">
3880
+ <xsl:call-template name="insertSVGMapLink">
3881
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3882
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3883
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3884
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3885
+ <xsl:with-param name="dest" select="$dest"/>
3886
+ </xsl:call-template>
3887
+ </xsl:for-each>
3888
+
3889
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3890
+ <xsl:variable name="points">
3891
+ <xsl:call-template name="split">
3892
+ <xsl:with-param name="pText" select="@points"/>
3893
+ </xsl:call-template>
3894
+ </xsl:variable>
3895
+ <xsl:variable name="x_coords">
3896
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3897
+ <xsl:sort select="." data-type="number"/>
3898
+ <x><xsl:value-of select="."/></x>
3899
+ </xsl:for-each>
3900
+ </xsl:variable>
3901
+ <xsl:variable name="y_coords">
3902
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3903
+ <xsl:sort select="." data-type="number"/>
3904
+ <y><xsl:value-of select="."/></y>
3905
+ </xsl:for-each>
3906
+ </xsl:variable>
3907
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3908
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3909
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3910
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3911
+ <xsl:call-template name="insertSVGMapLink">
3912
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3913
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3914
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3915
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3916
+ <xsl:with-param name="dest" select="$dest"/>
3917
+ </xsl:call-template>
3918
+ </xsl:for-each>
3919
+
3920
+ <xsl:for-each select="./*[local-name() = 'circle']">
3921
+ <xsl:call-template name="insertSVGMapLink">
3922
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3923
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3924
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3925
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3926
+ <xsl:with-param name="dest" select="$dest"/>
3927
+ </xsl:call-template>
3928
+ </xsl:for-each>
3929
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3930
+ <xsl:call-template name="insertSVGMapLink">
3931
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3932
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3933
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3934
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3935
+ <xsl:with-param name="dest" select="$dest"/>
3936
+ </xsl:call-template>
3937
+ </xsl:for-each>
3938
+ </xsl:template><xsl:template name="insertSVGMapLink">
3939
+ <xsl:param name="left"/>
3940
+ <xsl:param name="top"/>
3941
+ <xsl:param name="width"/>
3942
+ <xsl:param name="height"/>
3943
+ <xsl:param name="dest"/>
3944
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3945
+ <fo:block font-size="1pt">
3946
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3947
+ <fo:inline-container inline-progression-dimension="100%">
3948
+ <fo:block-container height="{$height - 1}px" width="100%">
3949
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3950
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3951
+ </xsl:if> -->
3952
+ <fo:block> </fo:block></fo:block-container>
3953
+ </fo:inline-container>
3954
+ </fo:basic-link>
3955
+ </fo:block>
3956
+ </fo:block-container>
3638
3957
  </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">
3639
3958
  <xsl:apply-templates mode="contents"/>
3640
3959
  <xsl:text> </xsl:text>
@@ -3663,28 +3982,39 @@
3663
3982
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3664
3983
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3665
3984
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3985
+ <xsl:if test="@bundle = 'true'">
3986
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3987
+ </xsl:if>
3666
3988
  <fo:bookmark-title>
3667
- <xsl:variable name="bookmark-title_">
3668
- <xsl:call-template name="getLangVersion">
3669
- <xsl:with-param name="lang" select="@lang"/>
3670
- <xsl:with-param name="doctype" select="@doctype"/>
3671
- <xsl:with-param name="title" select="@title-part"/>
3672
- </xsl:call-template>
3673
- </xsl:variable>
3674
3989
  <xsl:choose>
3675
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3676
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3677
- </xsl:when>
3678
- <xsl:otherwise>
3990
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3991
+ <xsl:variable name="bookmark-title_">
3992
+ <xsl:call-template name="getLangVersion">
3993
+ <xsl:with-param name="lang" select="@lang"/>
3994
+ <xsl:with-param name="doctype" select="@doctype"/>
3995
+ <xsl:with-param name="title" select="@title-part"/>
3996
+ </xsl:call-template>
3997
+ </xsl:variable>
3679
3998
  <xsl:choose>
3680
- <xsl:when test="@lang = 'en'">English</xsl:when>
3681
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3682
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3683
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3999
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4000
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4001
+ </xsl:when>
4002
+ <xsl:otherwise>
4003
+ <xsl:choose>
4004
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4005
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4006
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4007
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4008
+ </xsl:choose>
4009
+ </xsl:otherwise>
3684
4010
  </xsl:choose>
4011
+ </xsl:when>
4012
+ <xsl:otherwise>
4013
+ <xsl:value-of select="@title-part"/>
3685
4014
  </xsl:otherwise>
3686
4015
  </xsl:choose>
3687
4016
  </fo:bookmark-title>
4017
+
3688
4018
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3689
4019
 
3690
4020
  <xsl:call-template name="insertFigureBookmarks">
@@ -3783,20 +4113,28 @@
3783
4113
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3784
4114
  </xsl:choose>
3785
4115
  </xsl:template><xsl:template match="item" mode="bookmark">
3786
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3787
- <fo:bookmark-title>
3788
- <xsl:if test="@section != ''">
3789
- <xsl:value-of select="@section"/>
3790
- <xsl:text> </xsl:text>
3791
- </xsl:if>
3792
- <xsl:value-of select="normalize-space(title)"/>
3793
- </fo:bookmark-title>
3794
- <xsl:apply-templates mode="bookmark"/>
3795
- </fo:bookmark>
4116
+ <xsl:choose>
4117
+ <xsl:when test="@id != ''">
4118
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4119
+ <fo:bookmark-title>
4120
+ <xsl:if test="@section != ''">
4121
+ <xsl:value-of select="@section"/>
4122
+ <xsl:text> </xsl:text>
4123
+ </xsl:if>
4124
+ <xsl:value-of select="normalize-space(title)"/>
4125
+ </fo:bookmark-title>
4126
+ <xsl:apply-templates mode="bookmark"/>
4127
+ </fo:bookmark>
4128
+ </xsl:when>
4129
+ <xsl:otherwise>
4130
+ <xsl:apply-templates mode="bookmark"/>
4131
+ </xsl:otherwise>
4132
+ </xsl:choose>
3796
4133
  </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">
3797
4134
  <xsl:if test="normalize-space() != ''">
3798
4135
  <fo:block xsl:use-attribute-sets="figure-name-style">
3799
4136
 
4137
+
3800
4138
  <xsl:apply-templates/>
3801
4139
  </fo:block>
3802
4140
  </xsl:if>
@@ -3876,6 +4214,8 @@
3876
4214
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3877
4215
 
3878
4216
  <fo:block-container margin-left="0mm">
4217
+ <xsl:copy-of select="@id"/>
4218
+
3879
4219
  <xsl:if test="parent::*[local-name() = 'note']">
3880
4220
  <xsl:attribute name="margin-left">
3881
4221
  <xsl:choose>
@@ -3886,7 +4226,9 @@
3886
4226
 
3887
4227
  </xsl:if>
3888
4228
  <fo:block-container margin-left="0mm">
3889
-
4229
+
4230
+
4231
+
3890
4232
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3891
4233
  <xsl:variable name="_font-size">
3892
4234
 
@@ -3915,10 +4257,14 @@
3915
4257
  </xsl:choose>
3916
4258
  </xsl:attribute>
3917
4259
  </xsl:if>
3918
- <xsl:apply-templates/>
3919
- </fo:block>
4260
+
4261
+ <xsl:apply-templates/>
4262
+ </fo:block>
4263
+
4264
+
3920
4265
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3921
4266
 
4267
+
3922
4268
  </fo:block-container>
3923
4269
  </fo:block-container>
3924
4270
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4153,6 +4499,7 @@
4153
4499
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4154
4500
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4155
4501
 
4502
+
4156
4503
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4157
4504
 
4158
4505
  <xsl:variable name="element">
@@ -4326,7 +4673,9 @@
4326
4673
  <xsl:attribute name="vertical-align">super</xsl:attribute>
4327
4674
 
4328
4675
  </xsl:if>
4329
-
4676
+
4677
+
4678
+
4330
4679
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4331
4680
  <xsl:if test="normalize-space(@citeas) = ''">
4332
4681
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4335,6 +4684,7 @@
4335
4684
 
4336
4685
 
4337
4686
 
4687
+
4338
4688
  </xsl:if>
4339
4689
 
4340
4690
  <xsl:apply-templates/>
@@ -4362,6 +4712,7 @@
4362
4712
 
4363
4713
 
4364
4714
 
4715
+
4365
4716
 
4366
4717
  <xsl:variable name="references_num_current">
4367
4718
  <xsl:number level="any" count="m3d:references"/>
@@ -4484,6 +4835,7 @@
4484
4835
  <xsl:call-template name="setId"/>
4485
4836
 
4486
4837
 
4838
+
4487
4839
  <xsl:apply-templates/>
4488
4840
  </fo:block>
4489
4841
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4730,17 +5082,17 @@
4730
5082
  <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')]"/>
4731
5083
  <xsl:choose>
4732
5084
  <xsl:when test="normalize-space($_doc_ident) != ''">
4733
- <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"/>
5085
+ <!-- <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"/>
4734
5086
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4735
5087
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4736
- </xsl:if>
5088
+ </xsl:if> -->
4737
5089
  <xsl:value-of select="$_doc_ident"/>
4738
5090
  </xsl:when>
4739
5091
  <xsl:otherwise>
4740
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5092
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4741
5093
  <xsl:if test="$type != ''">
4742
5094
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4743
- </xsl:if>
5095
+ </xsl:if> -->
4744
5096
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4745
5097
  </xsl:otherwise>
4746
5098
  </xsl:choose>
@@ -5053,6 +5405,9 @@
5053
5405
  <xsl:when test="parent::*[local-name() = 'preface']">
5054
5406
  <xsl:value-of select="$level_total - 1"/>
5055
5407
  </xsl:when>
5408
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5409
+ <xsl:value-of select="$level_total - 1"/>
5410
+ </xsl:when>
5056
5411
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5057
5412
  <xsl:value-of select="$level_total - 2"/>
5058
5413
  </xsl:when>
@@ -5193,7 +5548,14 @@
5193
5548
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5194
5549
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5195
5550
  </xsl:when>
5196
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5551
+ <xsl:otherwise>
5552
+ <xsl:variable name="key_">
5553
+ <xsl:call-template name="capitalize">
5554
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5555
+ </xsl:call-template>
5556
+ </xsl:variable>
5557
+ <xsl:value-of select="$key_"/>
5558
+ </xsl:otherwise>
5197
5559
  </xsl:choose>
5198
5560
 
5199
5561
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -5236,4 +5598,110 @@
5236
5598
  <xsl:value-of select="$align"/>
5237
5599
  </xsl:when>
5238
5600
  </xsl:choose>
5601
+ </xsl:template><xsl:template name="setTextAlignment">
5602
+ <xsl:param name="default">left</xsl:param>
5603
+ <xsl:attribute name="text-align">
5604
+ <xsl:choose>
5605
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5606
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5607
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5608
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5609
+ </xsl:choose>
5610
+ </xsl:attribute>
5611
+ </xsl:template><xsl:template name="number-to-words">
5612
+ <xsl:param name="number"/>
5613
+ <xsl:param name="first"/>
5614
+ <xsl:if test="$number != ''">
5615
+ <xsl:variable name="words">
5616
+ <words>
5617
+ <word cardinal="1">One-</word>
5618
+ <word ordinal="1">First </word>
5619
+ <word cardinal="2">Two-</word>
5620
+ <word ordinal="2">Second </word>
5621
+ <word cardinal="3">Three-</word>
5622
+ <word ordinal="3">Third </word>
5623
+ <word cardinal="4">Four-</word>
5624
+ <word ordinal="4">Fourth </word>
5625
+ <word cardinal="5">Five-</word>
5626
+ <word ordinal="5">Fifth </word>
5627
+ <word cardinal="6">Six-</word>
5628
+ <word ordinal="6">Sixth </word>
5629
+ <word cardinal="7">Seven-</word>
5630
+ <word ordinal="7">Seventh </word>
5631
+ <word cardinal="8">Eight-</word>
5632
+ <word ordinal="8">Eighth </word>
5633
+ <word cardinal="9">Nine-</word>
5634
+ <word ordinal="9">Ninth </word>
5635
+ <word ordinal="10">Tenth </word>
5636
+ <word ordinal="11">Eleventh </word>
5637
+ <word ordinal="12">Twelfth </word>
5638
+ <word ordinal="13">Thirteenth </word>
5639
+ <word ordinal="14">Fourteenth </word>
5640
+ <word ordinal="15">Fifteenth </word>
5641
+ <word ordinal="16">Sixteenth </word>
5642
+ <word ordinal="17">Seventeenth </word>
5643
+ <word ordinal="18">Eighteenth </word>
5644
+ <word ordinal="19">Nineteenth </word>
5645
+ <word cardinal="20">Twenty-</word>
5646
+ <word ordinal="20">Twentieth </word>
5647
+ <word cardinal="30">Thirty-</word>
5648
+ <word ordinal="30">Thirtieth </word>
5649
+ <word cardinal="40">Forty-</word>
5650
+ <word ordinal="40">Fortieth </word>
5651
+ <word cardinal="50">Fifty-</word>
5652
+ <word ordinal="50">Fiftieth </word>
5653
+ <word cardinal="60">Sixty-</word>
5654
+ <word ordinal="60">Sixtieth </word>
5655
+ <word cardinal="70">Seventy-</word>
5656
+ <word ordinal="70">Seventieth </word>
5657
+ <word cardinal="80">Eighty-</word>
5658
+ <word ordinal="80">Eightieth </word>
5659
+ <word cardinal="90">Ninety-</word>
5660
+ <word ordinal="90">Ninetieth </word>
5661
+ <word cardinal="100">Hundred-</word>
5662
+ <word ordinal="100">Hundredth </word>
5663
+ </words>
5664
+ </xsl:variable>
5665
+
5666
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5667
+
5668
+ <xsl:variable name="value">
5669
+ <xsl:choose>
5670
+ <xsl:when test="$ordinal != ''">
5671
+ <xsl:value-of select="$ordinal"/>
5672
+ </xsl:when>
5673
+ <xsl:otherwise>
5674
+ <xsl:choose>
5675
+ <xsl:when test="$number &lt; 100">
5676
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5677
+ <xsl:variable name="digit" select="substring($number,2)"/>
5678
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5679
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5680
+ </xsl:when>
5681
+ <xsl:otherwise>
5682
+ <!-- more 100 -->
5683
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5684
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5685
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5686
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5687
+ <xsl:call-template name="number-to-words">
5688
+ <xsl:with-param name="number" select="$digits"/>
5689
+ </xsl:call-template>
5690
+ </xsl:otherwise>
5691
+ </xsl:choose>
5692
+ </xsl:otherwise>
5693
+ </xsl:choose>
5694
+ </xsl:variable>
5695
+ <xsl:choose>
5696
+ <xsl:when test="$first = 'true'">
5697
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5698
+ <xsl:call-template name="capitalize">
5699
+ <xsl:with-param name="str" select="$value_lc"/>
5700
+ </xsl:call-template>
5701
+ </xsl:when>
5702
+ <xsl:otherwise>
5703
+ <xsl:value-of select="$value"/>
5704
+ </xsl:otherwise>
5705
+ </xsl:choose>
5706
+ </xsl:if>
5239
5707
  </xsl:template></xsl:stylesheet>