metanorma-un 0.5.16 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@
5
5
  <xsl:param name="svg_images"/>
6
6
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
8
9
 
9
10
 
10
11
 
@@ -1184,6 +1185,9 @@
1184
1185
  <title-continued lang="en">(continued)</title-continued>
1185
1186
  <title-continued lang="fr">(continué)</title-continued>
1186
1187
 
1188
+ </xsl:variable><xsl:variable name="bibdata">
1189
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1190
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1187
1191
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1188
1192
  <xsl:param name="name"/>
1189
1193
  <xsl:param name="lang"/>
@@ -1209,10 +1213,13 @@
1209
1213
  </xsl:choose>
1210
1214
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
1211
1215
 
1216
+
1212
1217
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1213
1218
 
1214
1219
 
1215
1220
 
1221
+
1222
+
1216
1223
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1217
1224
  <xsl:attribute name="white-space">pre</xsl:attribute>
1218
1225
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1271,6 +1278,7 @@
1271
1278
 
1272
1279
 
1273
1280
 
1281
+
1274
1282
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1275
1283
 
1276
1284
 
@@ -1287,9 +1295,7 @@
1287
1295
 
1288
1296
 
1289
1297
 
1290
-
1291
-
1292
-
1298
+
1293
1299
 
1294
1300
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1295
1301
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1326,6 +1332,7 @@
1326
1332
 
1327
1333
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1328
1334
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1335
+
1329
1336
 
1330
1337
 
1331
1338
 
@@ -1345,6 +1352,7 @@
1345
1352
 
1346
1353
 
1347
1354
 
1355
+
1348
1356
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1349
1357
 
1350
1358
 
@@ -1357,15 +1365,19 @@
1357
1365
 
1358
1366
 
1359
1367
 
1368
+
1369
+
1360
1370
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1361
1371
 
1362
1372
 
1363
1373
 
1364
1374
 
1375
+
1365
1376
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1366
1377
 
1367
1378
 
1368
1379
 
1380
+
1369
1381
 
1370
1382
 
1371
1383
 
@@ -1394,6 +1406,7 @@
1394
1406
 
1395
1407
 
1396
1408
 
1409
+
1397
1410
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1398
1411
 
1399
1412
 
@@ -1418,11 +1431,13 @@
1418
1431
 
1419
1432
 
1420
1433
 
1434
+
1421
1435
 
1422
1436
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
1423
1437
 
1424
1438
 
1425
1439
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1440
+
1426
1441
 
1427
1442
 
1428
1443
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -1443,14 +1458,18 @@
1443
1458
 
1444
1459
 
1445
1460
 
1461
+
1462
+
1446
1463
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1447
1464
 
1448
1465
 
1449
1466
 
1467
+
1450
1468
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1451
1469
 
1452
1470
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1453
1471
 
1472
+
1454
1473
 
1455
1474
 
1456
1475
 
@@ -1482,6 +1501,7 @@
1482
1501
 
1483
1502
 
1484
1503
 
1504
+
1485
1505
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1486
1506
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1487
1507
 
@@ -1490,6 +1510,7 @@
1490
1510
 
1491
1511
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1492
1512
 
1513
+
1493
1514
  <xsl:attribute name="width">100%</xsl:attribute>
1494
1515
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1495
1516
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -1513,13 +1534,34 @@
1513
1534
 
1514
1535
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1515
1536
 
1516
-
1537
+
1538
+
1517
1539
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1518
1540
 
1541
+
1519
1542
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1520
1543
 
1521
1544
 
1522
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1545
+
1546
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1547
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1548
+ </xsl:variable><xsl:attribute-set name="add-style">
1549
+ <xsl:attribute name="color">red</xsl:attribute>
1550
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1551
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1552
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1553
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1554
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1555
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1556
+ <xsl:text>red</xsl:text>
1557
+ </xsl:variable><xsl:attribute-set name="del-style">
1558
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1559
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1560
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1561
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1562
+
1563
+
1564
+ </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">
1523
1565
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1524
1566
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1525
1567
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1564,16 +1606,17 @@
1564
1606
  <xsl:call-template name="add-zero-spaces-java"/>
1565
1607
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1566
1608
 
1609
+ <xsl:variable name="table-preamble">
1610
+
1611
+
1612
+ </xsl:variable>
1613
+
1567
1614
  <xsl:variable name="table">
1568
1615
 
1569
1616
  <xsl:variable name="simple-table">
1570
1617
  <xsl:call-template name="getSimpleTable"/>
1571
1618
  </xsl:variable>
1572
1619
 
1573
-
1574
-
1575
-
1576
-
1577
1620
  <!-- <xsl:if test="$namespace = 'bipm'">
1578
1621
  <fo:block>&#xA0;</fo:block>
1579
1622
  </xsl:if> -->
@@ -1588,7 +1631,7 @@
1588
1631
 
1589
1632
 
1590
1633
 
1591
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1634
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1592
1635
 
1593
1636
  <!-- <xsl:variable name="cols-count">
