metanorma-un 0.6.3 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,12 @@
11
11
 
12
12
 
13
13
 
14
- <xsl:variable name="pageWidth" select="'210mm'"/>
15
- <xsl:variable name="pageHeight" select="'297mm'"/>
14
+ <xsl:variable name="pageWidth" select="210"/>
15
+ <xsl:variable name="pageHeight" select="297"/>
16
+ <xsl:variable name="marginLeftRight1" select="40"/>
17
+ <xsl:variable name="marginLeftRight2" select="40"/>
18
+ <xsl:variable name="marginTop" select="30"/>
19
+ <xsl:variable name="marginBottom" select="40"/>
16
20
 
17
21
  <xsl:variable name="debug">false</xsl:variable>
18
22
 
@@ -42,7 +46,7 @@
42
46
  <fo:root font-family="Times New Roman, STIX Two Math, Source Han Sans" font-size="10pt" xml:lang="{$lang}">
43
47
  <fo:layout-master-set>
44
48
  <!-- Cover page -->
45
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
49
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
46
50
  <fo:region-body margin-top="17.5mm" margin-bottom="10mm" margin-left="20mm" margin-right="20mm"/>
47
51
  <fo:region-before extent="17.5mm"/>
48
52
  <fo:region-after extent="10mm"/>
@@ -51,20 +55,20 @@
51
55
  </fo:simple-page-master>
52
56
 
53
57
  <!-- Document odd pages -->
54
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
55
- <fo:region-body margin-top="30mm" margin-bottom="40mm" margin-left="40mm" margin-right="40mm"/>
58
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
59
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
56
60
  <fo:region-before region-name="header-odd" extent="26mm"/>
57
- <fo:region-after region-name="footer-odd" extent="40mm"/>
58
- <fo:region-start region-name="left-region" extent="40mm"/>
59
- <fo:region-end region-name="right-region" extent="40mm"/>
61
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
62
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
63
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
60
64
  </fo:simple-page-master>
61
65
  <!-- Document even pages -->
62
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
63
- <fo:region-body margin-top="30mm" margin-bottom="40mm" margin-left="40mm" margin-right="40mm"/>
66
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
67
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
64
68
  <fo:region-before region-name="header-even" extent="26mm"/>
65
- <fo:region-after region-name="footer-even" extent="40mm"/>
66
- <fo:region-start region-name="left-region" extent="40mm"/>
67
- <fo:region-end region-name="right-region" extent="40mm"/>
69
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
70
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
71
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
68
72
  </fo:simple-page-master>
69
73
  <fo:page-sequence-master master-name="document">
70
74
  <fo:repeatable-page-master-alternatives>
@@ -1069,103 +1073,6 @@
1069
1073
  </xsl:template>
1070
1074
 
1071
1075
 
1072
- <xsl:template name="number-to-words">
1073
- <xsl:param name="number"/>
1074
- <xsl:param name="first"/>
1075
- <xsl:if test="$number != ''">
1076
- <xsl:variable name="words">
1077
- <words>
1078
- <word cardinal="1">one-</word>
1079
- <word ordinal="1">first </word>
1080
- <word cardinal="2">two-</word>
1081
- <word ordinal="2">second </word>
1082
- <word cardinal="3">three-</word>
1083
- <word ordinal="3">third </word>
1084
- <word cardinal="4">four-</word>
1085
- <word ordinal="4">fourth </word>
1086
- <word cardinal="5">five-</word>
1087
- <word ordinal="5">fifth </word>
1088
- <word cardinal="6">six-</word>
1089
- <word ordinal="6">sixth </word>
1090
- <word cardinal="7">seven-</word>
1091
- <word ordinal="7">seventh </word>
1092
- <word cardinal="8">eight-</word>
1093
- <word ordinal="8">eighth </word>
1094
- <word cardinal="9">nine-</word>
1095
- <word ordinal="9">ninth </word>
1096
- <word ordinal="10">tenth </word>
1097
- <word ordinal="11">eleventh </word>
1098
- <word ordinal="12">twelfth </word>
1099
- <word ordinal="13">thirteenth </word>
1100
- <word ordinal="14">fourteenth </word>
1101
- <word ordinal="15">fifteenth </word>
1102
- <word ordinal="16">sixteenth </word>
1103
- <word ordinal="17">seventeenth </word>
1104
- <word ordinal="18">eighteenth </word>
1105
- <word ordinal="19">nineteenth </word>
1106
- <word cardinal="20">twenty-</word>
1107
- <word ordinal="20">twentieth </word>
1108
- <word cardinal="30">thirty-</word>
1109
- <word ordinal="30">thirtieth </word>
1110
- <word cardinal="40">forty-</word>
1111
- <word ordinal="40">fortieth </word>
1112
- <word cardinal="50">fifty-</word>
1113
- <word ordinal="50">fiftieth </word>
1114
- <word cardinal="60">sixty-</word>
1115
- <word ordinal="60">sixtieth </word>
1116
- <word cardinal="70">seventy-</word>
1117
- <word ordinal="70">seventieth </word>
1118
- <word cardinal="80">eighty-</word>
1119
- <word ordinal="80">eightieth </word>
1120
- <word cardinal="90">ninety-</word>
1121
- <word ordinal="90">ninetieth </word>
1122
- <word cardinal="100">hundred-</word>
1123
- <word ordinal="100">hundredth </word>
1124
- </words>
1125
- </xsl:variable>
1126
-
1127
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
1128
-
1129
- <xsl:variable name="value">
1130
- <xsl:choose>
1131
- <xsl:when test="$ordinal != ''">
1132
- <xsl:value-of select="$ordinal"/>
1133
- </xsl:when>
1134
- <xsl:otherwise>
1135
- <xsl:choose>
1136
- <xsl:when test="$number &lt; 100">
1137
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
1138
- <xsl:variable name="digit" select="substring($number,2)"/>
1139
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
1140
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
1141
- </xsl:when>
1142
- <xsl:otherwise>
1143
- <!-- more 100 -->
1144
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
1145
- <xsl:variable name="digits" select="number(substring($number,2))"/>
1146
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
1147
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
1148
- <xsl:call-template name="number-to-words">
1149
- <xsl:with-param name="number" select="$digits"/>
1150
- </xsl:call-template>
1151
- </xsl:otherwise>
1152
- </xsl:choose>
1153
- </xsl:otherwise>
1154
- </xsl:choose>
1155
- </xsl:variable>
1156
- <xsl:choose>
1157
- <xsl:when test="$first = 'true'">
1158
- <xsl:call-template name="capitalize">
1159
- <xsl:with-param name="str" select="$value"/>
1160
- </xsl:call-template>
1161
- </xsl:when>
1162
- <xsl:otherwise>
1163
- <xsl:value-of select="$value"/>
1164
- </xsl:otherwise>
1165
- </xsl:choose>
1166
- </xsl:if>
1167
- </xsl:template>
1168
-
1169
1076
  <!-- convert YYYY-MM-DD to (Month YYYY) -->
