metanorma-ogc 1.3.1 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,8 +7,12 @@
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.4"/>
13
+ <xsl:variable name="marginLeftRight2" select="25.4"/>
14
+ <xsl:variable name="marginTop" select="25.4"/>
15
+ <xsl:variable name="marginBottom" select="25.4"/>
12
16
 
13
17
 
14
18
 
@@ -97,12 +101,12 @@
97
101
  <fo:layout-master-set>
98
102
 
99
103
  <!-- Document pages -->
100
- <fo:simple-page-master master-name="document" page-width="{$pageWidth}" page-height="{$pageHeight}">
101
- <fo:region-body margin-top="1in" margin-bottom="1in" margin-left="1in" margin-right="1in"/>
102
- <fo:region-before region-name="header" extent="1in" precedence="true"/>
103
- <fo:region-after region-name="footer" extent="1in" precedence="true"/>
104
- <fo:region-start region-name="left" extent="1in"/>
105
- <fo:region-end region-name="right" extent="1in"/>
104
+ <fo:simple-page-master master-name="document" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
105
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
106
+ <fo:region-before region-name="header" extent="{$marginTop}mm" precedence="true"/>
107
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm" precedence="true"/>
108
+ <fo:region-start region-name="left" extent="{$marginLeftRight1}mm"/>
109
+ <fo:region-end region-name="right" extent="{$marginLeftRight2}mm"/>
106
110
  </fo:simple-page-master>
107
111
 
108
112
  </fo:layout-master-set>
@@ -1027,6 +1031,9 @@
1027
1031
  <title-continued lang="en">(continued)</title-continued>
1028
1032
  <title-continued lang="fr">(continué)</title-continued>
1029
1033
 
1034
+ </xsl:variable><xsl:variable name="bibdata">
1035
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1036
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1030
1037
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1031
1038
  <xsl:param name="name"/>
1032
1039
  <xsl:param name="lang"/>
@@ -1055,11 +1062,13 @@
1055
1062
 
1056
1063
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1057
1064
 
1065
+
1058
1066
  <xsl:attribute name="color">blue</xsl:attribute>
1059
1067
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1060
1068
 
1061
1069
 
1062
1070
 
1071
+
1063
1072
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1064
1073
  <xsl:attribute name="white-space">pre</xsl:attribute>
1065
1074
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1148,7 +1157,7 @@
1148
1157
 
1149
1158
 
1150
1159
 
1151
-
1160
+
1152
1161
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1153
1162
 
1154
1163
 
@@ -1165,6 +1174,7 @@
1165
1174
 
1166
1175
 
1167
1176
 
1177
+
1168
1178
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1169
1179
 
1170
1180
 
@@ -1188,9 +1198,7 @@
1188
1198
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1189
1199
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1190
1200
 
1191
-
1192
-
1193
-
1201
+
1194
1202
 
1195
1203
 
1196
1204
 
@@ -1219,8 +1227,10 @@
1219
1227
 
1220
1228
 
1221
1229
 
1230
+
1222
1231
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1223
1232
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1233
+
1224
1234
 
1225
1235
 
1226
1236
 
@@ -1242,6 +1252,9 @@
1242
1252
 
1243
1253
 
1244
1254
 
1255
+
1256
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1257
+
1245
1258
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1246
1259
 
1247
1260
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1262,22 +1275,27 @@
1262
1275
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
1263
1276
 
1264
1277
 
1278
+
1265
1279
  <xsl:attribute name="color">blue</xsl:attribute>
1266
1280
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1267
1281
 
1268
1282
 
1283
+
1269
1284
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1270
1285
 
1271
1286
 
1287
+
1272
1288
  <xsl:attribute name="color">blue</xsl:attribute>
1273
1289
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1274
1290
 
1275
1291
 
1276
1292
 
1293
+
1277
1294
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1278
1295
 
1279
1296
 
1280
1297
 
1298
+
1281
1299
 
1282
1300
 
1283
1301
 
@@ -1294,6 +1312,7 @@
1294
1312
 
1295
1313
 
1296
1314
 
1315
+
1297
1316
  </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">
1298
1317
 
1299
1318
 
@@ -1305,6 +1324,7 @@
1305
1324
 
1306
1325
 
1307
1326
 
1327
+
1308
1328
  <xsl:attribute name="padding-right">4mm</xsl:attribute>
1309
1329
 
1310
1330
 
@@ -1328,6 +1348,7 @@
1328
1348
 
1329
1349
  </xsl:attribute-set><xsl:attribute-set name="termnote-style">
1330
1350
 
1351
+
1331
1352
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1332
1353
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1333
1354
 
@@ -1335,9 +1356,12 @@
1335
1356
 
1336
1357
 
1337
1358
 
1359
+
1338
1360
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1361
+
1339
1362
 
1340
1363
 
1364
+
1341
1365
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1342
1366
 
1343
1367
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1359,6 +1383,7 @@
1359
1383
 
1360
1384
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1361
1385
 
1386
+
1362
1387
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1363
1388
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1364
1389
 
@@ -1366,6 +1391,7 @@
1366
1391
 
1367
1392
 
1368
1393
 
1394
+
1369
1395
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1370
1396
 
1371
1397
 
@@ -1373,10 +1399,12 @@
1373
1399
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1374
1400
 
1375
1401
 
1402
+
1376
1403
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1377
1404
 
1378
1405
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1379
1406
 
1407
+
1380
1408
 
1381
1409
 