1594
1637
  <xsl:choose>
@@ -1607,8 +1650,6 @@
1607
1650
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1608
1651
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1609
1652
 
1610
-
1611
-
1612
1653
  <xsl:variable name="colwidths">
1613
1654
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1614
1655
  <xsl:call-template name="calculate-column-widths">
@@ -1636,9 +1677,11 @@
1636
1677
  </xsl:choose>
1637
1678
  </xsl:variable>
1638
1679
 
1680
+
1639
1681
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1640
1682
 
1641
1683
 
1684
+
1642
1685
 
1643
1686
 
1644
1687
  <xsl:attribute name="space-after">12pt</xsl:attribute>
@@ -1656,6 +1699,8 @@
1656
1699
 
1657
1700
 
1658
1701
 
1702
+
1703
+
1659
1704
  <xsl:variable name="table_width">
1660
1705
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1661
1706
 
@@ -1677,6 +1722,8 @@
1677
1722
 
1678
1723
 
1679
1724
 
1725
+
1726
+
1680
1727
 
1681
1728
 
1682
1729
  <xsl:if test="ancestor::*[local-name()='sections']">
@@ -1771,7 +1818,8 @@
1771
1818
  </fo:block-container>
1772
1819
  </xsl:variable>
1773
1820
 
1774
-
1821
+ <xsl:variable name="isAdded" select="@added"/>
1822
+ <xsl:variable name="isDeleted" select="@deleted"/>
1775
1823
 
1776
1824
  <xsl:choose>
1777
1825
  <xsl:when test="@width">
@@ -1780,21 +1828,62 @@
1780
1828
 
1781
1829
 
1782
1830
 
1783
- <xsl:copy-of select="$table"/>
1831
+ <xsl:choose>
1832
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1833
+ <xsl:copy-of select="$table-preamble"/>
1834
+ <fo:block>
1835
+ <xsl:call-template name="setTrackChangesStyles">
1836
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1837
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1838
+ </xsl:call-template>
1839
+ <xsl:copy-of select="$table"/>
1840
+ </fo:block>
1841
+ </xsl:when>
1842
+ <xsl:otherwise>
1843
+ <xsl:copy-of select="$table-preamble"/>
1844
+ <xsl:copy-of select="$table"/>
1845
+ </xsl:otherwise>
1846
+ </xsl:choose>
1784
1847
 
1785
1848
 
1786
1849
  </xsl:when>
1787
1850
  <xsl:otherwise>
1788
- <xsl:copy-of select="$table"/>
1851
+ <xsl:choose>
1852
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1853
+ <xsl:copy-of select="$table-preamble"/>
1854
+ <fo:block>
1855
+ <xsl:call-template name="setTrackChangesStyles">
1856
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1857
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1858
+ </xsl:call-template>
1859
+ <xsl:copy-of select="$table"/>
1860
+ </fo:block>
1861
+ </xsl:when>
1862
+ <xsl:otherwise>
1863
+ <xsl:copy-of select="$table-preamble"/>
1864
+ <xsl:copy-of select="$table"/>
1865
+ </xsl:otherwise>
1866
+ </xsl:choose>
1789
1867
  </xsl:otherwise>
1790
1868
  </xsl:choose>
1791
1869
 
1792
1870
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1871
+ <xsl:param name="continued"/>
1793
1872
  <xsl:if test="normalize-space() != ''">
1794
1873
  <fo:block xsl:use-attribute-sets="table-name-style">
1795
1874
 
1796
1875
 
1797
- <xsl:apply-templates/>
1876
+ <xsl:choose>
1877
+ <xsl:when test="$continued = 'true'">
1878
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
1879
+
1880
+ </xsl:when>
1881
+ <xsl:otherwise>
1882
+ <xsl:apply-templates/>
1883
+ </xsl:otherwise>
1884
+ </xsl:choose>
1885
+
1886
+
1798
1887
  </fo:block>
1799
1888
  </xsl:if>
1800
1889
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1846,7 +1935,7 @@
1846
1935
  </xsl:for-each>
1847
1936
  </xsl:when>
1848
1937
  <xsl:otherwise>
1849
- <xsl:for-each select="xalan:nodeset($table)//tr">
1938
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1850
1939
  <xsl:variable name="td_text">
1851
1940
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1852
1941
 
@@ -1934,18 +2023,18 @@
1934
2023
  <xsl:apply-templates/>
1935
2024
  </fo:table-header>
1936
2025
  </xsl:template><xsl:template name="table-header-title">
1937
- <xsl:param name="cols-count"/>
2026
+ <xsl:param name="cols-count"/>
1938
2027
  <!-- row for title -->
1939
2028
  <fo:table-row>
1940
2029
  <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">
1941
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
2030
+
2031
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2032
+ <xsl:with-param name="continued">true</xsl:with-param>
2033
+ </xsl:apply-templates>
1942
2034
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1943
2035
  <xsl:call-template name="fn_name_display"/>