1170
1077
  <xsl:template name="formatDate">
1171
1078
  <xsl:param name="date"/>
@@ -1360,6 +1267,7 @@
1360
1267
 
1361
1268
 
1362
1269
 
1270
+
1363
1271
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1364
1272
  <xsl:attribute name="white-space">pre</xsl:attribute>
1365
1273
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1405,7 +1313,7 @@
1405
1313
 
1406
1314
 
1407
1315
 
1408
-
1316
+
1409
1317
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1410
1318
 
1411
1319
 
@@ -1418,6 +1326,7 @@
1418
1326
 
1419
1327
 
1420
1328
 
1329
+
1421
1330
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1422
1331
 
1423
1332
 
@@ -1434,9 +1343,7 @@
1434
1343
 
1435
1344
 
1436
1345
 
1437
-
1438
-
1439
-
1346
+
1440
1347
 
1441
1348
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1442
1349
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1471,6 +1378,7 @@
1471
1378
 
1472
1379
 
1473
1380
 
1381
+
1474
1382
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1475
1383
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1476
1384
 
@@ -1493,6 +1401,9 @@
1493
1401
 
1494
1402
 
1495
1403
 
1404
+
1405
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1406
+
1496
1407
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1497
1408
 
1498
1409
 
@@ -1506,13 +1417,16 @@
1506
1417
 
1507
1418
 
1508
1419
 
1420
+
1509
1421
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1510
1422
 
1511
1423
 
1512
1424
 
1513
1425
 
1426
+
1514
1427
  <xsl:attribute name="color">blue</xsl:attribute>
1515
1428
 
1429
+
1516
1430
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1517
1431
 
1518
1432
 
@@ -1531,6 +1445,7 @@
1531
1445
 
1532
1446
 
1533
1447
 
1448
+
1534
1449
  </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">
1535
1450
 
1536
1451
 
@@ -1573,10 +1488,12 @@
1573
1488
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
1574
1489
 
1575
1490
 
1491
+
1576
1492
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1577
1493
 
1578
1494
 
1579
1495
 
1496
+
1580
1497
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1581
1498
 
1582
1499
 
@@ -1596,10 +1513,12 @@
1596
1513
 
1597
1514
 
1598
1515
 
1516
+
1599
1517
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1600
1518
 
1601
1519
 
1602
1520
 
1521
+
1603
1522
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1604
1523
 
1605
1524
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1618,6 +1537,7 @@
1618
1537
 
1619
1538
 
1620
1539
 
1540
+
1621
1541
 
1622
1542
  <xsl:attribute name="text-align">center</xsl:attribute>
1623
1543
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1670,8 +1590,10 @@
1670
1590
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1671
1591
 
1672
1592
 
1593
+
1673
1594
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1674
1595
 
1596
+
1675
1597
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1676
1598
 
1677
1599
 
@@ -1694,6 +1616,8 @@
1694
1616
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1695
1617
 
1696
1618
 
1619
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1620
+
1697
1621
  </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">
1698
1622
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1699
1623
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1704,14 +1628,15 @@
1704
1628
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1705
1629
 
1706
1630
  <!-- Normative references -->
1707
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1631
+ <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"/>
1708
1632
  <!-- Terms and definitions -->
1709
1633
  <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"/>
1710
1634
  <!-- Another main sections -->
1711
1635
  <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"/>