1382
1410
 
@@ -1399,6 +1427,7 @@
1399
1427
 
1400
1428
 
1401
1429
 
1430
+
1402
1431
 
1403
1432
 
1404
1433
 
@@ -1409,6 +1438,7 @@
1409
1438
  <xsl:attribute name="text-align">center</xsl:attribute>
1410
1439
 
1411
1440
 
1441
+
1412
1442
  <xsl:attribute name="space-before">12pt</xsl:attribute>
1413
1443
  <xsl:attribute name="space-after">0pt</xsl:attribute>
1414
1444
 
@@ -1419,6 +1449,7 @@
1419
1449
 
1420
1450
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1421
1451
 
1452
+
1422
1453
  <xsl:attribute name="width">100%</xsl:attribute>
1423
1454
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1424
1455
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -1447,13 +1478,16 @@
1447
1478
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1448
1479
 
1449
1480
 
1481
+
1450
1482
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1451
1483
 
1484
+
1452
1485
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1453
1486
 
1454
1487
  <xsl:attribute name="space-after">6pt</xsl:attribute>
1455
1488
 
1456
1489
 
1490
+
1457
1491
  </xsl:attribute-set><xsl:variable name="color-added-text">
1458
1492
  <xsl:text>rgb(0, 255, 0)</xsl:text>
1459
1493
  </xsl:variable><xsl:attribute-set name="add-style">
@@ -1472,6 +1506,8 @@
1472
1506
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1473
1507
 
1474
1508
 
1509
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1510
+
1475
1511
  </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">
1476
1512
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1477
1513
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1482,14 +1518,15 @@
1482
1518
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1483
1519
 
1484
1520
  <!-- Normative references -->
1485
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1521
+ <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"/>
1486
1522
  <!-- Terms and definitions -->
1487
1523
  <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"/>
1488
1524
  <!-- Another main sections -->
1489
1525
  <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"/>
1490
1526
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1491
1527
  <!-- Bibliography -->
1492
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1528
+ <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"/>
1529
+
1493
1530
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1494
1531
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1495
1532
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1525,11 +1562,11 @@
1525
1562
  <xsl:variable name="table">
1526
1563
 
1527
1564
  <xsl:variable name="simple-table">
1528
- <xsl:call-template name="getSimpleTable"/>
1565
+ <xsl:call-template name="getSimpleTable"/>
1529
1566
  </xsl:variable>
1530
1567
 
1531
1568
  <!-- <xsl:if test="$namespace = 'bipm'">
1532
- <fo:block>&#xA0;</fo:block>
1569
+ <fo:block>&#xA0;</fo:block>
1533
1570
  </xsl:if> -->
1534
1571
 
1535
1572
  <!-- $namespace = 'iso' or -->
@@ -1589,6 +1626,7 @@
1589
1626
 
1590
1627
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1591
1628
 
1629
+
1592
1630
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1593
1631
 
1594
1632
 
@@ -1608,6 +1646,8 @@
1608
1646
 
1609
1647
 
1610
1648
 
1649
+
1650
+
1611
1651
  <xsl:variable name="table_width">
1612
1652
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1613
1653
 
@@ -1631,6 +1671,7 @@
1631
1671
 
1632
1672
 
1633
1673
 
1674
+
1634
1675
  <attribute name="margin-left">0mm</attribute>
1635
1676
  <attribute name="margin-right">0mm</attribute>
1636
1677
 
@@ -1639,6 +1680,7 @@
1639
1680
 
1640
1681
 
1641
1682
 
1683
+
1642
1684
  </xsl:variable>
1643
1685
 
1644
1686
 
@@ -1774,11 +1816,25 @@
1774
1816
  </xsl:choose>
1775
1817
 
1776
1818
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1819
+ <xsl:param name="continued"/>
1777
1820
  <xsl:if test="normalize-space() != ''">
1778
1821
  <fo:block xsl:use-attribute-sets="table-name-style">
1779
1822
 
1780
1823
 
1781
- <xsl:apply-templates/>
1824
+
1825
+
1826
+
1827
+ <xsl:choose>
1828
+ <xsl:when test="$continued = 'true'">
1829
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
1830
+
1831
+ </xsl:when>
1832
+ <xsl:otherwise>
1833
+ <xsl:apply-templates/>
1834
+ </xsl:otherwise>
1835
+ </xsl:choose>
1836
+
1837
+
1782
1838
  </fo:block>
1783
1839
  </xsl:if>
1784
1840
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1915,21 +1971,22 @@
1915
1971
  <!-- font-weight="bold" -->
1916
1972
  <fo:table-header>
1917
1973
 
1974
+
1918
1975
  <xsl:apply-templates/>
1919
1976
  </fo:table-header>
1920
1977
  </xsl:template><xsl:template name="table-header-title">
1921
- <xsl:param name="cols-count"/>
1978
+ <xsl:param name="cols-count"/>
1922
1979
  <!-- row for title -->
1923
1980
  <fo:table-row>
1924
1981
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
1925
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1982
+
1983
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1984
+ <xsl:with-param name="continued">true</xsl:with-param>
1985
+ </xsl:apply-templates>
1926
1986
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1927
1987
  <xsl:call-template name="fn_name_display"/>
1928
- </xsl:for-each>
1929
- <fo:block text-align="right" font-style="italic">
1930
- <xsl:text> </xsl:text>
1931
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1932
- </fo:block>
1988
+ </xsl:for-each>
1989
+
1933
1990
  </fo:table-cell>