1944
- </xsl:for-each>
1945
- <fo:block text-align="right" font-style="italic">
1946
- <xsl:text> </xsl:text>
1947
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1948
- </fo:block>
2036
+ </xsl:for-each>
2037
+
1949
2038
  </fo:table-cell>
1950
2039
  </fo:table-row>
1951
2040
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2166,6 +2255,7 @@
2166
2255
 
2167
2256
 
2168
2257
 
2258
+
2169
2259
  </xsl:if>
2170
2260
  <xsl:if test="$parent-name = 'tfoot'">
2171
2261
 
@@ -2186,7 +2276,8 @@
2186
2276
  <xsl:attribute name="text-align">
2187
2277
  <xsl:choose>
2188
2278
  <xsl:when test="@align">
2189
- <xsl:value-of select="@align"/>
2279
+ <xsl:call-template name="setAlignment"/>
2280
+ <!-- <xsl:value-of select="@align"/> -->
2190
2281
  </xsl:when>
2191
2282
  <xsl:otherwise>center</xsl:otherwise>
2192
2283
  </xsl:choose>
@@ -2198,6 +2289,7 @@
2198
2289
 
2199
2290
 
2200
2291
 
2292
+
2201
2293
 
2202
2294
  <xsl:if test="ancestor::*[local-name()='sections']">
2203
2295
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
@@ -2218,6 +2310,10 @@
2218
2310
 
2219
2311
 
2220
2312
 
2313
+
2314
+ <xsl:if test="$lang = 'ar'">
2315
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2316
+ </xsl:if>
2221
2317
  <xsl:if test="@colspan">
2222
2318
  <xsl:attribute name="number-columns-spanned">
2223
2319
  <xsl:value-of select="@colspan"/>
@@ -2249,11 +2345,16 @@
2249
2345
  <xsl:attribute name="text-align">
2250
2346
  <xsl:choose>
2251
2347
  <xsl:when test="@align">
2252
- <xsl:value-of select="@align"/>
2348
+ <xsl:call-template name="setAlignment"/>
2349
+ <!-- <xsl:value-of select="@align"/> -->
2253
2350
  </xsl:when>
2254
2351
  <xsl:otherwise>left</xsl:otherwise>
2255
2352
  </xsl:choose>
2256
2353
  </xsl:attribute>
2354
+ <xsl:if test="$lang = 'ar'">
2355
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2356
+ </xsl:if>
2357
+
2257
2358
 
2258
2359
 
2259
2360
 
@@ -2271,6 +2372,9 @@
2271
2372
 
2272
2373
 
2273
2374
 
2375
+ <xsl:if test=".//*[local-name() = 'table']">
2376
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2377
+ </xsl:if>
2274
2378
  <xsl:if test="@colspan">
2275
2379
  <xsl:attribute name="number-columns-spanned">
2276
2380
  <xsl:value-of select="@colspan"/>
@@ -2408,13 +2512,13 @@
2408
2512
  </xsl:choose>
2409
2513
  </xsl:variable>
2410
2514
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2411
- <xsl:element name="{$ns}:table">
2515
+ <!-- <xsl:element name="{$ns}:table"> -->
2412
2516
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2413
2517
  <tbody>
2414
2518
  <xsl:apply-templates mode="dl"/>
2415
2519
  </tbody>
2416
2520
  </xsl:for-each>
2417
- </xsl:element>
2521
+ <!-- </xsl:element> -->
2418
2522
  </xsl:variable>
2419
2523
 
2420
2524
  <xsl:call-template name="calculate-column-widths">
@@ -2505,6 +2609,8 @@
2505
2609
  <xsl:apply-templates/>
2506
2610
  </fo:inline>
2507
2611
  </xsl:template><xsl:template match="*[local-name()='dl']">
2612
+ <xsl:variable name="isAdded" select="@added"/>
2613
+ <xsl:variable name="isDeleted" select="@deleted"/>
2508
2614
  <fo:block-container>
2509
2615
 
2510
2616
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2521,6 +2627,12 @@
2521
2627
  </xsl:attribute>
2522
2628
 
2523
2629
  </xsl:if>
2630
+
2631
+ <xsl:call-template name="setTrackChangesStyles">
2632
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2633
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2634
+ </xsl:call-template>
2635
+
2524
2636
  <fo:block-container>
2525
2637
 
2526
2638
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2576,6 +2688,7 @@
2576
2688
 
2577
2689
 
2578
2690
 
2691
+
2579
2692
  <xsl:variable name="title-key">
2580
2693
 
2581
2694
 
@@ -2628,11 +2741,11 @@
2628
2741
  </xsl:choose>
2629
2742
  </xsl:variable>
2630
2743
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2631
- <xsl:element name="{$ns}:table">
2744
+ <!-- <xsl:element name="{$ns}:table"> -->
2632
2745
  <tbody>
2633
2746
  <xsl:apply-templates mode="dl"/>
2634
2747
  </tbody>
2635
- </xsl:element>
2748
+ <!-- </xsl:element> -->
2636
2749
  </xsl:variable>