1712
1636
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1713
1637
  <!-- Bibliography -->
1714
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1638
+ <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"/>
1639
+
1715
1640
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1716
1641
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1717
1642
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1747,11 +1672,11 @@
1747
1672
  <xsl:variable name="table">
1748
1673
 
1749
1674
  <xsl:variable name="simple-table">
1750
- <xsl:call-template name="getSimpleTable"/>
1675
+ <xsl:call-template name="getSimpleTable"/>
1751
1676
  </xsl:variable>
1752
1677
 
1753
1678
  <!-- <xsl:if test="$namespace = 'bipm'">
1754
- <fo:block>&#xA0;</fo:block>
1679
+ <fo:block>&#xA0;</fo:block>
1755
1680
  </xsl:if> -->
1756
1681
 
1757
1682
  <!-- $namespace = 'iso' or -->
@@ -1863,6 +1788,7 @@
1863
1788
 
1864
1789
 
1865
1790
 
1791
+
1866
1792
  </xsl:variable>
1867
1793
 
1868
1794
 
@@ -2001,6 +1927,9 @@
2001
1927
  <fo:block xsl:use-attribute-sets="table-name-style">
2002
1928
 
2003
1929
 
1930
+
1931
+
1932
+
2004
1933
  <xsl:choose>
2005
1934
  <xsl:when test="$continued = 'true'">
2006
1935
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -2148,6 +2077,7 @@
2148
2077
  <!-- font-weight="bold" -->
2149
2078
  <fo:table-header>
2150
2079
 
2080
+
2151
2081
  <xsl:apply-templates/>
2152
2082
  </fo:table-header>
2153
2083
  </xsl:template><xsl:template name="table-header-title">
@@ -2298,6 +2228,7 @@
2298
2228
 
2299
2229
 
2300
2230
 
2231
+
2301
2232
  <!-- fn will be processed inside 'note' processing -->
2302
2233
 
2303
2234
 
@@ -2306,6 +2237,10 @@
2306
2237
 
2307
2238
 
2308
2239
 
2240
+
2241
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2242
+
2243
+
2309
2244
  <!-- except gb -->
2310
2245
 
2311
2246
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2331,6 +2266,10 @@
2331
2266
  <!-- fn processing -->
2332
2267
  <xsl:call-template name="fn_display"/>
2333
2268
 
2269
+
2270
+ <!-- for PAS display Notes after footnotes -->
2271
+
2272
+
2334
2273
  </fo:table-cell>
2335
2274
  </fo:table-row>
2336
2275
  </fo:table-body>
@@ -2388,6 +2327,7 @@
2388
2327
  <xsl:if test="$parent-name = 'tfoot'">
2389
2328
 
2390
2329
 
2330
+
2391
2331
  </xsl:if>
2392
2332
 
2393
2333
 
@@ -2397,6 +2337,10 @@
2397
2337
 
2398
2338
 
2399
2339
 
2340
+
2341
+
2342
+
2343
+
2400
2344
  <!-- <xsl:if test="$namespace = 'bipm'">
2401
2345
  <xsl:attribute name="height">8mm</xsl:attribute>
2402
2346
  </xsl:if> -->
@@ -2436,6 +2380,7 @@
2436
2380
 
2437
2381
 
2438
2382
 
2383
+
2439
2384
  <xsl:if test="$lang = 'ar'">
2440
2385
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2441
2386
  </xsl:if>
@@ -2489,6 +2434,7 @@
2489
2434
 
2490
2435
 
2491
2436
 
2437
+
2492
2438
  <xsl:attribute name="display-align">before</xsl:attribute>
2493
2439
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
2494
2440
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
@@ -2499,6 +2445,9 @@
2499
2445
 
2500
2446
 
2501
2447
 
2448
+
2449
+
2450
+
2502
2451
  <xsl:if test=".//*[local-name() = 'table']">
2503
2452
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2504
2453
  </xsl:if>
@@ -2528,8 +2477,14 @@
2528
2477
 
2529
2478
 
2530
2479
 
2480
+
2481
+
2482
+ <!-- Table's note name (NOTE, for example) -->
2483
+
2531
2484
  <fo:inline padding-right="2mm">
2532
2485
 
2486
+
2487
+
2533
2488
 
2534
2489
 
2535
2490
  <xsl:if test="@type = 'source' or @type = 'abbreviation'">
@@ -2547,6 +2502,8 @@
2547
2502
 
2548
2503
  </fo:inline>
2549
2504
 
2505
+
2506
+
2550
2507
  <xsl:apply-templates mode="process"/>
2551
2508
  </fo:block>
2552
2509
 
@@ -2566,6 +2523,8 @@
2566
2523
  <xsl:variable name="reference" select="@reference"/>
2567
2524
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2568
2525
  <fo:block margin-bottom="12pt">
2526
+
2527
+
2569
2528
 
2570
2529
 
2571
2530
 
@@ -2581,9 +2540,11 @@
2581
2540
 
2582
2541
 
2583
2542
 
2543
+
2584
2544
  <xsl:value-of select="@reference"/>
2585
2545
 
2586
2546
 
2547
+
2587
2548
  </fo:inline>
2588
2549
  <fo:inline>
2589
2550
 