1934
1991
  </fo:table-row>
1935
1992
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2150,6 +2207,7 @@
2150
2207
 
2151
2208
 
2152
2209
 
2210
+
2153
2211
  </xsl:if>
2154
2212
  <xsl:if test="$parent-name = 'tfoot'">
2155
2213
 
@@ -2159,6 +2217,10 @@
2159
2217
 
2160
2218
 
2161
2219
 
2220
+
2221
+
2222
+
2223
+
2162
2224
  <!-- <xsl:if test="$namespace = 'bipm'">
2163
2225
  <xsl:attribute name="height">8mm</xsl:attribute>
2164
2226
  </xsl:if> -->
@@ -2182,6 +2244,7 @@
2182
2244
 
2183
2245
 
2184
2246
 
2247
+
2185
2248
  <xsl:attribute name="padding">1mm</xsl:attribute>
2186
2249
  <xsl:attribute name="background-color">rgb(0, 51, 102)</xsl:attribute>
2187
2250
  <xsl:attribute name="color">white</xsl:attribute>
@@ -2193,6 +2256,7 @@
2193
2256
 
2194
2257
 
2195
2258
 
2259
+
2196
2260
  <xsl:if test="$lang = 'ar'">
2197
2261
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2198
2262
  </xsl:if>
@@ -2243,6 +2307,8 @@
2243
2307
 
2244
2308
 
2245
2309
 
2310
+
2311
+
2246
2312
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
2247
2313
  <xsl:attribute name="border">solid 0.5pt rgb(153, 153, 153)</xsl:attribute>
2248
2314
  <xsl:attribute name="height">5mm</xsl:attribute>
@@ -2251,6 +2317,9 @@
2251
2317
 
2252
2318
 
2253
2319
 
2320
+
2321
+
2322
+
2254
2323
  <xsl:if test=".//*[local-name() = 'table']">
2255
2324
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2256
2325
  </xsl:if>
@@ -2280,6 +2349,7 @@
2280
2349
 
2281
2350
 
2282
2351
 
2352
+
2283
2353
  <fo:inline padding-right="2mm">
2284
2354
 
2285
2355
 
@@ -2329,6 +2399,7 @@
2329
2399
 
2330
2400
 
2331
2401
 
2402
+
2332
2403
  <xsl:value-of select="@reference"/>
2333
2404
 
2334
2405
 
@@ -2470,6 +2541,9 @@
2470
2541
 
2471
2542
 
2472
2543
 
2544
+
2545
+
2546
+
2473
2547
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2474
2548
  <xsl:attribute name="color">blue</xsl:attribute>
2475
2549
 
@@ -2477,6 +2551,7 @@
2477
2551
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2478
2552
 
2479
2553
 
2554
+
2480
2555
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2481
2556
 
2482
2557
  <xsl:attribute name="internal-destination">
@@ -2573,6 +2648,7 @@
2573
2648
 
2574
2649
 
2575
2650
 
2651
+
2576
2652
  <xsl:variable name="title-key">
2577
2653
 
2578
2654
 
@@ -2783,6 +2859,7 @@
2783
2859
 
2784
2860
  <fo:table-row>
2785
2861
 
2862
+
2786
2863
  <fo:table-cell>
2787
2864
 
2788
2865
  <fo:block margin-top="6pt">
@@ -2801,6 +2878,7 @@
2801
2878
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2802
2879
 
2803
2880
 
2881
+
2804
2882
  <xsl:apply-templates/>
2805
2883
  <!-- <xsl:if test="$namespace = 'gb'">
2806
2884
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2857,6 +2935,8 @@
2857
2935
 
2858
2936
  <xsl:apply-templates/>
2859
2937
  </fo:inline>
2938
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2939
+ <fo:inline padding-right="{@value}"> </fo:inline>
2860
2940
  </xsl:template><xsl:template match="*[local-name()='sup']">
2861
2941
  <fo:inline font-size="80%" vertical-align="super">
2862
2942
  <xsl:apply-templates/>
@@ -2880,6 +2960,7 @@
2880
2960
 
2881
2961
 
2882
2962
 
2963
+
2883
2964
  10
2884
2965
 
2885
2966
 
@@ -3263,11 +3344,15 @@
3263
3344
  </xsl:apply-templates>
3264
3345
  </xsl:template><xsl:template name="getLang">
3265
3346
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3347
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3266
3348
  <xsl:variable name="language">
3267
3349
  <xsl:choose>
3268
3350
  <xsl:when test="$language_current != ''">
3269
3351
  <xsl:value-of select="$language_current"/>
3270
3352
  </xsl:when>
3353
+ <xsl:when test="$language_current_2 != ''">
3354
+ <xsl:value-of select="$language_current_2"/>
3355
+ </xsl:when>
3271
3356
  <xsl:otherwise>
3272
3357
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3273
3358
  </xsl:otherwise>
@@ -3341,9 +3426,27 @@
3341
3426
  <xsl:copy>
3342
3427
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3343
3428
  </xsl:copy>
3344
- <mathml:mspace width="0.5ex"/>
3429
+ <xsl:choose>
3430
+ <!-- if in msub, then don't add space -->
3431
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3432
+ <!-- if next char in digit, don't add space -->
3433
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3434
+ <xsl:otherwise>
3435
+ <mathml:mspace width="0.5ex"/>
3436
+ </xsl:otherwise>
3437
+ </xsl:choose>
3345
3438
  </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">