2637
2750
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2638
2751
  <xsl:variable name="colwidths">
@@ -2857,6 +2970,8 @@
2857
2970
 
2858
2971
  <xsl:apply-templates/>
2859
2972
  </fo:inline>
2973
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2974
+ <fo:inline padding-right="{@value}"> </fo:inline>
2860
2975
  </xsl:template><xsl:template match="*[local-name()='sup']">
2861
2976
  <fo:inline font-size="80%" vertical-align="super">
2862
2977
  <xsl:apply-templates/>
@@ -2882,6 +2997,7 @@
2882
2997
 
2883
2998
 
2884
2999
 
3000
+
2885
3001
 
2886
3002
  </xsl:variable>
2887
3003
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2899,8 +3015,74 @@
2899
3015
  <fo:inline text-decoration="underline">
2900
3016
  <xsl:apply-templates/>
2901
3017
  </fo:inline>
3018
+ </xsl:template><xsl:template match="*[local-name()='add']">
3019
+ <xsl:choose>
3020
+ <xsl:when test="@amendment">
3021
+ <fo:inline>
3022
+ <xsl:call-template name="insertTag">
3023
+ <xsl:with-param name="kind">A</xsl:with-param>
3024
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3025
+ </xsl:call-template>
3026
+ <xsl:apply-templates/>
3027
+ <xsl:call-template name="insertTag">
3028
+ <xsl:with-param name="type">closing</xsl:with-param>
3029
+ <xsl:with-param name="kind">A</xsl:with-param>
3030
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3031
+ </xsl:call-template>
3032
+ </fo:inline>
3033
+ </xsl:when>
3034
+ <xsl:when test="@corrigenda">
3035
+ <fo:inline>
3036
+ <xsl:call-template name="insertTag">
3037
+ <xsl:with-param name="kind">C</xsl:with-param>
3038
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3039
+ </xsl:call-template>
3040
+ <xsl:apply-templates/>
3041
+ <xsl:call-template name="insertTag">
3042
+ <xsl:with-param name="type">closing</xsl:with-param>
3043
+ <xsl:with-param name="kind">C</xsl:with-param>
3044
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3045
+ </xsl:call-template>
3046
+ </fo:inline>
3047
+ </xsl:when>
3048
+ <xsl:otherwise>
3049
+ <fo:inline xsl:use-attribute-sets="add-style">
3050
+ <xsl:apply-templates/>
3051
+ </fo:inline>
3052
+ </xsl:otherwise>
3053
+ </xsl:choose>
3054
+
3055
+ </xsl:template><xsl:template name="insertTag">
3056
+ <xsl:param name="type"/>
3057
+ <xsl:param name="kind"/>
3058
+ <xsl:param name="value"/>
3059
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3060
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3061
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3062
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3063
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3064
+ <xsl:attribute name="height">5mm</xsl:attribute>
3065
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3066
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3067
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3068
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3069
+ <g>
3070
+ <xsl:if test="$type = 'closing'">
3071
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3072
+ </xsl:if>
3073
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3074
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3075
+ </g>
3076
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3077
+ <xsl:if test="$type = 'closing'">
3078
+ <xsl:attribute name="x">25</xsl:attribute>
3079
+ </xsl:if>
3080
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3081
+ </text>
3082
+ </svg>
3083
+ </fo:instream-foreign-object>
2902
3084
  </xsl:template><xsl:template match="*[local-name()='del']">
2903
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3085
+ <fo:inline xsl:use-attribute-sets="del-style">
2904
3086
  <xsl:apply-templates/>
2905
3087
  </fo:inline>
2906
3088
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -3197,11 +3379,15 @@
3197
3379
  </xsl:apply-templates>
3198
3380
  </xsl:template><xsl:template name="getLang">
3199
3381
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3382
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3200
3383
  <xsl:variable name="language">
3201
3384
  <xsl:choose>
3202
3385
  <xsl:when test="$language_current != ''">
3203
3386
  <xsl:value-of select="$language_current"/>
3204
3387
  </xsl:when>
3388
+ <xsl:when test="$language_current_2 != ''">
3389
+ <xsl:value-of select="$language_current_2"/>
3390
+ </xsl:when>
3205
3391
  <xsl:otherwise>
3206
3392
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3207
3393
  </xsl:otherwise>
@@ -3241,13 +3427,23 @@
3241
3427
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3242
3428
  <xsl:value-of select="substring($str, 2)"/>
3243
3429
  </xsl:template><xsl:template match="mathml:math">
3244
- <fo:inline font-family="STIX Two Math"> <!-- -->
3430
+ <xsl:variable name="isAdded" select="@added"/>
3431
+ <xsl:variable name="isDeleted" select="@deleted"/>
3432
+
3433
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3434
+
3435
+
3436
+ <xsl:call-template name="setTrackChangesStyles">
3437
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3438
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3439
+ </xsl:call-template>
3245
3440
 
3246
3441
  <xsl:variable name="mathml">