@@ -2724,11 +2685,16 @@
2724
2685
 
2725
2686
 
2726
2687
 
2688
+
2689
+
2690
+
2691
+
2727
2692
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2728
2693
 
2729
2694
 
2730
2695
  <xsl:value-of select="@reference"/>
2731
2696
 
2697
+
2732
2698
  </fo:basic-link>
2733
2699
  </fo:inline>
2734
2700
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2815,6 +2781,7 @@
2815
2781
 
2816
2782
 
2817
2783
 
2784
+
2818
2785
  <xsl:variable name="title-key">
2819
2786
 
2820
2787
 
@@ -3025,6 +2992,7 @@
3025
2992
 
3026
2993
  <fo:table-row>
3027
2994
 
2995
+
3028
2996
  <fo:table-cell>
3029
2997
 
3030
2998
  <fo:block margin-top="6pt">
@@ -3040,6 +3008,7 @@
3040
3008
 
3041
3009
 
3042
3010
 
3011
+
3043
3012
  <xsl:apply-templates/>
3044
3013
  <!-- <xsl:if test="$namespace = 'gb'">
3045
3014
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3096,6 +3065,8 @@
3096
3065
 
3097
3066
  <xsl:apply-templates/>
3098
3067
  </fo:inline>
3068
+ </xsl:template><xsl:template match="*[local-name()='padding']">
3069
+ <fo:inline padding-right="{@value}"> </fo:inline>
3099
3070
  </xsl:template><xsl:template match="*[local-name()='sup']">
3100
3071
  <fo:inline font-size="80%" vertical-align="super">
3101
3072
  <xsl:apply-templates/>
@@ -3585,9 +3556,27 @@
3585
3556
  <xsl:copy>
3586
3557
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3587
3558
  </xsl:copy>
3588
- <mathml:mspace width="0.5ex"/>
3559
+ <xsl:choose>
3560
+ <!-- if in msub, then don't add space -->
3561
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3562
+ <!-- if next char in digit, don't add space -->
3563
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3564
+ <xsl:otherwise>
3565
+ <mathml:mspace width="0.5ex"/>
3566
+ </xsl:otherwise>
3567
+ </xsl:choose>
3589
3568
  </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">
3590
3569
  <xsl:variable name="target">
3570
+ <xsl:choose>
3571
+ <xsl:when test="@updatetype = 'true'">
3572
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3573
+ </xsl:when>
3574
+ <xsl:otherwise>
3575
+ <xsl:value-of select="normalize-space(@target)"/>
3576
+ </xsl:otherwise>
3577
+ </xsl:choose>
3578
+ </xsl:variable>
3579
+ <xsl:variable name="target_text">
3591
3580
  <xsl:choose>
3592
3581
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3593
3582
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3599,20 +3588,22 @@
3599
3588
  </xsl:variable>
3600
3589
  <fo:inline xsl:use-attribute-sets="link-style">
3601
3590
 
3591
+
3592
+
3602
3593
  <xsl:choose>
3603
- <xsl:when test="$target = ''">
3594
+ <xsl:when test="$target_text = ''">
3604
3595
  <xsl:apply-templates/>
3605
3596
  </xsl:when>
3606
3597
  <xsl:otherwise>
3607
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3598
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3608
3599
  <xsl:choose>
3609
3600
  <xsl:when test="normalize-space(.) = ''">
3610
- <!-- <xsl:value-of select="$target"/> -->
3611
3601
  <xsl:call-template name="add-zero-spaces-link-java">
3612
- <xsl:with-param name="text" select="$target"/>
3602
+ <xsl:with-param name="text" select="$target_text"/>
3613
3603
  </xsl:call-template>
3614
3604
  </xsl:when>
3615
3605
  <xsl:otherwise>
3606
+ <!-- output text from <link>text</link> -->
3616
3607
  <xsl:apply-templates/>
3617
3608
  </xsl:otherwise>
3618
3609
  </xsl:choose>
@@ -3707,6 +3698,7 @@
3707
3698
 
3708
3699
 
3709
3700
 
3701
+
3710
3702
  <fo:block-container margin-left="0mm">
3711
3703
 
3712
3704
 
@@ -3759,6 +3751,7 @@
3759
3751
  </xsl:choose>
3760
3752
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3761
3753
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3754
+
3762
3755
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3763
3756
 
3764
3757
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3836,6 +3829,7 @@
3836
3829
  </xsl:call-template>
3837
3830
 
3838
3831
  <fo:block>
3832
+
3839
3833
  <xsl:apply-templates/>
3840
3834
  </fo:block>
3841
3835
  <xsl:call-template name="fn_display_figure"/>
@@ -3958,6 +3952,234 @@
3958
3952
  <xsl:param name="height"/>
3959
3953
  <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; "/>
3960
3954
  <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; "/>