3346
3439
  <xsl:variable name="target">
3440
+ <xsl:choose>
3441
+ <xsl:when test="@updatetype = 'true'">
3442
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3443
+ </xsl:when>
3444
+ <xsl:otherwise>
3445
+ <xsl:value-of select="normalize-space(@target)"/>
3446
+ </xsl:otherwise>
3447
+ </xsl:choose>
3448
+ </xsl:variable>
3449
+ <xsl:variable name="target_text">
3347
3450
  <xsl:choose>
3348
3451
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3349
3452
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3355,20 +3458,22 @@
3355
3458
  </xsl:variable>
3356
3459
  <fo:inline xsl:use-attribute-sets="link-style">
3357
3460
 
3461
+
3462
+
3358
3463
  <xsl:choose>
3359
- <xsl:when test="$target = ''">
3464
+ <xsl:when test="$target_text = ''">
3360
3465
  <xsl:apply-templates/>
3361
3466
  </xsl:when>
3362
3467
  <xsl:otherwise>
3363
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3468
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3364
3469
  <xsl:choose>
3365
3470
  <xsl:when test="normalize-space(.) = ''">
3366
- <!-- <xsl:value-of select="$target"/> -->
3367
3471
  <xsl:call-template name="add-zero-spaces-link-java">
3368
- <xsl:with-param name="text" select="$target"/>
3472
+ <xsl:with-param name="text" select="$target_text"/>
3369
3473
  </xsl:call-template>
3370
3474
  </xsl:when>
3371
3475
  <xsl:otherwise>
3476
+ <!-- output text from <link>text</link> -->
3372
3477
  <xsl:apply-templates/>
3373
3478
  </xsl:otherwise>
3374
3479
  </xsl:choose>
@@ -3484,6 +3589,7 @@
3484
3589
 
3485
3590
 
3486
3591
  <fo:inline xsl:use-attribute-sets="note-name-style">
3592
+
3487
3593
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3488
3594
  </fo:inline>
3489
3595
  <xsl:apply-templates/>
@@ -3509,7 +3615,9 @@
3509
3615
  </xsl:choose>
3510
3616
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3511
3617
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3618
+
3512
3619
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3620
+
3513
3621
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3514
3622
  </fo:inline>
3515
3623
  <xsl:apply-templates/>
@@ -3583,13 +3691,17 @@
3583
3691
  </xsl:call-template>
3584
3692
 
3585
3693
  <fo:block>
3694
+
3586
3695
  <xsl:apply-templates/>
3587
3696
  </fo:block>
3588
3697
  <xsl:call-template name="fn_display_figure"/>
3589
3698
  <xsl:for-each select="*[local-name() = 'note']">
3590
3699
  <xsl:call-template name="note"/>
3591
3700
  </xsl:for-each>
3592
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3701
+
3702
+
3703
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3704
+
3593
3705
  </fo:block-container>
3594
3706
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3595
3707
  <fo:block id="{@id}">
@@ -3702,21 +3814,249 @@
3702
3814
  <xsl:param name="height"/>
3703
3815
  <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; "/>
3704
3816
  <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; "/>
