metanorma-un 0.5.16 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -1325,6 +1326,9 @@
1325
1326
  <title-continued lang="en">(continued)</title-continued>
1326
1327
  <title-continued lang="fr">(continué)</title-continued>
1327
1328
 
1329
+ </xsl:variable><xsl:variable name="bibdata">
1330
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1331
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1328
1332
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1329
1333
  <xsl:param name="name"/>
1330
1334
  <xsl:param name="lang"/>
@@ -1350,10 +1354,13 @@
1350
1354
  </xsl:choose>
1351
1355
  </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">
1352
1356
 
1357
+
1353
1358
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1354
1359
 
1355
1360
 
1356
1361
 
1362
+
1363
+
1357
1364
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1358
1365
  <xsl:attribute name="white-space">pre</xsl:attribute>
1359
1366
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1412,6 +1419,7 @@
1412
1419
 
1413
1420
 
1414
1421
 
1422
+
1415
1423
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1416
1424
 
1417
1425
 
@@ -1428,9 +1436,7 @@
1428
1436
 
1429
1437
 
1430
1438
 
1431
-
1432
-
1433
-
1439
+
1434
1440
 
1435
1441
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1436
1442
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1467,6 +1473,7 @@
1467
1473
 
1468
1474
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1469
1475
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1476
+
1470
1477
 
1471
1478
 
1472
1479
 
@@ -1486,6 +1493,7 @@
1486
1493
 
1487
1494
 
1488
1495
 
1496
+
1489
1497
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1490
1498
 
1491
1499
 
@@ -1498,6 +1506,8 @@
1498
1506
 
1499
1507
 
1500
1508
 
1509
+
1510
+
1501
1511
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1502
1512
 
1503
1513
 
@@ -1505,10 +1515,12 @@
1505
1515
 
1506
1516
  <xsl:attribute name="color">blue</xsl:attribute>
1507
1517
 
1518
+
1508
1519
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1509
1520
 
1510
1521
 
1511
1522
 
1523
+
1512
1524
 
1513
1525
 
1514
1526
 
@@ -1534,6 +1546,7 @@
1534
1546
 
1535
1547
 
1536
1548
 
1549
+
1537
1550
  <xsl:attribute name="padding-right">4mm</xsl:attribute>
1538
1551
 
1539
1552
 
@@ -1558,11 +1571,13 @@
1558
1571
 
1559
1572
 
1560
1573
 
1574
+
1561
1575
 
1562
1576
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
1563
1577
 
1564
1578
 
1565
1579
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1580
+
1566
1581
 
1567
1582
 
1568
1583
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -1583,14 +1598,18 @@
1583
1598
 
1584
1599
 
1585
1600
 
1601
+
1602
+
1586
1603
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1587
1604
 
1588
1605
 
1589
1606
 
1607
+
1590
1608
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1591
1609
 
1592
1610
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1593
1611
 
1612
+
1594
1613
 
1595
1614
 
1596
1615
 
@@ -1619,6 +1638,7 @@
1619
1638
 
1620
1639
 
1621
1640
 
1641
+
1622
1642
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1623
1643
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1624
1644
  <xsl:attribute name="border">2pt solid black</xsl:attribute>
@@ -1630,6 +1650,7 @@
1630
1650
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1631
1651
 
1632
1652
 
1653
+
1633
1654
  <xsl:attribute name="width">100%</xsl:attribute>
1634
1655
  <xsl:attribute name="content-height">100%</xsl:attribute>
1635
1656
  <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
@@ -1653,13 +1674,34 @@
1653
1674
 
1654
1675
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1655
1676
 
1656
-
1677
+
1678
+
1657
1679
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1658
1680
 
1681
+
1659
1682
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1660
1683
 
1661
1684
 
1662
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1685
+
1686
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1687
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1688
+ </xsl:variable><xsl:attribute-set name="add-style">
1689
+ <xsl:attribute name="color">red</xsl:attribute>
1690
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1691
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1692
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1693
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1694
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1695
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1696
+ <xsl:text>red</xsl:text>
1697
+ </xsl:variable><xsl:attribute-set name="del-style">
1698
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1699
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1700
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1701
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1702
+
1703
+
1704
+ </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">
1663
1705
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1664
1706
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1665
1707
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1704,16 +1746,17 @@
1704
1746
  <xsl:call-template name="add-zero-spaces-java"/>
1705
1747
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1706
1748
 
1749
+ <xsl:variable name="table-preamble">
1750
+
1751
+
1752
+ </xsl:variable>
1753
+
1707
1754
  <xsl:variable name="table">
1708
1755
 
1709
1756
  <xsl:variable name="simple-table">
1710
1757
  <xsl:call-template name="getSimpleTable"/>
1711
1758
  </xsl:variable>
1712
1759
 
1713
-
1714
-
1715
-
1716
-
1717
1760
  <!-- <xsl:if test="$namespace = 'bipm'">
1718
1761
  <fo:block>&#xA0;</fo:block>