3955
+ </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">
3956
+ <xsl:param name="name"/>
3957
+
3958
+ <xsl:variable name="svg_content">
3959
+ <xsl:apply-templates select="." mode="svg_update"/>
3960
+ </xsl:variable>
3961
+
3962
+ <xsl:variable name="alt-text">
3963
+ <xsl:choose>
3964
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3965
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3966
+ </xsl:when>
3967
+ <xsl:when test="normalize-space($name) != ''">
3968
+ <xsl:value-of select="$name"/>
3969
+ </xsl:when>
3970
+ <xsl:otherwise>Figure</xsl:otherwise>
3971
+ </xsl:choose>
3972
+ </xsl:variable>
3973
+
3974
+ <xsl:choose>
3975
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3976
+ <fo:block>
3977
+ <xsl:variable name="width" select="@width"/>
3978
+ <xsl:variable name="height" select="@height"/>
3979
+
3980
+ <xsl:variable name="scale_x">
3981
+ <xsl:choose>
3982
+ <xsl:when test="$width &gt; $width_effective_px">
3983
+ <xsl:value-of select="$width_effective_px div $width"/>
3984
+ </xsl:when>
3985
+ <xsl:otherwise>1</xsl:otherwise>
3986
+ </xsl:choose>
3987
+ </xsl:variable>
3988
+
3989
+ <xsl:variable name="scale_y">
3990
+ <xsl:choose>
3991
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3992
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3993
+ </xsl:when>
3994
+ <xsl:otherwise>1</xsl:otherwise>
3995
+ </xsl:choose>
3996
+ </xsl:variable>
3997
+
3998
+ <xsl:variable name="scale">
3999
+ <xsl:choose>
4000
+ <xsl:when test="$scale_y != 1">
4001
+ <xsl:value-of select="$scale_x * $scale_y"/>
4002
+ </xsl:when>
4003
+ <xsl:otherwise>
4004
+ <xsl:value-of select="$scale_x"/>
4005
+ </xsl:otherwise>
4006
+ </xsl:choose>
4007
+ </xsl:variable>
4008
+
4009
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
4010
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
4011
+
4012
+ <fo:table table-layout="fixed" width="100%">
4013
+ <fo:table-column column-width="proportional-column-width(1)"/>
4014
+ <fo:table-column column-width="{$width_scale}px"/>
4015
+ <fo:table-column column-width="proportional-column-width(1)"/>
4016
+ <fo:table-body>
4017
+ <fo:table-row>
4018
+ <fo:table-cell column-number="2">
4019
+ <fo:block>
4020
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
4021
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4022
+ <fo:block line-height="0" font-size="0">
4023
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4024
+ <xsl:call-template name="bookmark"/>
4025
+ </xsl:for-each>
4026
+ </fo:block>
4027
+ </xsl:if>
4028
+ <fo:block text-depth="0" line-height="0" font-size="0">
4029
+
4030
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4031
+ <xsl:attribute name="width">100%</xsl:attribute>
4032
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4033
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4034
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4035
+
4036
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
4037
+ </fo:instream-foreign-object>
4038
+ </fo:block>
4039
+
4040
+ <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">
4041
+ <xsl:with-param name="scale" select="$scale"/>
4042
+ </xsl:apply-templates>
4043
+ </fo:block-container>
4044
+ </fo:block>
4045
+ </fo:table-cell>
4046
+ </fo:table-row>
4047
+ </fo:table-body>
4048
+ </fo:table>
4049
+ </fo:block>
4050
+
4051
+ </xsl:when>
4052
+ <xsl:otherwise>
4053
+ <fo:block xsl:use-attribute-sets="image-style">
4054
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4055
+ <xsl:attribute name="width">100%</xsl:attribute>
4056
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4057
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4058
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4059
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4060
+ <!-- effective height / width = 1.48, 1.4 - with title -->
4061
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4062
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4063
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4064
+ </xsl:if>
4065
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4066
+ <xsl:copy-of select="$svg_content"/>
4067
+ </fo:instream-foreign-object>
4068
+ </fo:block>
4069
+ </xsl:otherwise>
4070
+ </xsl:choose>
4071
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
4072
+ <xsl:copy>
4073
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
4074
+ </xsl:copy>
4075
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
4076
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4077
+ <xsl:value-of select="."/>
4078
+ </xsl:attribute>
4079
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4080
+ <xsl:variable name="svg_content" select="document(@src)"/>
4081
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4082
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
4083
+ <xsl:call-template name="image_svg">
4084
+ <xsl:with-param name="name" select="$name"/>
4085
+ </xsl:call-template>
4086
+ </xsl:for-each>
4087
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
4088
+ <xsl:copy>
4089
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
4090
+ </xsl:copy>
4091
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
4092
+ <xsl:apply-templates mode="svg_remove_a"/>
4093
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
4094
+ <xsl:param name="scale"/>
4095
+ <xsl:variable name="dest">
4096
+ <xsl:choose>
4097
+ <xsl:when test="starts-with(@href, '#')">
4098
+ <xsl:value-of select="substring-after(@href, '#')"/>
4099
+ </xsl:when>
4100
+ <xsl:otherwise>
4101
+ <xsl:value-of select="@href"/>
4102
+ </xsl:otherwise>
4103
+ </xsl:choose>
4104
+ </xsl:variable>
4105
+ <xsl:for-each select="./*[local-name() = 'rect']">
4106
+ <xsl:call-template name="insertSVGMapLink">
4107
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
4108
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
4109
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
4110
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
4111
+ <xsl:with-param name="dest" select="$dest"/>
4112
+ </xsl:call-template>
4113
+ </xsl:for-each>
4114
+
4115
+ <xsl:for-each select="./*[local-name() = 'polygon']">
4116
+ <xsl:variable name="points">
4117
+ <xsl:call-template name="split">
4118
+ <xsl:with-param name="pText" select="@points"/>
4119
+ </xsl:call-template>
4120
+ </xsl:variable>
4121
+ <xsl:variable name="x_coords">
4122
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
4123
+ <xsl:sort select="." data-type="number"/>
4124
+ <x><xsl:value-of select="."/></x>
4125
+ </xsl:for-each>
4126
+ </xsl:variable>
4127
+ <xsl:variable name="y_coords">
4128
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
4129
+ <xsl:sort select="." data-type="number"/>
4130
+ <y><xsl:value-of select="."/></y>
4131
+ </xsl:for-each>
4132
+ </xsl:variable>
4133
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
4134
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
4135
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
4136
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
4137
+ <xsl:call-template name="insertSVGMapLink">
4138
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4139
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4140
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4141
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4142
+ <xsl:with-param name="dest" select="$dest"/>
4143
+ </xsl:call-template>
4144
+ </xsl:for-each>
4145
+
4146
+ <xsl:for-each select="./*[local-name() = 'circle']">
4147
+ <xsl:call-template name="insertSVGMapLink">
4148
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4149
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4150
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4151
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4152
+ <xsl:with-param name="dest" select="$dest"/>
4153
+ </xsl:call-template>
4154
+ </xsl:for-each>
4155
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4156
+ <xsl:call-template name="insertSVGMapLink">
4157
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4158
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4159
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4160
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4161
+ <xsl:with-param name="dest" select="$dest"/>
4162
+ </xsl:call-template>
4163
+ </xsl:for-each>
4164
+ </xsl:template><xsl:template name="insertSVGMapLink">
4165
+ <xsl:param name="left"/>
4166
+ <xsl:param name="top"/>
4167
+ <xsl:param name="width"/>
4168
+ <xsl:param name="height"/>
4169
+ <xsl:param name="dest"/>
4170
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4171
+ <fo:block font-size="1pt">
4172
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4173
+ <fo:inline-container inline-progression-dimension="100%">
4174
+ <fo:block-container height="{$height - 1}px" width="100%">
4175
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4176
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4177
+ </xsl:if> -->
4178
+ <fo:block> </fo:block></fo:block-container>
4179
+ </fo:inline-container>
4180
+ </fo:basic-link>
4181
+ </fo:block>
4182
+ </fo:block-container>
3961
4183
  </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">