3817
+ </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">
3818
+ <xsl:param name="name"/>
3819
+
3820
+ <xsl:variable name="svg_content">
3821
+ <xsl:apply-templates select="." mode="svg_update"/>
3822
+ </xsl:variable>
3823
+
3824
+ <xsl:variable name="alt-text">
3825
+ <xsl:choose>
3826
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3827
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3828
+ </xsl:when>
3829
+ <xsl:when test="normalize-space($name) != ''">
3830
+ <xsl:value-of select="$name"/>
3831
+ </xsl:when>
3832
+ <xsl:otherwise>Figure</xsl:otherwise>
3833
+ </xsl:choose>
3834
+ </xsl:variable>
3835
+
3836
+ <xsl:choose>
3837
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3838
+ <fo:block>
3839
+ <xsl:variable name="width" select="@width"/>
3840
+ <xsl:variable name="height" select="@height"/>
3841
+
3842
+ <xsl:variable name="scale_x">
3843
+ <xsl:choose>
3844
+ <xsl:when test="$width &gt; $width_effective_px">
3845
+ <xsl:value-of select="$width_effective_px div $width"/>
3846
+ </xsl:when>
3847
+ <xsl:otherwise>1</xsl:otherwise>
3848
+ </xsl:choose>
3849
+ </xsl:variable>
3850
+
3851
+ <xsl:variable name="scale_y">
3852
+ <xsl:choose>
3853
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3854
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3855
+ </xsl:when>
3856
+ <xsl:otherwise>1</xsl:otherwise>
3857
+ </xsl:choose>
3858
+ </xsl:variable>
3859
+
3860
+ <xsl:variable name="scale">
3861
+ <xsl:choose>
3862
+ <xsl:when test="$scale_y != 1">
3863
+ <xsl:value-of select="$scale_x * $scale_y"/>
3864
+ </xsl:when>
3865
+ <xsl:otherwise>
3866
+ <xsl:value-of select="$scale_x"/>
3867
+ </xsl:otherwise>
3868
+ </xsl:choose>
3869
+ </xsl:variable>
3870
+
3871
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3872
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3873
+
3874
+ <fo:table table-layout="fixed" width="100%">
3875
+ <fo:table-column column-width="proportional-column-width(1)"/>
3876
+ <fo:table-column column-width="{$width_scale}px"/>
3877
+ <fo:table-column column-width="proportional-column-width(1)"/>
3878
+ <fo:table-body>
3879
+ <fo:table-row>
3880
+ <fo:table-cell column-number="2">
3881
+ <fo:block>
3882
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3883
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3884
+ <fo:block line-height="0" font-size="0">
3885
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3886
+ <xsl:call-template name="bookmark"/>
3887
+ </xsl:for-each>
3888
+ </fo:block>
3889
+ </xsl:if>
3890
+ <fo:block text-depth="0" line-height="0" font-size="0">
3891
+
3892
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3893
+ <xsl:attribute name="width">100%</xsl:attribute>
3894
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3895
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3896
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3897
+
3898
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3899
+ </fo:instream-foreign-object>
3900
+ </fo:block>
3901
+
3902
+ <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">
3903
+ <xsl:with-param name="scale" select="$scale"/>
3904
+ </xsl:apply-templates>
3905
+ </fo:block-container>
3906
+ </fo:block>
3907
+ </fo:table-cell>
3908
+ </fo:table-row>
3909
+ </fo:table-body>
3910
+ </fo:table>
3911
+ </fo:block>
3912
+
3913
+ </xsl:when>
3914
+ <xsl:otherwise>
3915
+ <fo:block xsl:use-attribute-sets="image-style">
3916
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3917
+ <xsl:attribute name="width">100%</xsl:attribute>
3918
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3919
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3920
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3921
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3922
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3923
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3924
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3925
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3926
+ </xsl:if>
3927
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3928
+ <xsl:copy-of select="$svg_content"/>
3929
+ </fo:instream-foreign-object>
3930
+ </fo:block>
3931
+ </xsl:otherwise>
3932
+ </xsl:choose>
3933
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3934
+ <xsl:copy>
3935
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3936
+ </xsl:copy>
3937
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3938
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3939
+ <xsl:value-of select="."/>
3940
+ </xsl:attribute>
3941
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3942
+ <xsl:variable name="svg_content" select="document(@src)"/>
3943
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3944
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3945
+ <xsl:call-template name="image_svg">
3946
+ <xsl:with-param name="name" select="$name"/>
3947
+ </xsl:call-template>
3948
+ </xsl:for-each>
3949
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3950
+ <xsl:copy>
3951
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3952
+ </xsl:copy>
3953
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3954
+ <xsl:apply-templates mode="svg_remove_a"/>
3955
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3956
+ <xsl:param name="scale"/>
3957
+ <xsl:variable name="dest">
3958
+ <xsl:choose>
3959
+ <xsl:when test="starts-with(@href, '#')">
3960
+ <xsl:value-of select="substring-after(@href, '#')"/>
3961
+ </xsl:when>
3962
+ <xsl:otherwise>
3963
+ <xsl:value-of select="@href"/>
3964
+ </xsl:otherwise>
3965
+ </xsl:choose>
3966
+ </xsl:variable>
3967
+ <xsl:for-each select="./*[local-name() = 'rect']">
3968
+ <xsl:call-template name="insertSVGMapLink">
3969
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3970
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3971
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3972
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3973
+ <xsl:with-param name="dest" select="$dest"/>
3974
+ </xsl:call-template>
3975
+ </xsl:for-each>
3976
+
3977
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3978
+ <xsl:variable name="points">
3979
+ <xsl:call-template name="split">
3980
+ <xsl:with-param name="pText" select="@points"/>
3981
+ </xsl:call-template>
3982
+ </xsl:variable>
3983
+ <xsl:variable name="x_coords">
3984
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3985
+ <xsl:sort select="." data-type="number"/>
3986
+ <x><xsl:value-of select="."/></x>
3987
+ </xsl:for-each>
3988
+ </xsl:variable>
3989
+ <xsl:variable name="y_coords">
3990
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3991
+ <xsl:sort select="." data-type="number"/>
3992
+ <y><xsl:value-of select="."/></y>
3993
+ </xsl:for-each>
3994
+ </xsl:variable>
3995
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3996
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3997
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3998
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3999
+ <xsl:call-template name="insertSVGMapLink">
4000
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4001
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4002
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4003
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4004
+ <xsl:with-param name="dest" select="$dest"/>
4005
+ </xsl:call-template>
4006
+ </xsl:for-each>
4007
+
4008
+ <xsl:for-each select="./*[local-name() = 'circle']">
4009
+ <xsl:call-template name="insertSVGMapLink">
4010
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4011
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4012
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4013
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4014
+ <xsl:with-param name="dest" select="$dest"/>
4015
+ </xsl:call-template>
4016
+ </xsl:for-each>
4017
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4018
+ <xsl:call-template name="insertSVGMapLink">
4019
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4020
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4021
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4022
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4023
+ <xsl:with-param name="dest" select="$dest"/>
4024
+ </xsl:call-template>
4025
+ </xsl:for-each>
4026
+ </xsl:template><xsl:template name="insertSVGMapLink">
4027
+ <xsl:param name="left"/>
4028
+ <xsl:param name="top"/>
4029
+ <xsl:param name="width"/>
4030
+ <xsl:param name="height"/>
4031
+ <xsl:param name="dest"/>
4032
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4033
+ <fo:block font-size="1pt">
4034
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4035
+ <fo:inline-container inline-progression-dimension="100%">
4036
+ <fo:block-container height="{$height - 1}px" width="100%">
4037
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4038
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4039
+ </xsl:if> -->
4040
+ <fo:block> </fo:block></fo:block-container>
4041
+ </fo:inline-container>
4042
+ </fo:basic-link>
4043
+ </fo:block>
4044
+ </fo:block-container>
3705
4045
  </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">