3247
3442
  <xsl:apply-templates select="." mode="mathml"/>
3248
3443
  </xsl:variable>
3249
3444
  <fo:instream-foreign-object fox:alt-text="Math">
3250
3445
 
3446
+
3251
3447
  <!-- <xsl:copy-of select="."/> -->
3252
3448
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3253
3449
  </fo:instream-foreign-object>
@@ -3268,6 +3464,16 @@
3268
3464
  <mathml:mspace width="0.5ex"/>
3269
3465
  </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">
3270
3466
  <xsl:variable name="target">
3467
+ <xsl:choose>
3468
+ <xsl:when test="@updatetype = 'true'">
3469
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3470
+ </xsl:when>
3471
+ <xsl:otherwise>
3472
+ <xsl:value-of select="normalize-space(@target)"/>
3473
+ </xsl:otherwise>
3474
+ </xsl:choose>
3475
+ </xsl:variable>
3476
+ <xsl:variable name="target_text">
3271
3477
  <xsl:choose>
3272
3478
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3273
3479
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3280,19 +3486,19 @@
3280
3486
  <fo:inline xsl:use-attribute-sets="link-style">
3281
3487
 
3282
3488
  <xsl:choose>
3283
- <xsl:when test="$target = ''">
3489
+ <xsl:when test="$target_text = ''">
3284
3490
  <xsl:apply-templates/>
3285
3491
  </xsl:when>
3286
3492
  <xsl:otherwise>
3287
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3493
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3288
3494
  <xsl:choose>
3289
3495
  <xsl:when test="normalize-space(.) = ''">
3290
- <!-- <xsl:value-of select="$target"/> -->
3291
3496
  <xsl:call-template name="add-zero-spaces-link-java">
3292
- <xsl:with-param name="text" select="$target"/>
3497
+ <xsl:with-param name="text" select="$target_text"/>
3293
3498
  </xsl:call-template>
3294
3499
  </xsl:when>
3295
3500
  <xsl:otherwise>
3501
+ <!-- output text from <link>text</link> -->
3296
3502
  <xsl:apply-templates/>
3297
3503
  </xsl:otherwise>
3298
3504
  </xsl:choose>
@@ -3417,6 +3623,7 @@
3417
3623
 
3418
3624
 
3419
3625
  <fo:inline xsl:use-attribute-sets="note-name-style">
3626
+
3420
3627
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3421
3628
  </fo:inline>
3422
3629
  <xsl:apply-templates/>
@@ -3443,6 +3650,7 @@
3443
3650
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3444
3651
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3445
3652
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3653
+
3446
3654
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3447
3655
  </fo:inline>
3448
3656
  <xsl:apply-templates/>
@@ -3508,8 +3716,15 @@
3508
3716
  </fo:inline>
3509
3717
  </xsl:if>
3510
3718
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3719
+ <xsl:variable name="isAdded" select="@added"/>
3720
+ <xsl:variable name="isDeleted" select="@deleted"/>
3511
3721
  <fo:block-container id="{@id}">
3512
3722
 
3723
+ <xsl:call-template name="setTrackChangesStyles">
3724
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3725
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3726
+ </xsl:call-template>
3727
+
3513
3728
  <fo:block>
3514
3729
  <xsl:apply-templates/>
3515
3730
  </fo:block>
@@ -3517,7 +3732,10 @@
3517
3732
  <xsl:for-each select="*[local-name() = 'note']">
3518
3733
  <xsl:call-template name="note"/>
3519
3734
  </xsl:for-each>
3520
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3735
+
3736
+
3737
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3738
+
3521
3739
  </fo:block-container>
3522
3740
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3523
3741
  <fo:block id="{@id}">
@@ -3529,42 +3747,127 @@
3529
3747
  <xsl:apply-templates/>
3530
3748
  </fo:block>