3962
4184
  <xsl:apply-templates mode="contents"/>
3963
4185
  <xsl:text> </xsl:text>
@@ -3986,28 +4208,39 @@
3986
4208
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3987
4209
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3988
4210
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4211
+ <xsl:if test="@bundle = 'true'">
4212
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4213
+ </xsl:if>
3989
4214
  <fo:bookmark-title>
3990
- <xsl:variable name="bookmark-title_">
3991
- <xsl:call-template name="getLangVersion">
3992
- <xsl:with-param name="lang" select="@lang"/>
3993
- <xsl:with-param name="doctype" select="@doctype"/>
3994
- <xsl:with-param name="title" select="@title-part"/>
3995
- </xsl:call-template>
3996
- </xsl:variable>
3997
4215
  <xsl:choose>
3998
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3999
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
4000
- </xsl:when>
4001
- <xsl:otherwise>
4216
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4217
+ <xsl:variable name="bookmark-title_">
4218
+ <xsl:call-template name="getLangVersion">
4219
+ <xsl:with-param name="lang" select="@lang"/>
4220
+ <xsl:with-param name="doctype" select="@doctype"/>
4221
+ <xsl:with-param name="title" select="@title-part"/>
4222
+ </xsl:call-template>
4223
+ </xsl:variable>
4002
4224
  <xsl:choose>
4003
- <xsl:when test="@lang = 'en'">English</xsl:when>
4004
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
4005
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4006
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4225
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4226
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4227
+ </xsl:when>
4228
+ <xsl:otherwise>
4229
+ <xsl:choose>
4230
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4231
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4232
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4233
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4234
+ </xsl:choose>
4235
+ </xsl:otherwise>
4007
4236
  </xsl:choose>
4237
+ </xsl:when>
4238
+ <xsl:otherwise>
4239
+ <xsl:value-of select="@title-part"/>
4008
4240
  </xsl:otherwise>
4009
4241
  </xsl:choose>
4010
4242
  </fo:bookmark-title>
4243
+
4011
4244
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4012
4245
 
4013
4246
  <xsl:call-template name="insertFigureBookmarks">
@@ -4106,20 +4339,28 @@
4106
4339
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
4107
4340
  </xsl:choose>
4108
4341
  </xsl:template><xsl:template match="item" mode="bookmark">