1719
1762
  </xsl:if> -->
@@ -1728,7 +1771,7 @@
1728
1771
 
1729
1772
 
1730
1773
 
1731
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1774
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1732
1775
 
1733
1776
  <!-- <xsl:variable name="cols-count">
1734
1777
  <xsl:choose>
@@ -1747,8 +1790,6 @@
1747
1790
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1748
1791
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1749
1792
 
1750
-
1751
-
1752
1793
  <xsl:variable name="colwidths">
1753
1794
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1754
1795
  <xsl:call-template name="calculate-column-widths">
@@ -1776,9 +1817,11 @@
1776
1817
  </xsl:choose>
1777
1818
  </xsl:variable>
1778
1819
 
1820
+
1779
1821
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1780
1822
 
1781
1823
 
1824
+
1782
1825
 
1783
1826
 
1784
1827
 
@@ -1794,6 +1837,8 @@
1794
1837
 
1795
1838
 
1796
1839
 
1840
+
1841
+
1797
1842
  <xsl:variable name="table_width">
1798
1843
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1799
1844
 
@@ -1815,6 +1860,8 @@
1815
1860
 
1816
1861
 
1817
1862
 
1863
+
1864
+
1818
1865
 
1819
1866
 
1820
1867
 
@@ -1906,7 +1953,8 @@
1906
1953
  </fo:block-container>
1907
1954
  </xsl:variable>
1908
1955
 
1909
-
1956
+ <xsl:variable name="isAdded" select="@added"/>
1957
+ <xsl:variable name="isDeleted" select="@deleted"/>
1910
1958
 
1911
1959
  <xsl:choose>
1912
1960
  <xsl:when test="@width">
@@ -1915,21 +1963,62 @@
1915
1963
 
1916
1964
 
1917
1965
 
1918
- <xsl:copy-of select="$table"/>
1966
+ <xsl:choose>
1967
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1968
+ <xsl:copy-of select="$table-preamble"/>
1969
+ <fo:block>
1970
+ <xsl:call-template name="setTrackChangesStyles">
1971
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1972
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1973
+ </xsl:call-template>
1974
+ <xsl:copy-of select="$table"/>
1975
+ </fo:block>
1976
+ </xsl:when>
1977
+ <xsl:otherwise>
1978
+ <xsl:copy-of select="$table-preamble"/>
1979
+ <xsl:copy-of select="$table"/>
1980
+ </xsl:otherwise>
1981
+ </xsl:choose>
1919
1982
 
1920
1983
 
1921
1984
  </xsl:when>
1922
1985
  <xsl:otherwise>
1923
- <xsl:copy-of select="$table"/>
1986
+ <xsl:choose>
1987
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1988
+ <xsl:copy-of select="$table-preamble"/>
1989
+ <fo:block>
1990
+ <xsl:call-template name="setTrackChangesStyles">
1991
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1992
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1993
+ </xsl:call-template>
1994
+ <xsl:copy-of select="$table"/>
1995
+ </fo:block>
1996
+ </xsl:when>
1997
+ <xsl:otherwise>
1998
+ <xsl:copy-of select="$table-preamble"/>
1999
+ <xsl:copy-of select="$table"/>
2000
+ </xsl:otherwise>
2001
+ </xsl:choose>
1924
2002
  </xsl:otherwise>
1925
2003
  </xsl:choose>
1926
2004
 
1927
2005
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2006
+ <xsl:param name="continued"/>
1928
2007
  <xsl:if test="normalize-space() != ''">
1929
2008
  <fo:block xsl:use-attribute-sets="table-name-style">
1930
2009
 
1931
2010
 
1932
- <xsl:apply-templates/>
2011
+ <xsl:choose>
2012
+ <xsl:when test="$continued = 'true'">
2013
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
2014
+
2015
+ </xsl:when>
2016
+ <xsl:otherwise>
2017
+ <xsl:apply-templates/>
2018
+ </xsl:otherwise>
2019
+ </xsl:choose>
2020
+
2021
+
1933
2022
  </fo:block>
1934
2023
  </xsl:if>
1935
2024
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1981,7 +2070,7 @@
1981
2070
  </xsl:for-each>
1982
2071
  </xsl:when>
1983
2072
  <xsl:otherwise>
1984
- <xsl:for-each select="xalan:nodeset($table)//tr">
2073
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1985
2074
  <xsl:variable name="td_text">
1986
2075
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1987
2076
 
@@ -2069,18 +2158,18 @@
2069
2158
  <xsl:apply-templates/>
2070
2159
  </fo:table-header>
2071
2160
  </xsl:template><xsl:template name="table-header-title">
2072
- <xsl:param name="cols-count"/>
2161
+ <xsl:param name="cols-count"/>
2073
2162
  <!-- row for title -->
2074
2163
  <fo:table-row>
2075
2164
  <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">
2076
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
2165
+
2166
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2167
+ <xsl:with-param name="continued">true</xsl:with-param>
2168
+ </xsl:apply-templates>
2077
2169
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2078
2170
  <xsl:call-template name="fn_name_display"/>