3531
3749
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3532
- <fo:block xsl:use-attribute-sets="image-style">
3533
-
3534
- <xsl:if test="ancestor::un:admonition">
3535
- <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3536
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3537
- </xsl:if>
3538
-
3539
-
3540
- <xsl:variable name="src">
3541
- <xsl:choose>
3542
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3543
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3544
- </xsl:when>
3545
- <xsl:otherwise>
3546
- <xsl:value-of select="@src"/>
3547
- </xsl:otherwise>
3548
- </xsl:choose>
3549
- </xsl:variable>
3550
-
3551
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3552
- </fo:block>
3750
+ <xsl:variable name="isAdded" select="../@added"/>
3751
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3752
+ <xsl:choose>
3753
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3754
+ <fo:inline padding-left="1mm" padding-right="1mm">
3755
+ <xsl:variable name="src">
3756
+ <xsl:call-template name="image_src"/>
3757
+ </xsl:variable>
3758
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3759
+ </fo:inline>
3760
+ </xsl:when>
3761
+ <xsl:otherwise>
3762
+ <fo:block xsl:use-attribute-sets="image-style">
3763
+
3764
+ <xsl:if test="ancestor::un:admonition">
3765
+ <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3766
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3767
+ </xsl:if>
3768
+
3769
+ <xsl:variable name="src">
3770
+ <xsl:call-template name="image_src"/>
3771
+ </xsl:variable>
3772
+
3773
+ <xsl:choose>
3774
+ <xsl:when test="$isDeleted = 'true'">
3775
+ <!-- enclose in svg -->
3776
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3777
+ <xsl:attribute name="width">100%</xsl:attribute>
3778
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3779
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3780
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3781
+
3782
+
3783
+ <xsl:apply-templates select="." mode="cross_image"/>
3784
+
3785
+ </fo:instream-foreign-object>
3786
+ </xsl:when>
3787
+ <xsl:otherwise>
3788
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3789
+ </xsl:otherwise>
3790
+ </xsl:choose>
3791
+
3792
+ </fo:block>
3793
+ </xsl:otherwise>
3794
+ </xsl:choose>
3795
+ </xsl:template><xsl:template name="image_src">
3796
+ <xsl:choose>
3797
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3798
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3799
+ </xsl:when>
3800
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3801
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3802
+ </xsl:when>
3803
+ <xsl:otherwise>
3804
+ <xsl:value-of select="@src"/>
3805
+ </xsl:otherwise>
3806
+ </xsl:choose>
3807
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3808
+ <xsl:choose>
3809
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3810
+ <xsl:variable name="src">
3811
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3812
+ </xsl:variable>
3813
+ <xsl:variable name="width" select="document($src)/@width"/>
3814
+ <xsl:variable name="height" select="document($src)/@height"/>
3815
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3816
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3817
+ </svg>
3818
+ </xsl:when>
3819
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3820
+ <xsl:variable name="src">
3821
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3822
+ </xsl:variable>
3823
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3824
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3825
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3826
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3827
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3828
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3829
+ </svg>
3830
+ </xsl:when>
3831
+ <xsl:otherwise>
3832
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3833
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3834
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3835
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3836
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3837
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3838
+ <!-- width=<xsl:value-of select="$width"/> -->
3839
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3840
+ <!-- height=<xsl:value-of select="$height"/> -->
3841
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3842
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3843
+ <xsl:call-template name="svg_cross">
3844
+ <xsl:with-param name="width" select="$width"/>
3845
+ <xsl:with-param name="height" select="$height"/>
3846
+ </xsl:call-template>
3847
+ </svg>
3848
+ </xsl:otherwise>
3849
+ </xsl:choose>
3850
+
3851
+ </xsl:template><xsl:template name="svg_cross">
3852
+ <xsl:param name="width"/>
3853
+ <xsl:param name="height"/>
3854
+ <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; "/>
3855
+ <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; "/>
3553
3856
  </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">
3554
3857
  <xsl:apply-templates mode="contents"/>
3555
3858
  <xsl:text> </xsl:text>
3556
3859
  </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">
3557
3860
  <xsl:apply-templates mode="bookmarks"/>
3558
3861
  <xsl:text> </xsl:text>
3559
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3862
+ </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">
3560
3863
  <xsl:value-of select="."/>
3561
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3864
+ </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">
3562
3865
  <xsl:value-of select="."/>
3563
3866
  </xsl:template><xsl:template match="node()" mode="contents">
3564
3867
  <xsl:apply-templates mode="contents"/>
3565
3868
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3566
3869
  <xsl:apply-templates mode="bookmarks"/>
3567
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3870
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3568
3871
  <xsl:apply-templates select="."/>
3569
3872
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3570
3873
  <xsl:apply-templates mode="bookmarks"/>
@@ -3763,6 +4066,8 @@
3763
4066
  </fo:list-item-body>
3764
4067
  </fo:list-item>
3765
4068
  </fo:list-block>
4069
+ </xsl:template><xsl:template name="extractSection">
4070
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3766
4071
  </xsl:template><xsl:template name="extractTitle">
3767
4072
  <xsl:choose>
3768
4073
  <xsl:when test="*[local-name() = 'tab']">
@@ -3789,6 +4094,7 @@
3789
4094
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3790
4095
 
3791
4096
  <fo:block-container margin-left="0mm">
4097
+ <xsl:copy-of select="@id"/>
3792
4098
  <xsl:if test="parent::*[local-name() = 'note']">
3793
4099
  <xsl:attribute name="margin-left">
3794
4100
  <xsl:choose>
@@ -3810,6 +4116,7 @@
3810
4116
 
3811
4117
 
3812
4118
 
4119
+
3813
4120
 
3814
4121
 
3815
4122
 
@@ -4065,6 +4372,7 @@
4065
4372
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4066
4373
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4067
4374
 
4375
+
4068
4376
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4069
4377
 
4070
4378
  <xsl:variable name="element">
@@ -4092,6 +4400,7 @@
4092
4400
  <xsl:variable name="element">
4093
4401
  block
4094
4402
 
4403
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4095
4404
  </xsl:variable>