3706
4046
  <xsl:apply-templates mode="contents"/>
3707
4047
  <xsl:text> </xsl:text>
3708
4048
  </xsl:template><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="bookmarks">
3709
4049
  <xsl:apply-templates mode="bookmarks"/>
3710
4050
  <xsl:text> </xsl:text>
3711
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
4051
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
3712
4052
  <xsl:value-of select="."/>
3713
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
4053
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3714
4054
  <xsl:value-of select="."/>
3715
4055
  </xsl:template><xsl:template match="node()" mode="contents">
3716
4056
  <xsl:apply-templates mode="contents"/>
3717
4057
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3718
4058
  <xsl:apply-templates mode="bookmarks"/>
3719
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
4059
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3720
4060
  <xsl:apply-templates select="."/>
3721
4061
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3722
4062
  <xsl:apply-templates mode="bookmarks"/>
@@ -3730,28 +4070,39 @@
3730
4070
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3731
4071
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3732
4072
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4073
+ <xsl:if test="@bundle = 'true'">
4074
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4075
+ </xsl:if>
3733
4076
  <fo:bookmark-title>
3734
- <xsl:variable name="bookmark-title_">
3735
- <xsl:call-template name="getLangVersion">
3736
- <xsl:with-param name="lang" select="@lang"/>
3737
- <xsl:with-param name="doctype" select="@doctype"/>
3738
- <xsl:with-param name="title" select="@title-part"/>
3739
- </xsl:call-template>
3740
- </xsl:variable>
3741
4077
  <xsl:choose>
3742
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3743
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3744
- </xsl:when>
3745
- <xsl:otherwise>
4078
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4079
+ <xsl:variable name="bookmark-title_">
4080
+ <xsl:call-template name="getLangVersion">
4081
+ <xsl:with-param name="lang" select="@lang"/>
4082
+ <xsl:with-param name="doctype" select="@doctype"/>
4083
+ <xsl:with-param name="title" select="@title-part"/>
4084
+ </xsl:call-template>
4085
+ </xsl:variable>
3746
4086
  <xsl:choose>
3747
- <xsl:when test="@lang = 'en'">English</xsl:when>
3748
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3749
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3750
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4087
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4088
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4089
+ </xsl:when>
4090
+ <xsl:otherwise>
4091
+ <xsl:choose>
4092
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4093
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4094
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4095
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4096
+ </xsl:choose>
4097
+ </xsl:otherwise>
3751
4098
  </xsl:choose>
4099
+ </xsl:when>
4100
+ <xsl:otherwise>
4101
+ <xsl:value-of select="@title-part"/>
3752
4102
  </xsl:otherwise>
3753
4103
  </xsl:choose>
3754
4104
  </fo:bookmark-title>
4105
+
3755
4106
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3756
4107
 
3757
4108
  <xsl:call-template name="insertFigureBookmarks">
@@ -3861,20 +4212,28 @@
3861
4212
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3862
4213
  </xsl:choose>
3863
4214
  </xsl:template><xsl:template match="item" mode="bookmark">
3864
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3865
- <fo:bookmark-title>
3866
- <xsl:if test="@section != ''">
3867
- <xsl:value-of select="@section"/>
3868
- <xsl:text> </xsl:text>
3869
- </xsl:if>
3870
- <xsl:value-of select="normalize-space(title)"/>
3871
- </fo:bookmark-title>
3872
- <xsl:apply-templates mode="bookmark"/>
3873
- </fo:bookmark>
4215
+ <xsl:choose>
4216
+ <xsl:when test="@id != ''">
4217
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4218
+ <fo:bookmark-title>
4219
+ <xsl:if test="@section != ''">
4220
+ <xsl:value-of select="@section"/>
4221
+ <xsl:text> </xsl:text>
4222
+ </xsl:if>
4223
+ <xsl:value-of select="normalize-space(title)"/>
4224
+ </fo:bookmark-title>
4225
+ <xsl:apply-templates mode="bookmark"/>
4226
+ </fo:bookmark>
4227
+ </xsl:when>
4228
+ <xsl:otherwise>
4229
+ <xsl:apply-templates mode="bookmark"/>
4230
+ </xsl:otherwise>
4231
+ </xsl:choose>
3874
4232
  </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">
3875
4233
  <xsl:if test="normalize-space() != ''">
3876
4234
  <fo:block xsl:use-attribute-sets="figure-name-style">
3877
4235
 
4236
+
3878
4237
  <xsl:apply-templates/>
3879
4238
  </fo:block>
3880
4239
  </xsl:if>
@@ -3926,6 +4285,8 @@
3926
4285
  </fo:list-item-body>
3927
4286
  </fo:list-item>
3928
4287
  </fo:list-block>
4288
+ </xsl:template><xsl:template name="extractSection">
4289
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3929
4290
  </xsl:template><xsl:template name="extractTitle">
3930
4291
  <xsl:choose>
3931
4292
  <xsl:when test="*[local-name() = 'tab']">
@@ -3952,6 +4313,8 @@
3952
4313
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3953
4314
 
3954
4315
  <fo:block-container margin-left="0mm">
4316
+ <xsl:copy-of select="@id"/>
4317
+
3955
4318
  <xsl:if test="parent::*[local-name() = 'note']">