2079
- </xsl:for-each>
2080
- <fo:block text-align="right" font-style="italic">
2081
- <xsl:text> </xsl:text>
2082
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
2083
- </fo:block>
2171
+ </xsl:for-each>
2172
+
2084
2173
  </fo:table-cell>
2085
2174
  </fo:table-row>
2086
2175
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2301,6 +2390,7 @@
2301
2390
 
2302
2391
 
2303
2392
 
2393
+
2304
2394
  </xsl:if>
2305
2395
  <xsl:if test="$parent-name = 'tfoot'">
2306
2396
 
@@ -2325,7 +2415,8 @@
2325
2415
  <xsl:attribute name="text-align">
2326
2416
  <xsl:choose>
2327
2417
  <xsl:when test="@align">
2328
- <xsl:value-of select="@align"/>
2418
+ <xsl:call-template name="setAlignment"/>
2419
+ <!-- <xsl:value-of select="@align"/> -->
2329
2420
  </xsl:when>
2330
2421
  <xsl:otherwise>center</xsl:otherwise>
2331
2422
  </xsl:choose>
@@ -2339,6 +2430,7 @@
2339
2430
 
2340
2431
 
2341
2432
 
2433
+
2342
2434
  <xsl:attribute name="display-align">center</xsl:attribute>
2343
2435
  <xsl:attribute name="font-style">italic</xsl:attribute>
2344
2436
  <xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -2351,6 +2443,10 @@
2351
2443
 
2352
2444
 
2353
2445
 
2446
+
2447
+ <xsl:if test="$lang = 'ar'">
2448
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2449
+ </xsl:if>
2354
2450
  <xsl:if test="@colspan">
2355
2451
  <xsl:attribute name="number-columns-spanned">
2356
2452
  <xsl:value-of select="@colspan"/>
@@ -2382,11 +2478,16 @@
2382
2478
  <xsl:attribute name="text-align">
2383
2479
  <xsl:choose>
2384
2480
  <xsl:when test="@align">
2385
- <xsl:value-of select="@align"/>
2481
+ <xsl:call-template name="setAlignment"/>
2482
+ <!-- <xsl:value-of select="@align"/> -->
2386
2483
  </xsl:when>
2387
2484
  <xsl:otherwise>left</xsl:otherwise>
2388
2485
  </xsl:choose>
2389
2486
  </xsl:attribute>
2487
+ <xsl:if test="$lang = 'ar'">
2488
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2489
+ </xsl:if>
2490
+
2390
2491
 
2391
2492
 
2392
2493
 
@@ -2406,6 +2507,9 @@
2406
2507
 
2407
2508
 
2408
2509
 
2510
+ <xsl:if test=".//*[local-name() = 'table']">
2511
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2512
+ </xsl:if>
2409
2513
  <xsl:if test="@colspan">
2410
2514
  <xsl:attribute name="number-columns-spanned">
2411
2515
  <xsl:value-of select="@colspan"/>
@@ -2543,13 +2647,13 @@
2543
2647
  </xsl:choose>
2544
2648
  </xsl:variable>
2545
2649
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2546
- <xsl:element name="{$ns}:table">
2650
+ <!-- <xsl:element name="{$ns}:table"> -->
2547
2651
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2548
2652
  <tbody>
2549
2653
  <xsl:apply-templates mode="dl"/>
2550
2654
  </tbody>
2551
2655
  </xsl:for-each>
2552
- </xsl:element>
2656
+ <!-- </xsl:element> -->
2553
2657
  </xsl:variable>
2554
2658
 
2555
2659
  <xsl:call-template name="calculate-column-widths">
@@ -2640,6 +2744,8 @@
2640
2744
  <xsl:apply-templates/>
2641
2745
  </fo:inline>
2642
2746
  </xsl:template><xsl:template match="*[local-name()='dl']">
2747
+ <xsl:variable name="isAdded" select="@added"/>
2748
+ <xsl:variable name="isDeleted" select="@deleted"/>
2643
2749
  <fo:block-container>
2644
2750
 
2645
2751
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2656,6 +2762,12 @@
2656
2762
  </xsl:attribute>
2657
2763
 
2658
2764
  </xsl:if>
2765
+
2766
+ <xsl:call-template name="setTrackChangesStyles">
2767
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2768
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2769
+ </xsl:call-template>
2770
+
2659
2771
  <fo:block-container>
2660
2772
 
2661
2773
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2711,6 +2823,7 @@
2711
2823
 
2712
2824
 
2713
2825
 
2826
+
2714
2827
  <xsl:variable name="title-key">
2715
2828
 
2716
2829
 
@@ -2763,11 +2876,11 @@
2763
2876
  </xsl:choose>
2764
2877
  </xsl:variable>
2765
2878
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2766
- <xsl:element name="{$ns}:table">
2879
+ <!-- <xsl:element name="{$ns}:table"> -->
2767
2880
  <tbody>