4109
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
4110
- <fo:bookmark-title>
4111
- <xsl:if test="@section != ''">
4112
- <xsl:value-of select="@section"/>
4113
- <xsl:text> </xsl:text>
4114
- </xsl:if>
4115
- <xsl:value-of select="normalize-space(title)"/>
4116
- </fo:bookmark-title>
4117
- <xsl:apply-templates mode="bookmark"/>
4118
- </fo:bookmark>
4342
+ <xsl:choose>
4343
+ <xsl:when test="@id != ''">
4344
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4345
+ <fo:bookmark-title>
4346
+ <xsl:if test="@section != ''">
4347
+ <xsl:value-of select="@section"/>
4348
+ <xsl:text> </xsl:text>
4349
+ </xsl:if>
4350
+ <xsl:value-of select="normalize-space(title)"/>
4351
+ </fo:bookmark-title>
4352
+ <xsl:apply-templates mode="bookmark"/>
4353
+ </fo:bookmark>
4354
+ </xsl:when>
4355
+ <xsl:otherwise>
4356
+ <xsl:apply-templates mode="bookmark"/>
4357
+ </xsl:otherwise>
4358
+ </xsl:choose>
4119
4359
  </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">
4120
4360
  <xsl:if test="normalize-space() != ''">
4121
4361
  <fo:block xsl:use-attribute-sets="figure-name-style">
4122
4362
 
4363
+
4123
4364
  <xsl:apply-templates/>
4124
4365
  </fo:block>
4125
4366
  </xsl:if>
@@ -4199,6 +4440,8 @@
4199
4440
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4200
4441
 
4201
4442
  <fo:block-container margin-left="0mm">
4443
+ <xsl:copy-of select="@id"/>
4444
+
4202
4445
  <xsl:if test="parent::*[local-name() = 'note']">
4203
4446
  <xsl:attribute name="margin-left">
4204
4447
  <xsl:choose>
@@ -4209,7 +4452,9 @@
4209
4452
 
4210
4453
  </xsl:if>
4211
4454
  <fo:block-container margin-left="0mm">
4212
-
4455
+
4456
+
4457
+
4213
4458
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4214
4459
  <xsl:variable name="_font-size">
4215
4460
 
@@ -4238,10 +4483,14 @@
4238
4483
  </xsl:choose>
4239
4484
  </xsl:attribute>
4240
4485
  </xsl:if>
4241
- <xsl:apply-templates/>
4242
- </fo:block>
4486
+
4487
+ <xsl:apply-templates/>
4488
+ </fo:block>
4489
+
4490
+
4243
4491
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4244
4492
 
4493
+
4245
4494
  </fo:block-container>
4246
4495
  </fo:block-container>
4247
4496
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4476,6 +4725,7 @@
4476
4725
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4477
4726
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4478
4727
 
4728
+
4479
4729
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4480
4730
 
4481
4731
  <xsl:variable name="element">
@@ -4654,7 +4904,9 @@
4654
4904
 
4655
4905
 
4656
4906
  </xsl:if>
4657
-
4907
+
4908
+
4909
+
4658
4910
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4659
4911
  <xsl:if test="normalize-space(@citeas) = ''">
4660
4912
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4663,6 +4915,7 @@
4663
4915
 
4664
4916
 
4665
4917
 
4918
+
4666
4919
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4667
4920
 
4668
4921
  </xsl:if>
@@ -4700,6 +4953,7 @@
4700
4953
 
4701
4954
 
4702
4955
 
4956
+
4703
4957
  <xsl:choose>
4704
4958
  <xsl:when test="ancestor::un:sections and $depth = 1">12</xsl:when>
4705
4959
  <xsl:when test="ancestor::un:sections">8</xsl:when>
@@ -4809,6 +5063,7 @@
4809
5063
  <xsl:call-template name="setId"/>
4810
5064
 
4811
5065
 
5066
+
4812
5067
  <xsl:apply-templates/>
4813
5068
  </fo:block>
4814
5069
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -5060,17 +5315,17 @@
5060
5315
  <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')]"/>
5061
5316
  <xsl:choose>
5062
5317
  <xsl:when test="normalize-space($_doc_ident) != ''">
5063
- <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"/>
5318
+ <!-- <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"/>
5064
5319
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
5065
5320
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5066
- </xsl:if>
5321
+ </xsl:if> -->
5067
5322
  <xsl:value-of select="$_doc_ident"/>
5068
5323
  </xsl:when>
5069
5324
  <xsl:otherwise>
5070
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5325
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5071
5326
  <xsl:if test="$type != ''">
5072
5327
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5073
- </xsl:if>
5328
+ </xsl:if> -->
5074
5329
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5075
5330
  </xsl:otherwise>
5076
5331
  </xsl:choose>
@@ -5383,6 +5638,9 @@
5383
5638
  <xsl:when test="parent::*[local-name() = 'preface']">
5384
5639
  <xsl:value-of select="$level_total - 1"/>
5385
5640
  </xsl:when>
5641
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5642
+ <xsl:value-of select="$level_total - 1"/>
5643
+ </xsl:when>
5386
5644
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5387
5645
  <xsl:value-of select="$level_total - 2"/>
5388
5646
  </xsl:when>
@@ -5523,7 +5781,14 @@
5523
5781
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5524
5782
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5525
5783
  </xsl:when>
5526
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5784
+ <xsl:otherwise>
5785
+ <xsl:variable name="key_">
5786
+ <xsl:call-template name="capitalize">
5787
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5788
+ </xsl:call-template>
5789
+ </xsl:variable>
5790
+ <xsl:value-of select="$key_"/>
5791
+ </xsl:otherwise>
5527
5792
  </xsl:choose>