3956
4319
  <xsl:attribute name="margin-left">
3957
4320
  <xsl:choose>
@@ -3962,7 +4325,9 @@
3962
4325
 
3963
4326
  </xsl:if>
3964
4327
  <fo:block-container margin-left="0mm">
3965
-
4328
+
4329
+
4330
+
3966
4331
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3967
4332
  <xsl:variable name="_font-size">
3968
4333
 
@@ -3973,6 +4338,7 @@
3973
4338
 
3974
4339
 
3975
4340
 
4341
+
3976
4342
 
3977
4343
 
3978
4344
 
@@ -3990,10 +4356,14 @@
3990
4356
  </xsl:choose>
3991
4357
  </xsl:attribute>
3992
4358
  </xsl:if>
3993
- <xsl:apply-templates/>
3994
- </fo:block>
4359
+
4360
+ <xsl:apply-templates/>
4361
+ </fo:block>
4362
+
4363
+
3995
4364
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3996
4365
 
4366
+
3997
4367
  </fo:block-container>
3998
4368
  </fo:block-container>
3999
4369
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4236,6 +4606,7 @@
4236
4606
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4237
4607
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4238
4608
 
4609
+
4239
4610
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4240
4611
 
4241
4612
  <xsl:variable name="element">
@@ -4303,7 +4674,7 @@
4303
4674
  </fo:inline>
4304
4675
  </xsl:otherwise>
4305
4676
  </xsl:choose>
4306
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4677
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
4307
4678
  <fo:block xsl:use-attribute-sets="termsource-style">
4308
4679
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
4309
4680
  <xsl:variable name="termsource_text">
@@ -4312,13 +4683,15 @@
4312
4683
 
4313
4684
  <xsl:choose>
4314
4685
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4315
- <xsl:apply-templates/>
4686
+ <!-- <xsl:apply-templates /> -->
4687
+ <xsl:copy-of select="$termsource_text"/>
4316
4688
  </xsl:when>
4317
4689
  <xsl:otherwise>
4318
4690
 
4319
4691
  <xsl:text>[</xsl:text>
4320
4692
 
4321
- <xsl:apply-templates/>
4693
+ <!-- <xsl:apply-templates /> -->
4694
+ <xsl:copy-of select="$termsource_text"/>
4322
4695
 
4323
4696
  <xsl:text>]</xsl:text>
4324
4697
 
@@ -4329,20 +4702,29 @@
4329
4702
  <xsl:if test="normalize-space() != ''">
4330
4703
  <xsl:value-of select="."/>
4331
4704
  </xsl:if>
4332
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4705
+ </xsl:template><xsl:variable name="localized.source">
4706
+ <xsl:call-template name="getLocalizedString">
4707
+ <xsl:with-param name="key">source</xsl:with-param>
4708
+ </xsl:call-template>
4709
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4333
4710
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4711
+ <xsl:if test="normalize-space(@citeas) = ''">
4712
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4713
+ </xsl:if>
4334
4714
 
4335
4715
  <fo:inline>
4336
4716
 
4337
4717
 
4338
4718
 
4339
4719
 
4720
+
4721
+
4340
4722
  <xsl:call-template name="getTitle">
4341
4723
  <xsl:with-param name="name" select="'title-source'"/>
4342
4724
  </xsl:call-template>
4725
+ <xsl:text>: </xsl:text>
4343
4726
 
4344
4727
 
4345
- <xsl:text>: </xsl:text>
4346
4728
  </fo:inline>
4347
4729
 
4348
4730
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -4415,6 +4797,7 @@
4415
4797
  </xsl:if>
4416
4798
 
4417
4799
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4800
+
4418
4801
  <xsl:if test="normalize-space(@citeas) = ''">
4419
4802
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4420
4803
  </xsl:if>
@@ -4458,6 +4841,7 @@
4458
4841
 
4459
4842
 
4460
4843
 
4844
+
4461
4845
  <xsl:choose>
4462
4846
  <xsl:when test="$depth &gt;= 5"/>
4463
4847
  <xsl:when test="$depth &gt;= 4">5</xsl:when>
@@ -4557,7 +4941,6 @@
4557
4941
 
4558
4942
 
4559
4943
 
4560
-
4561
4944
  <xsl:apply-templates/>
4562
4945
  </fo:block>
4563
4946
 
@@ -4574,6 +4957,7 @@
4574
4957
  <xsl:call-template name="setId"/>
4575
4958
 
4576
4959
 
4960
+
4577
4961
  <xsl:apply-templates/>
4578
4962
  </fo:block>
4579
4963
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4600,7 +4984,7 @@
4600
4984
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4601
4985
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4602
4986
  <xsl:choose>
4603
- <xsl:when test="parent::*[local-name() = 'note']">
4987
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4604
4988
  <fo:block-container>
4605
4989
  <xsl:attribute name="margin-left">
4606
4990
  <xsl:choose>
@@ -4610,6 +4994,7 @@
4610
4994
  </xsl:attribute>
4611
4995
 
4612
4996
 
4997
+
4613
4998
  <fo:block-container margin-left="0mm">
4614
4999
  <fo:block>
4615
5000
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4951,21 +5336,25 @@
4951
5336
 
4952
5337
 
4953
5338
 
5339
+
5340
+
5341
+
5342
+
4954
5343
  </xsl:template><xsl:template name="processBibitemDocId">
4955
5344
  <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')]"/>
4956
5345
  <xsl:choose>