2768
2881
  <xsl:apply-templates mode="dl"/>
2769
2882
  </tbody>
2770
- </xsl:element>
2883
+ <!-- </xsl:element> -->
2771
2884
  </xsl:variable>
2772
2885
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2773
2886
  <xsl:variable name="colwidths">
@@ -2992,6 +3105,8 @@
2992
3105
 
2993
3106
  <xsl:apply-templates/>
2994
3107
  </fo:inline>
3108
+ </xsl:template><xsl:template match="*[local-name()='padding']">
3109
+ <fo:inline padding-right="{@value}"> </fo:inline>
2995
3110
  </xsl:template><xsl:template match="*[local-name()='sup']">
2996
3111
  <fo:inline font-size="80%" vertical-align="super">
2997
3112
  <xsl:apply-templates/>
@@ -3017,6 +3132,7 @@
3017
3132
 
3018
3133
 
3019
3134
 
3135
+
3020
3136
 
3021
3137
  </xsl:variable>
3022
3138
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3034,8 +3150,74 @@
3034
3150
  <fo:inline text-decoration="underline">
3035
3151
  <xsl:apply-templates/>
3036
3152
  </fo:inline>
3153
+ </xsl:template><xsl:template match="*[local-name()='add']">
3154
+ <xsl:choose>
3155
+ <xsl:when test="@amendment">
3156
+ <fo:inline>
3157
+ <xsl:call-template name="insertTag">
3158
+ <xsl:with-param name="kind">A</xsl:with-param>
3159
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3160
+ </xsl:call-template>
3161
+ <xsl:apply-templates/>
3162
+ <xsl:call-template name="insertTag">
3163
+ <xsl:with-param name="type">closing</xsl:with-param>
3164
+ <xsl:with-param name="kind">A</xsl:with-param>
3165
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3166
+ </xsl:call-template>
3167
+ </fo:inline>
3168
+ </xsl:when>
3169
+ <xsl:when test="@corrigenda">
3170
+ <fo:inline>
3171
+ <xsl:call-template name="insertTag">
3172
+ <xsl:with-param name="kind">C</xsl:with-param>
3173
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3174
+ </xsl:call-template>
3175
+ <xsl:apply-templates/>
3176
+ <xsl:call-template name="insertTag">
3177
+ <xsl:with-param name="type">closing</xsl:with-param>
3178
+ <xsl:with-param name="kind">C</xsl:with-param>
3179
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3180
+ </xsl:call-template>
3181
+ </fo:inline>
3182
+ </xsl:when>
3183
+ <xsl:otherwise>
3184
+ <fo:inline xsl:use-attribute-sets="add-style">
3185
+ <xsl:apply-templates/>
3186
+ </fo:inline>
3187
+ </xsl:otherwise>
3188
+ </xsl:choose>
3189
+
3190
+ </xsl:template><xsl:template name="insertTag">
3191
+ <xsl:param name="type"/>
3192
+ <xsl:param name="kind"/>
3193
+ <xsl:param name="value"/>
3194
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3195
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3196
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3197
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3198
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3199
+ <xsl:attribute name="height">5mm</xsl:attribute>
3200
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3201
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3202
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3203
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3204
+ <g>
3205
+ <xsl:if test="$type = 'closing'">
3206
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3207
+ </xsl:if>
3208
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3209
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3210
+ </g>
3211
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3212
+ <xsl:if test="$type = 'closing'">
3213
+ <xsl:attribute name="x">25</xsl:attribute>
3214
+ </xsl:if>
3215
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3216
+ </text>
3217
+ </svg>
3218
+ </fo:instream-foreign-object>
3037
3219
  </xsl:template><xsl:template match="*[local-name()='del']">
3038
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3220
+ <fo:inline xsl:use-attribute-sets="del-style">
3039
3221
  <xsl:apply-templates/>
3040
3222
  </fo:inline>
3041
3223
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -3332,11 +3514,15 @@
3332
3514
  </xsl:apply-templates>
3333
3515
  </xsl:template><xsl:template name="getLang">
3334
3516
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3517
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3335
3518
  <xsl:variable name="language">
3336
3519
  <xsl:choose>
3337
3520
  <xsl:when test="$language_current != ''">
3338
3521
  <xsl:value-of select="$language_current"/>
3339
3522
  </xsl:when>
3523
+ <xsl:when test="$language_current_2 != ''">
3524
+ <xsl:value-of select="$language_current_2"/>
3525
+ </xsl:when>
3340
3526
  <xsl:otherwise>
3341
3527
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3342
3528
  </xsl:otherwise>
@@ -3376,13 +3562,23 @@
3376
3562
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3377
3563
  <xsl:value-of select="substring($str, 2)"/>
3378
3564
  </xsl:template><xsl:template match="mathml:math">