4096
4405
  <xsl:choose>
4097
4406
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4099,7 +4408,7 @@
4099
4408
  <xsl:apply-templates/>
4100
4409
  </fo:inline>
4101
4410
  </xsl:when>
4102
- <xsl:when test="normalize-space($element) = 'block'">
4411
+ <xsl:when test="contains(normalize-space($element), 'block')">
4103
4412
  <fo:block xsl:use-attribute-sets="example-name-style">
4104
4413
  <xsl:apply-templates/>
4105
4414
  </fo:block>
@@ -4136,7 +4445,7 @@
4136
4445
  </fo:inline>
4137
4446
  </xsl:otherwise>
4138
4447
  </xsl:choose>
4139
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4448
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
4140
4449
  <fo:block xsl:use-attribute-sets="termsource-style">
4141
4450
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
4142
4451
  <xsl:variable name="termsource_text">
@@ -4145,13 +4454,15 @@
4145
4454
 
4146
4455
  <xsl:choose>
4147
4456
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4148
- <xsl:apply-templates/>
4457
+ <!-- <xsl:apply-templates /> -->
4458
+ <xsl:copy-of select="$termsource_text"/>
4149
4459
  </xsl:when>
4150
4460
  <xsl:otherwise>
4151
4461
 
4152
4462
  <xsl:text>[</xsl:text>
4153
4463
 
4154
- <xsl:apply-templates/>
4464
+ <!-- <xsl:apply-templates /> -->
4465
+ <xsl:copy-of select="$termsource_text"/>
4155
4466
 
4156
4467
  <xsl:text>]</xsl:text>
4157
4468
 
@@ -4162,8 +4473,15 @@
4162
4473
  <xsl:if test="normalize-space() != ''">
4163
4474
  <xsl:value-of select="."/>
4164
4475
  </xsl:if>
4165
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4476
+ </xsl:template><xsl:variable name="localized.source">
4477
+ <xsl:call-template name="getLocalizedString">
4478
+ <xsl:with-param name="key">source</xsl:with-param>
4479
+ </xsl:call-template>
4480
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4166
4481
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4482
+ <xsl:if test="normalize-space(@citeas) = ''">
4483
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4484
+ </xsl:if>
4167
4485
 
4168
4486
  <fo:inline xsl:use-attribute-sets="origin-style">
4169
4487
  <xsl:apply-templates/>
@@ -4278,6 +4596,7 @@
4278
4596
 
4279
4597
 
4280
4598
 
4599
+
4281
4600
  <xsl:choose>
4282
4601
  <xsl:when test="ancestor::un:annex and $depth &gt;= 2">9.5</xsl:when>
4283
4602
  <xsl:when test="ancestor::un:sections">9.5</xsl:when>
@@ -4310,7 +4629,8 @@
4310
4629
  </fo:inline>
4311
4630
  </xsl:when>
4312
4631
  <xsl:otherwise>
4313
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4632
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4633
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4314
4634
  </xsl:otherwise>
4315
4635
  </xsl:choose>
4316
4636
 
@@ -4371,7 +4691,6 @@
4371
4691
  <xsl:attribute name="margin-top">3pt</xsl:attribute>
4372
4692
  </xsl:if>
4373
4693
 
4374
-
4375
4694
  <xsl:apply-templates/>
4376
4695
  </fo:block>
4377
4696
 
@@ -4419,7 +4738,7 @@
4419
4738
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4420
4739
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4421
4740
  <xsl:choose>
4422
- <xsl:when test="parent::*[local-name() = 'note']">
4741
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4423
4742
  <fo:block-container>
4424
4743
  <xsl:attribute name="margin-left">
4425
4744
  <xsl:choose>
@@ -4429,6 +4748,7 @@
4429
4748
  </xsl:attribute>
4430
4749
 
4431
4750
 
4751
+
4432
4752
  <fo:block-container margin-left="0mm">
4433
4753
  <fo:block>
4434
4754
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4630,6 +4950,10 @@
4630
4950
 
4631
4951
 
4632
4952
 
4953
+
4954
+
4955
+
4956
+
4633
4957
  </xsl:template><xsl:template name="processBibitemDocId">
4634
4958
  <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')]"/>
4635
4959
  <xsl:choose>
@@ -4686,6 +5010,70 @@
4686
5010
  <xsl:value-of select="substring(.,1,1)"/>
4687
5011
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4688
5012
  <fo:inline><xsl:apply-templates/></fo:inline>