4957
5346
  <xsl:when test="normalize-space($_doc_ident) != ''">
4958
- <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"/>
5347
+ <!-- <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"/>
4959
5348
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4960
5349
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4961
- </xsl:if>
5350
+ </xsl:if> -->
4962
5351
  <xsl:value-of select="$_doc_ident"/>
4963
5352
  </xsl:when>
4964
5353
  <xsl:otherwise>
4965
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5354
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4966
5355
  <xsl:if test="$type != ''">
4967
5356
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4968
- </xsl:if>
5357
+ </xsl:if> -->
4969
5358
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4970
5359
  </xsl:otherwise>
4971
5360
  </xsl:choose>
@@ -5007,6 +5396,70 @@
5007
5396
  <xsl:value-of select="substring(.,1,1)"/>
5008
5397
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5009
5398
  <fo:inline><xsl:apply-templates/></fo:inline>
5399
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
5400
+ <fo:block>
5401
+ <xsl:apply-templates/>
5402
+ </fo:block>
5403
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
5404
+ <fo:inline><xsl:apply-templates/></fo:inline>
5405
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
5406
+ <fo:inline>
5407
+ <xsl:call-template name="text_input"/>
5408
+ </fo:inline>
5409
+ </xsl:template><xsl:template name="text_input">
5410
+ <xsl:variable name="count">
5411
+ <xsl:choose>
5412
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
5413
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
5414
+ <xsl:otherwise>10</xsl:otherwise>
5415
+ </xsl:choose>
5416
+ </xsl:variable>
5417
+ <xsl:call-template name="repeat">
5418
+ <xsl:with-param name="char" select="'_'"/>
5419
+ <xsl:with-param name="count" select="$count"/>
5420
+ </xsl:call-template>
5421
+ <xsl:text> </xsl:text>
5422
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
5423
+ <xsl:variable name="caption">
5424
+ <xsl:choose>
5425
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
5426
+ <xsl:otherwise>BUTTON</xsl:otherwise>
5427
+ </xsl:choose>
5428
+ </xsl:variable>
5429
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
5430
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
5431
+ <fo:inline padding-right="1mm">
5432
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5433
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5434
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5435
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5436
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5437
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5438
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
5439
+ </svg>
5440
+ </fo:instream-foreign-object>
5441
+ </fo:inline>
5442
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5443
+ <fo:inline padding-right="1mm">
5444
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5445
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5446
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5447
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5448
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5449
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5450
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5451
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5452
+ </svg>
5453
+ </fo:instream-foreign-object>
5454
+ </fo:inline>
5455
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5456
+ <fo:inline>
5457
+ <xsl:call-template name="text_input"/>
5458
+ </fo:inline>
5459
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5460
+ <fo:block-container border="1pt solid black" width="50%">
5461
+ <fo:block> </fo:block>
5462
+ </fo:block-container>
5010
5463
  </xsl:template><xsl:template name="convertDate">
5011
5464
  <xsl:param name="date"/>
5012
5465
  <xsl:param name="format" select="'short'"/>
@@ -5214,6 +5667,9 @@
5214
5667
  <xsl:when test="parent::*[local-name() = 'preface']">
5215
5668
  <xsl:value-of select="$level_total - 1"/>
5216
5669
  </xsl:when>
5670
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5671
+ <xsl:value-of select="$level_total - 1"/>
5672
+ </xsl:when>
5217
5673
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5218
5674
  <xsl:value-of select="$level_total - 2"/>
5219
5675
  </xsl:when>
@@ -5274,6 +5730,7 @@
5274
5730
 
5275
5731
 
5276
5732
 
5733
+
5277
5734
  <xsl:value-of select="document('')//*/namespace::ogc"/>
5278
5735
 
5279
5736
 
@@ -5338,17 +5795,29 @@
5338
5795
  </xsl:call-template>
5339
5796
  </xsl:if>
5340
5797
  </xsl:template><xsl:template name="getLocalizedString">
5341
- <xsl:param name="key"/>
5798
+ <xsl:param name="key"/>
5342
5799
 
5343
5800
  <xsl:variable name="curr_lang">
5344
5801
  <xsl:call-template name="getLang"/>
5345
5802
  </xsl:variable>
5346
5803
 
5804
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5805
+
5347
5806
  <xsl:choose>
5807
+ <xsl:when test="$data_value != ''">
5808
+ <xsl:value-of select="$data_value"/>
5809
+ </xsl:when>
5348
5810
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5349
5811
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5350
5812
  </xsl:when>
5351
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5813
+ <xsl:otherwise>
5814
+ <xsl:variable name="key_">
5815
+ <xsl:call-template name="capitalize">
5816
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5817
+ </xsl:call-template>
5818
+ </xsl:variable>
5819
+ <xsl:value-of select="$key_"/>
5820
+ </xsl:otherwise>
5352
5821
  </xsl:choose>
5353
5822
 
5354
5823
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -5391,4 +5860,14 @@
5391
5860
  <xsl:value-of select="$align"/>
5392
5861
  </xsl:when>
5393
5862
  </xsl:choose>
5863
+ </xsl:template><xsl:template name="setTextAlignment">
5864
+ <xsl:param name="default">left</xsl:param>
5865
+ <xsl:attribute name="text-align">
5866
+ <xsl:choose>
5867
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5868
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5869
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5870
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5871
+ </xsl:choose>
5872
+ </xsl:attribute>
5394
5873
  </xsl:template></xsl:stylesheet>