3379
- <fo:inline font-family="STIX Two Math"> <!-- -->
3565
+ <xsl:variable name="isAdded" select="@added"/>
3566
+ <xsl:variable name="isDeleted" select="@deleted"/>
3567
+
3568
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3569
+
3570
+
3571
+ <xsl:call-template name="setTrackChangesStyles">
3572
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3573
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3574
+ </xsl:call-template>
3380
3575
 
3381
3576
  <xsl:variable name="mathml">
3382
3577
  <xsl:apply-templates select="." mode="mathml"/>
3383
3578
  </xsl:variable>
3384
3579
  <fo:instream-foreign-object fox:alt-text="Math">
3385
3580
 
3581
+
3386
3582
  <!-- <xsl:copy-of select="."/> -->
3387
3583
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3388
3584
  </fo:instream-foreign-object>
@@ -3403,6 +3599,16 @@
3403
3599
  <mathml:mspace width="0.5ex"/>
3404
3600
  </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">
3405
3601
  <xsl:variable name="target">
3602
+ <xsl:choose>
3603
+ <xsl:when test="@updatetype = 'true'">
3604
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3605
+ </xsl:when>
3606
+ <xsl:otherwise>
3607
+ <xsl:value-of select="normalize-space(@target)"/>
3608
+ </xsl:otherwise>
3609
+ </xsl:choose>
3610
+ </xsl:variable>
3611
+ <xsl:variable name="target_text">
3406
3612
  <xsl:choose>
3407
3613
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3408
3614
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3415,19 +3621,19 @@
3415
3621
  <fo:inline xsl:use-attribute-sets="link-style">
3416
3622
 
3417
3623
  <xsl:choose>
3418
- <xsl:when test="$target = ''">
3624
+ <xsl:when test="$target_text = ''">
3419
3625
  <xsl:apply-templates/>
3420
3626
  </xsl:when>
3421
3627
  <xsl:otherwise>
3422
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3628
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3423
3629
  <xsl:choose>
3424
3630
  <xsl:when test="normalize-space(.) = ''">
3425
- <!-- <xsl:value-of select="$target"/> -->
3426
3631
  <xsl:call-template name="add-zero-spaces-link-java">
3427
- <xsl:with-param name="text" select="$target"/>
3632
+ <xsl:with-param name="text" select="$target_text"/>
3428
3633
  </xsl:call-template>
3429
3634
  </xsl:when>
3430
3635
  <xsl:otherwise>
3636
+ <!-- output text from <link>text</link> -->
3431
3637
  <xsl:apply-templates/>
3432
3638
  </xsl:otherwise>
3433
3639
  </xsl:choose>
@@ -3548,6 +3754,7 @@
3548
3754
 
3549
3755
 
3550
3756
  <fo:inline xsl:use-attribute-sets="note-name-style">
3757
+
3551
3758
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3552
3759
  </fo:inline>
3553
3760
  <xsl:apply-templates/>
@@ -3574,6 +3781,7 @@
3574
3781
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3575
3782
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3576
3783
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3784
+
3577
3785
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3578
3786
  </fo:inline>
3579
3787
  <xsl:apply-templates/>
@@ -3639,8 +3847,15 @@
3639
3847
  </fo:inline>
3640
3848
  </xsl:if>
3641
3849
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3850
+ <xsl:variable name="isAdded" select="@added"/>
3851
+ <xsl:variable name="isDeleted" select="@deleted"/>
3642
3852
  <fo:block-container id="{@id}">
3643
3853
 
3854
+ <xsl:call-template name="setTrackChangesStyles">
3855
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3856
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3857
+ </xsl:call-template>
3858
+
3644
3859
  <fo:block>
3645
3860
  <xsl:apply-templates/>
3646
3861
  </fo:block>
@@ -3648,7 +3863,10 @@
3648
3863
  <xsl:for-each select="*[local-name() = 'note']">
3649
3864
  <xsl:call-template name="note"/>
3650
3865
  </xsl:for-each>
3651
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3866
+
3867
+
3868
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3869
+
3652
3870
  </fo:block-container>
3653
3871
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3654
3872
  <fo:block id="{@id}">
@@ -3660,37 +3878,122 @@
3660
3878
  <xsl:apply-templates/>
3661
3879
  </fo:block>