5528
5793
 
5529
5794
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -5566,4 +5831,110 @@
5566
5831
  <xsl:value-of select="$align"/>
5567
5832
  </xsl:when>
5568
5833
  </xsl:choose>
5834
+ </xsl:template><xsl:template name="setTextAlignment">
5835
+ <xsl:param name="default">left</xsl:param>
5836
+ <xsl:attribute name="text-align">
5837
+ <xsl:choose>
5838
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5839
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5840
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5841
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5842
+ </xsl:choose>
5843
+ </xsl:attribute>
5844
+ </xsl:template><xsl:template name="number-to-words">
5845
+ <xsl:param name="number"/>
5846
+ <xsl:param name="first"/>
5847
+ <xsl:if test="$number != ''">
5848
+ <xsl:variable name="words">
5849
+ <words>
5850
+ <word cardinal="1">One-</word>
5851
+ <word ordinal="1">First </word>
5852
+ <word cardinal="2">Two-</word>
5853
+ <word ordinal="2">Second </word>
5854
+ <word cardinal="3">Three-</word>
5855
+ <word ordinal="3">Third </word>
5856
+ <word cardinal="4">Four-</word>
5857
+ <word ordinal="4">Fourth </word>
5858
+ <word cardinal="5">Five-</word>
5859
+ <word ordinal="5">Fifth </word>
5860
+ <word cardinal="6">Six-</word>
5861
+ <word ordinal="6">Sixth </word>
5862
+ <word cardinal="7">Seven-</word>
5863
+ <word ordinal="7">Seventh </word>
5864
+ <word cardinal="8">Eight-</word>
5865
+ <word ordinal="8">Eighth </word>
5866
+ <word cardinal="9">Nine-</word>
5867
+ <word ordinal="9">Ninth </word>
5868
+ <word ordinal="10">Tenth </word>
5869
+ <word ordinal="11">Eleventh </word>
5870
+ <word ordinal="12">Twelfth </word>
5871
+ <word ordinal="13">Thirteenth </word>
5872
+ <word ordinal="14">Fourteenth </word>
5873
+ <word ordinal="15">Fifteenth </word>
5874
+ <word ordinal="16">Sixteenth </word>
5875
+ <word ordinal="17">Seventeenth </word>
5876
+ <word ordinal="18">Eighteenth </word>
5877
+ <word ordinal="19">Nineteenth </word>
5878
+ <word cardinal="20">Twenty-</word>
5879
+ <word ordinal="20">Twentieth </word>
5880
+ <word cardinal="30">Thirty-</word>
5881
+ <word ordinal="30">Thirtieth </word>
5882
+ <word cardinal="40">Forty-</word>
5883
+ <word ordinal="40">Fortieth </word>
5884
+ <word cardinal="50">Fifty-</word>
5885
+ <word ordinal="50">Fiftieth </word>
5886
+ <word cardinal="60">Sixty-</word>
5887
+ <word ordinal="60">Sixtieth </word>
5888
+ <word cardinal="70">Seventy-</word>
5889
+ <word ordinal="70">Seventieth </word>
5890
+ <word cardinal="80">Eighty-</word>
5891
+ <word ordinal="80">Eightieth </word>
5892
+ <word cardinal="90">Ninety-</word>
5893
+ <word ordinal="90">Ninetieth </word>
5894
+ <word cardinal="100">Hundred-</word>
5895
+ <word ordinal="100">Hundredth </word>
5896
+ </words>
5897
+ </xsl:variable>
5898
+
5899
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5900
+
5901
+ <xsl:variable name="value">
5902
+ <xsl:choose>
5903
+ <xsl:when test="$ordinal != ''">
5904
+ <xsl:value-of select="$ordinal"/>
5905
+ </xsl:when>
5906
+ <xsl:otherwise>
5907
+ <xsl:choose>
5908
+ <xsl:when test="$number &lt; 100">
5909
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5910
+ <xsl:variable name="digit" select="substring($number,2)"/>
5911
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5912
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5913
+ </xsl:when>
5914
+ <xsl:otherwise>
5915
+ <!-- more 100 -->
5916
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5917
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5918
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5919
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5920
+ <xsl:call-template name="number-to-words">
5921
+ <xsl:with-param name="number" select="$digits"/>
5922
+ </xsl:call-template>
5923
+ </xsl:otherwise>
5924
+ </xsl:choose>
5925
+ </xsl:otherwise>
5926
+ </xsl:choose>
5927
+ </xsl:variable>
5928
+ <xsl:choose>
5929
+ <xsl:when test="$first = 'true'">
5930
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5931
+ <xsl:call-template name="capitalize">
5932
+ <xsl:with-param name="str" select="$value_lc"/>
5933
+ </xsl:call-template>
5934
+ </xsl:when>
5935
+ <xsl:otherwise>
5936
+ <xsl:value-of select="$value"/>
5937
+ </xsl:otherwise>
5938
+ </xsl:choose>
5939
+ </xsl:if>
5569
5940
  </xsl:template></xsl:stylesheet>