5013
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
5014
+ <fo:block>
5015
+ <xsl:apply-templates/>
5016
+ </fo:block>
5017
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
5018
+ <fo:inline><xsl:apply-templates/></fo:inline>
5019
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
5020
+ <fo:inline>
5021
+ <xsl:call-template name="text_input"/>
5022
+ </fo:inline>
5023
+ </xsl:template><xsl:template name="text_input">
5024
+ <xsl:variable name="count">
5025
+ <xsl:choose>
5026
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
5027
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
5028
+ <xsl:otherwise>10</xsl:otherwise>
5029
+ </xsl:choose>
5030
+ </xsl:variable>
5031
+ <xsl:call-template name="repeat">
5032
+ <xsl:with-param name="char" select="'_'"/>
5033
+ <xsl:with-param name="count" select="$count"/>
5034
+ </xsl:call-template>
5035
+ <xsl:text> </xsl:text>
5036
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
5037
+ <xsl:variable name="caption">
5038
+ <xsl:choose>
5039
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
5040
+ <xsl:otherwise>BUTTON</xsl:otherwise>
5041
+ </xsl:choose>
5042
+ </xsl:variable>
5043
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
5044
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
5045
+ <fo:inline padding-right="1mm">
5046
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5047
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5048
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5049
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5050
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5051
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5052
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
5053
+ </svg>
5054
+ </fo:instream-foreign-object>
5055
+ </fo:inline>
5056
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5057
+ <fo:inline padding-right="1mm">
5058
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5059
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5060
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5061
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5062
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5063
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5064
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5065
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5066
+ </svg>
5067
+ </fo:instream-foreign-object>
5068
+ </fo:inline>
5069
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5070
+ <fo:inline>
5071
+ <xsl:call-template name="text_input"/>
5072
+ </fo:inline>
5073
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5074
+ <fo:block-container border="1pt solid black" width="50%">
5075
+ <fo:block> </fo:block>
5076
+ </fo:block-container>
4689
5077
  </xsl:template><xsl:template name="convertDate">
4690
5078
  <xsl:param name="date"/>
4691
5079
  <xsl:param name="format" select="'short'"/>
@@ -4893,6 +5281,9 @@
4893
5281
  <xsl:when test="parent::*[local-name() = 'preface']">
4894
5282
  <xsl:value-of select="$level_total - 1"/>
4895
5283
  </xsl:when>
5284
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5285
+ <xsl:value-of select="$level_total - 1"/>
5286
+ </xsl:when>
4896
5287
  <xsl:when test="ancestor::*[local-name() = 'preface']">
4897
5288
  <xsl:value-of select="$level_total - 2"/>
4898
5289
  </xsl:when>
@@ -4951,6 +5342,7 @@
4951
5342
 
4952
5343
 
4953
5344
 
5345
+
4954
5346
  <xsl:value-of select="document('')//*/namespace::un"/>
4955
5347
 
4956
5348
 
@@ -5017,17 +5409,69 @@
5017
5409
  </xsl:call-template>
5018
5410
  </xsl:if>
5019
5411
  </xsl:template><xsl:template name="getLocalizedString">
5020
- <xsl:param name="key"/>
5412
+ <xsl:param name="key"/>
5021
5413
 
5022
5414
  <xsl:variable name="curr_lang">
5023
5415
  <xsl:call-template name="getLang"/>
5024
5416
  </xsl:variable>
5025
5417
 
5418
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5419
+
5026
5420
  <xsl:choose>
5421
+ <xsl:when test="$data_value != ''">
5422
+ <xsl:value-of select="$data_value"/>
5423
+ </xsl:when>
5027
5424
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5028
5425
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5029
5426
  </xsl:when>
5030
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5427
+ <xsl:otherwise>
5428
+ <xsl:variable name="key_">
5429
+ <xsl:call-template name="capitalize">
5430
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5431
+ </xsl:call-template>
5432
+ </xsl:variable>
5433
+ <xsl:value-of select="$key_"/>
5434
+ </xsl:otherwise>
5031
5435
  </xsl:choose>
5032
5436
 
5437
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5438
+ <xsl:param name="isAdded"/>
5439
+ <xsl:param name="isDeleted"/>
5440
+ <xsl:choose>
5441
+ <xsl:when test="local-name() = 'math'">
5442
+ <xsl:if test="$isAdded = 'true'">
5443
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5444
+ </xsl:if>
5445
+ <xsl:if test="$isDeleted = 'true'">
5446
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5447
+ </xsl:if>
5448
+ </xsl:when>
5449
+ <xsl:otherwise>
5450
+ <xsl:if test="$isAdded = 'true'">
5451
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5452
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5453
+ </xsl:if>
5454
+ <xsl:if test="$isDeleted = 'true'">
5455
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5456
+ <xsl:if test="local-name() = 'table'">
5457
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5458
+ </xsl:if>
5459
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5460
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5461
+ </xsl:if>
5462
+ </xsl:otherwise>
5463
+ </xsl:choose>
5464
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5465
+ <xsl:if test="$lang = 'ar'">
5466
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5467
+ </xsl:if>
5468
+ </xsl:template><xsl:template name="setAlignment">
5469
+ <xsl:param name="align" select="normalize-space(@align)"/>
5470
+ <xsl:choose>
5471
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5472
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5473
+ <xsl:when test="$align != ''">
5474
+ <xsl:value-of select="$align"/>
5475
+ </xsl:when>
5476
+ </xsl:choose>
5033
5477
  </xsl:template></xsl:stylesheet>