3662
3880
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3663
- <fo:block xsl:use-attribute-sets="image-style">
3664
-
3665
-
3666
- <xsl:variable name="src">
3667
- <xsl:choose>
3668
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3669
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3670
- </xsl:when>
3671
- <xsl:otherwise>
3672
- <xsl:value-of select="@src"/>
3673
- </xsl:otherwise>
3674
- </xsl:choose>
3675
- </xsl:variable>
3676
-
3677
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3678
- </fo:block>
3881
+ <xsl:variable name="isAdded" select="../@added"/>
3882
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3883
+ <xsl:choose>
3884
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3885
+ <fo:inline padding-left="1mm" padding-right="1mm">
3886
+ <xsl:variable name="src">
3887
+ <xsl:call-template name="image_src"/>
3888
+ </xsl:variable>
3889
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3890
+ </fo:inline>
3891
+ </xsl:when>
3892
+ <xsl:otherwise>
3893
+ <fo:block xsl:use-attribute-sets="image-style">
3894
+
3895
+ <xsl:variable name="src">
3896
+ <xsl:call-template name="image_src"/>
3897
+ </xsl:variable>
3898
+
3899
+ <xsl:choose>
3900
+ <xsl:when test="$isDeleted = 'true'">
3901
+ <!-- enclose in svg -->
3902
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3903
+ <xsl:attribute name="width">100%</xsl:attribute>
3904
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3905
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3906
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3907
+
3908
+
3909
+ <xsl:apply-templates select="." mode="cross_image"/>
3910
+
3911
+ </fo:instream-foreign-object>
3912
+ </xsl:when>
3913
+ <xsl:otherwise>
3914
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3915
+ </xsl:otherwise>
3916
+ </xsl:choose>
3917
+
3918
+ </fo:block>
3919
+ </xsl:otherwise>
3920
+ </xsl:choose>
3921
+ </xsl:template><xsl:template name="image_src">
3922
+ <xsl:choose>
3923
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3924
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3925
+ </xsl:when>
3926
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3927
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3928
+ </xsl:when>
3929
+ <xsl:otherwise>
3930
+ <xsl:value-of select="@src"/>
3931
+ </xsl:otherwise>
3932
+ </xsl:choose>
3933
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3934
+ <xsl:choose>
3935
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3936
+ <xsl:variable name="src">
3937
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3938
+ </xsl:variable>
3939
+ <xsl:variable name="width" select="document($src)/@width"/>
3940
+ <xsl:variable name="height" select="document($src)/@height"/>
3941
+ <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">
3942
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3943
+ </svg>
3944
+ </xsl:when>
3945
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3946
+ <xsl:variable name="src">
3947
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3948
+ </xsl:variable>
3949
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3950
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3951
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3952
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3953
+ <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">
3954
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3955
+ </svg>
3956
+ </xsl:when>
3957
+ <xsl:otherwise>
3958
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3959
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3960
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3961
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3962
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3963
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3964
+ <!-- width=<xsl:value-of select="$width"/> -->
3965
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3966
+ <!-- height=<xsl:value-of select="$height"/> -->
3967
+ <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">
3968
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3969
+ <xsl:call-template name="svg_cross">
3970
+ <xsl:with-param name="width" select="$width"/>
3971
+ <xsl:with-param name="height" select="$height"/>
3972
+ </xsl:call-template>
3973
+ </svg>
3974
+ </xsl:otherwise>
3975
+ </xsl:choose>
3976
+
3977
+ </xsl:template><xsl:template name="svg_cross">
3978
+ <xsl:param name="width"/>
3979
+ <xsl:param name="height"/>
3980
+ <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; "/>
3981
+ <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; "/>
3679
3982
  </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">
3680
3983
  <xsl:apply-templates mode="contents"/>
3681
3984
  <xsl:text> </xsl:text>
3682
3985
  </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">
3683
3986
  <xsl:apply-templates mode="bookmarks"/>
3684
3987
  <xsl:text> </xsl:text>
3685
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3988
+ </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">
3686
3989
  <xsl:value-of select="."/>
3687
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3990
+ </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">
3688
3991
  <xsl:value-of select="."/>
3689
3992
  </xsl:template><xsl:template match="node()" mode="contents">
3690
3993
  <xsl:apply-templates mode="contents"/>
3691
3994
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3692
3995
  <xsl:apply-templates mode="bookmarks"/>
3693
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3996
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3694
3997
  <xsl:apply-templates select="."/>
3695
3998
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3696
3999
  <xsl:apply-templates mode="bookmarks"/>
@@ -3889,6 +4192,8 @@
3889
4192
  </fo:list-item-body>
3890
4193
  </fo:list-item>
3891
4194
  </fo:list-block>
4195
+ </xsl:template><xsl:template name="extractSection">
4196
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3892
4197
  </xsl:template><xsl:template name="extractTitle">
3893
4198
  <xsl:choose>
3894
4199
  <xsl:when test="*[local-name() = 'tab']">
@@ -3915,6 +4220,7 @@
3915
4220
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3916
4221
 
3917
4222
  <fo:block-container margin-left="0mm">
4223
+ <xsl:copy-of select="@id"/>
3918
4224
  <xsl:if test="parent::*[local-name() = 'note']">
3919
4225
  <xsl:attribute name="margin-left">
3920
4226
  <xsl:choose>
@@ -3936,6 +4242,7 @@
3936
4242
 
3937
4243
 
3938
4244
 
4245
+
3939
4246
 
3940
4247
 
3941
4248
 
@@ -4191,6 +4498,7 @@
4191
4498
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4192
4499
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4193
4500
 
4501
+
4194
4502
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4195
4503
 
4196
4504
  <xsl:variable name="element">
@@ -4218,6 +4526,7 @@
4218
4526
  <xsl:variable name="element">
4219
4527
  block
4220
4528
 
4529
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4221
4530
  </xsl:variable>
4222
4531
  <xsl:choose>
4223
4532
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4225,7 +4534,7 @@
4225
4534
  <xsl:apply-templates/>
4226
4535
  </fo:inline>
4227
4536
  </xsl:when>
4228
- <xsl:when test="normalize-space($element) = 'block'">
4537
+ <xsl:when test="contains(normalize-space($element), 'block')">
4229
4538
  <fo:block xsl:use-attribute-sets="example-name-style">
4230
4539
  <xsl:apply-templates/>
4231
4540
  </fo:block>
@@ -4262,7 +4571,7 @@
4262
4571
  </fo:inline>
4263
4572
  </xsl:otherwise>
4264
4573
  </xsl:choose>
4265
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4574
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
4266
4575
  <fo:block xsl:use-attribute-sets="termsource-style">
4267
4576
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
4268
4577
  <xsl:variable name="termsource_text">
@@ -4271,13 +4580,15 @@
4271
4580
 
4272
4581
  <xsl:choose>
4273
4582
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4274
- <xsl:apply-templates/>
4583
+ <!-- <xsl:apply-templates /> -->
4584
+ <xsl:copy-of select="$termsource_text"/>
4275
4585
  </xsl:when>
4276
4586
  <xsl:otherwise>
4277
4587
 
4278
4588
  <xsl:text>[</xsl:text>
4279
4589
 
4280
- <xsl:apply-templates/>
4590
+ <!-- <xsl:apply-templates /> -->
4591
+ <xsl:copy-of select="$termsource_text"/>
4281
4592
 
4282
4593
  <xsl:text>]</xsl:text>
4283
4594
 
@@ -4288,8 +4599,15 @@
4288
4599
  <xsl:if test="normalize-space() != ''">
4289
4600
  <xsl:value-of select="."/>
4290
4601
  </xsl:if>
4291
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4602
+ </xsl:template><xsl:variable name="localized.source">
4603
+ <xsl:call-template name="getLocalizedString">
4604
+ <xsl:with-param name="key">source</xsl:with-param>
4605
+ </xsl:call-template>
4606
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4292
4607
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4608
+ <xsl:if test="normalize-space(@citeas) = ''">
4609
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4610
+ </xsl:if>
4293
4611
 
4294
4612
  <fo:inline xsl:use-attribute-sets="origin-style">
4295
4613
  <xsl:apply-templates/>
@@ -4405,6 +4723,7 @@
4405
4723
 
4406
4724
 
4407
4725
 
4726
+
4408
4727
  <xsl:choose>
4409
4728
  <xsl:when test="ancestor::un:sections and $depth = 1">12</xsl:when>
4410
4729
  <xsl:when test="ancestor::un:sections">8</xsl:when>
@@ -4438,7 +4757,8 @@
4438
4757
  </fo:inline>
4439
4758
  </xsl:when>
4440
4759
  <xsl:otherwise>
4441
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4760
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4761
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4442
4762
  </xsl:otherwise>
4443
4763
  </xsl:choose>
4444
4764
 
@@ -4497,7 +4817,6 @@
4497
4817
  </xsl:if>
4498
4818
 
4499
4819
 
4500
-
4501
4820
  <xsl:apply-templates/>
4502
4821
  </fo:block>
4503
4822
 
@@ -4545,7 +4864,7 @@
4545
4864
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4546
4865
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4547
4866
  <xsl:choose>
4548
- <xsl:when test="parent::*[local-name() = 'note']">
4867
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4549
4868
  <fo:block-container>
4550
4869
  <xsl:attribute name="margin-left">
4551
4870
  <xsl:choose>
@@ -4555,6 +4874,7 @@
4555
4874
  </xsl:attribute>
4556
4875
 
4557
4876
 
4877
+
4558
4878
  <fo:block-container margin-left="0mm">
4559
4879
  <fo:block>
4560
4880
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4756,6 +5076,10 @@
4756
5076
 
4757
5077
 
4758
5078
 
5079
+
5080
+
5081
+
5082
+
4759
5083
  </xsl:template><xsl:template name="processBibitemDocId">
4760
5084
  <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')]"/>
4761
5085
  <xsl:choose>
@@ -4812,6 +5136,70 @@
4812
5136
  <xsl:value-of select="substring(.,1,1)"/>
4813
5137
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4814
5138
  <fo:inline><xsl:apply-templates/></fo:inline>
5139
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
5140
+ <fo:block>
5141
+ <xsl:apply-templates/>
5142
+ </fo:block>
5143
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
5144
+ <fo:inline><xsl:apply-templates/></fo:inline>
5145
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
5146
+ <fo:inline>
5147
+ <xsl:call-template name="text_input"/>
5148
+ </fo:inline>
5149
+ </xsl:template><xsl:template name="text_input">
5150
+ <xsl:variable name="count">
5151
+ <xsl:choose>
5152
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
5153
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
5154
+ <xsl:otherwise>10</xsl:otherwise>
5155
+ </xsl:choose>
5156
+ </xsl:variable>
5157
+ <xsl:call-template name="repeat">
5158
+ <xsl:with-param name="char" select="'_'"/>
5159
+ <xsl:with-param name="count" select="$count"/>
5160
+ </xsl:call-template>
5161
+ <xsl:text> </xsl:text>
5162
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
5163
+ <xsl:variable name="caption">
5164
+ <xsl:choose>
5165
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
5166
+ <xsl:otherwise>BUTTON</xsl:otherwise>
5167
+ </xsl:choose>
5168
+ </xsl:variable>
5169
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
5170
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
5171
+ <fo:inline padding-right="1mm">
5172
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5173
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5174
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5175
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5176
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5177
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5178
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
5179
+ </svg>
5180
+ </fo:instream-foreign-object>
5181
+ </fo:inline>
5182
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5183
+ <fo:inline padding-right="1mm">
5184
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5185
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5186
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5187
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5188
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5189
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5190
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5191
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5192
+ </svg>
5193
+ </fo:instream-foreign-object>
5194
+ </fo:inline>
5195
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5196
+ <fo:inline>
5197
+ <xsl:call-template name="text_input"/>
5198
+ </fo:inline>
5199
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5200
+ <fo:block-container border="1pt solid black" width="50%">
5201
+ <fo:block> </fo:block>
5202
+ </fo:block-container>
4815
5203
  </xsl:template><xsl:template name="convertDate">
4816
5204
  <xsl:param name="date"/>
4817
5205
  <xsl:param name="format" select="'short'"/>
@@ -5019,6 +5407,9 @@
5019
5407
  <xsl:when test="parent::*[local-name() = 'preface']">
5020
5408
  <xsl:value-of select="$level_total - 1"/>
5021
5409
  </xsl:when>
5410
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5411
+ <xsl:value-of select="$level_total - 1"/>
5412
+ </xsl:when>
5022
5413
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5023
5414
  <xsl:value-of select="$level_total - 2"/>
5024
5415
  </xsl:when>
@@ -5077,6 +5468,7 @@
5077
5468
 
5078
5469
 
5079
5470
 
5471
+
5080
5472
  <xsl:value-of select="document('')//*/namespace::un"/>
5081
5473
 
5082
5474
 
@@ -5143,17 +5535,69 @@
5143
5535
  </xsl:call-template>
5144
5536
  </xsl:if>
5145
5537
  </xsl:template><xsl:template name="getLocalizedString">
5146
- <xsl:param name="key"/>
5538
+ <xsl:param name="key"/>
5147
5539
 
5148
5540
  <xsl:variable name="curr_lang">
5149
5541
  <xsl:call-template name="getLang"/>
5150
5542
  </xsl:variable>
5151
5543
 
5544
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5545
+
5152
5546
  <xsl:choose>
5547
+ <xsl:when test="$data_value != ''">
5548
+ <xsl:value-of select="$data_value"/>
5549
+ </xsl:when>
5153
5550
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5154
5551
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5155
5552
  </xsl:when>
5156
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5553
+ <xsl:otherwise>
5554
+ <xsl:variable name="key_">
5555
+ <xsl:call-template name="capitalize">
5556
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5557
+ </xsl:call-template>
5558
+ </xsl:variable>
5559
+ <xsl:value-of select="$key_"/>
5560
+ </xsl:otherwise>
5157
5561
  </xsl:choose>
5158
5562
 
5563
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5564
+ <xsl:param name="isAdded"/>
5565
+ <xsl:param name="isDeleted"/>
5566
+ <xsl:choose>
5567
+ <xsl:when test="local-name() = 'math'">
5568
+ <xsl:if test="$isAdded = 'true'">
5569
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5570
+ </xsl:if>
5571
+ <xsl:if test="$isDeleted = 'true'">
5572
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5573
+ </xsl:if>
5574
+ </xsl:when>
5575
+ <xsl:otherwise>
5576
+ <xsl:if test="$isAdded = 'true'">
5577
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5578
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5579
+ </xsl:if>
5580
+ <xsl:if test="$isDeleted = 'true'">
5581
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5582
+ <xsl:if test="local-name() = 'table'">
5583
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5584
+ </xsl:if>
5585
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5586
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5587
+ </xsl:if>
5588
+ </xsl:otherwise>
5589
+ </xsl:choose>
5590
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5591
+ <xsl:if test="$lang = 'ar'">
5592
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5593
+ </xsl:if>
5594
+ </xsl:template><xsl:template name="setAlignment">
5595
+ <xsl:param name="align" select="normalize-space(@align)"/>
5596
+ <xsl:choose>
5597
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5598
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5599
+ <xsl:when test="$align != ''">
5600
+ <xsl:value-of select="$align"/>
5601
+ </xsl:when>
5602
+ </xsl:choose>
5159
5603
  </xsl:template></xsl:stylesheet>