metanorma-un 0.5.14 → 0.6.2

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.
@@ -115,6 +115,13 @@ a.FootnoteRef + a.FootnoteRef:before {
115
115
  content: ", ";
116
116
  vertical-align: super; }
117
117
 
118
+ .addition {
119
+ color: blue; }
120
+
121
+ .deletion {
122
+ color: red;
123
+ text-decoration: line-through; }
124
+
118
125
  #standard-band {
119
126
  background-color: #0AC442; }
120
127
 
@@ -37,7 +37,6 @@ module IsoDoc
37
37
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
38
38
  htmlcoverpage: html_doc_path("html_unece_titlepage.html"),
39
39
  htmlintropage: html_doc_path("html_unece_intro.html"),
40
- scripts: html_doc_path("scripts.html"),
41
40
  }
42
41
  end
43
42
 
@@ -3,7 +3,9 @@
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
 
9
11
 
@@ -72,7 +74,9 @@
72
74
  </fo:page-sequence-master>
73
75
  </fo:layout-master-set>
74
76
 
75
- <xsl:call-template name="addPDFUAmeta"/>
77
+ <fo:declarations>
78
+ <xsl:call-template name="addPDFUAmeta"/>
79
+ </fo:declarations>
76
80
 
77
81
  <xsl:call-template name="addBookmarks">
78
82
  <xsl:with-param name="contents" select="$contents"/>
@@ -1347,6 +1351,7 @@
1347
1351
  </xsl:choose>
1348
1352
  </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">
1349
1353
 
1354
+
1350
1355
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1351
1356
 
1352
1357
 
@@ -1448,6 +1453,7 @@
1448
1453
 
1449
1454
 
1450
1455
 
1456
+
1451
1457
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1452
1458
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1453
1459
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1649,13 +1655,31 @@
1649
1655
 
1650
1656
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1651
1657
 
1652
-
1658
+
1653
1659
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1654
1660
 
1655
1661
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1656
1662
 
1657
1663
 
1658
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1664
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1665
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1666
+ </xsl:variable><xsl:attribute-set name="add-style">
1667
+ <xsl:attribute name="color">red</xsl:attribute>
1668
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1669
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1670
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1671
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1672
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1673
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1674
+ <xsl:text>red</xsl:text>
1675
+ </xsl:variable><xsl:attribute-set name="del-style">
1676
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1677
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1678
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1679
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1680
+
1681
+
1682
+ </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">
1659
1683
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1660
1684
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1661
1685
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1700,16 +1724,17 @@
1700
1724
  <xsl:call-template name="add-zero-spaces-java"/>
1701
1725
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1702
1726
 
1727
+ <xsl:variable name="table-preamble">
1728
+
1729
+
1730
+ </xsl:variable>
1731
+
1703
1732
  <xsl:variable name="table">
1704
1733
 
1705
1734
  <xsl:variable name="simple-table">
1706
1735
  <xsl:call-template name="getSimpleTable"/>
1707
1736
  </xsl:variable>
1708
1737
 
1709
-
1710
-
1711
-
1712
-
1713
1738
  <!-- <xsl:if test="$namespace = 'bipm'">
1714
1739
  <fo:block>&#xA0;</fo:block>
1715
1740
  </xsl:if> -->
@@ -1724,7 +1749,7 @@
1724
1749
 
1725
1750
 
1726
1751
 
1727
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1752
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1728
1753
 
1729
1754
  <!-- <xsl:variable name="cols-count">
1730
1755
  <xsl:choose>
@@ -1743,8 +1768,6 @@
1743
1768
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1744
1769
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1745
1770
 
1746
-
1747
-
1748
1771
  <xsl:variable name="colwidths">
1749
1772
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1750
1773
  <xsl:call-template name="calculate-column-widths">
@@ -1772,6 +1795,7 @@
1772
1795
  </xsl:choose>
1773
1796
  </xsl:variable>
1774
1797
 
1798
+
1775
1799
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1776
1800
 
1777
1801
 
@@ -1811,6 +1835,7 @@
1811
1835
 
1812
1836
 
1813
1837
 
1838
+
1814
1839
 
1815
1840
 
1816
1841
 
@@ -1902,7 +1927,8 @@
1902
1927
  </fo:block-container>
1903
1928
  </xsl:variable>
1904
1929
 
1905
-
1930
+ <xsl:variable name="isAdded" select="@added"/>
1931
+ <xsl:variable name="isDeleted" select="@deleted"/>
1906
1932
 
1907
1933
  <xsl:choose>
1908
1934
  <xsl:when test="@width">
@@ -1911,12 +1937,42 @@
1911
1937
 
1912
1938
 
1913
1939
 
1914
- <xsl:copy-of select="$table"/>
1940
+ <xsl:choose>
1941
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1942
+ <xsl:copy-of select="$table-preamble"/>
1943
+ <fo:block>
1944
+ <xsl:call-template name="setTrackChangesStyles">
1945
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1946
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1947
+ </xsl:call-template>
1948
+ <xsl:copy-of select="$table"/>
1949
+ </fo:block>
1950
+ </xsl:when>
1951
+ <xsl:otherwise>
1952
+ <xsl:copy-of select="$table-preamble"/>
1953
+ <xsl:copy-of select="$table"/>
1954
+ </xsl:otherwise>
1955
+ </xsl:choose>
1915
1956
 
1916
1957
 
1917
1958
  </xsl:when>
1918
1959
  <xsl:otherwise>
1919
- <xsl:copy-of select="$table"/>
1960
+ <xsl:choose>
1961
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1962
+ <xsl:copy-of select="$table-preamble"/>
1963
+ <fo:block>
1964
+ <xsl:call-template name="setTrackChangesStyles">
1965
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1966
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1967
+ </xsl:call-template>
1968
+ <xsl:copy-of select="$table"/>
1969
+ </fo:block>
1970
+ </xsl:when>
1971
+ <xsl:otherwise>
1972
+ <xsl:copy-of select="$table-preamble"/>
1973
+ <xsl:copy-of select="$table"/>
1974
+ </xsl:otherwise>
1975
+ </xsl:choose>
1920
1976
  </xsl:otherwise>
1921
1977
  </xsl:choose>
1922
1978
 
@@ -1977,7 +2033,7 @@
1977
2033
  </xsl:for-each>
1978
2034
  </xsl:when>
1979
2035
  <xsl:otherwise>
1980
- <xsl:for-each select="xalan:nodeset($table)//tr">
2036
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1981
2037
  <xsl:variable name="td_text">
1982
2038
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1983
2039
 
@@ -2047,7 +2103,15 @@
2047
2103
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2048
2104
  <xsl:value-of select="@target"/>
2049
2105
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2050
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2106
+ <xsl:variable name="mathml">
2107
+ <xsl:for-each select="*">
2108
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2109
+ <xsl:copy-of select="."/>
2110
+ </xsl:if>
2111
+ </xsl:for-each>
2112
+ </xsl:variable>
2113
+
2114
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2051
2115
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2052
2116
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2053
2117
  <xsl:param name="cols-count"/>
@@ -2313,7 +2377,8 @@
2313
2377
  <xsl:attribute name="text-align">
2314
2378
  <xsl:choose>
2315
2379
  <xsl:when test="@align">
2316
- <xsl:value-of select="@align"/>
2380
+ <xsl:call-template name="setAlignment"/>
2381
+ <!-- <xsl:value-of select="@align"/> -->
2317
2382
  </xsl:when>
2318
2383
  <xsl:otherwise>center</xsl:otherwise>
2319
2384
  </xsl:choose>
@@ -2339,6 +2404,9 @@
2339
2404
 
2340
2405
 
2341
2406
 
2407
+ <xsl:if test="$lang = 'ar'">
2408
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2409
+ </xsl:if>
2342
2410
  <xsl:if test="@colspan">
2343
2411
  <xsl:attribute name="number-columns-spanned">
2344
2412
  <xsl:value-of select="@colspan"/>
@@ -2370,11 +2438,16 @@
2370
2438
  <xsl:attribute name="text-align">
2371
2439
  <xsl:choose>
2372
2440
  <xsl:when test="@align">
2373
- <xsl:value-of select="@align"/>
2441
+ <xsl:call-template name="setAlignment"/>
2442
+ <!-- <xsl:value-of select="@align"/> -->
2374
2443
  </xsl:when>
2375
2444
  <xsl:otherwise>left</xsl:otherwise>
2376
2445
  </xsl:choose>
2377
2446
  </xsl:attribute>
2447
+ <xsl:if test="$lang = 'ar'">
2448
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2449
+ </xsl:if>
2450
+
2378
2451
 
2379
2452
 
2380
2453
 
@@ -2394,6 +2467,9 @@
2394
2467
 
2395
2468
 
2396
2469
 
2470
+ <xsl:if test=".//*[local-name() = 'table']">
2471
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2472
+ </xsl:if>
2397
2473
  <xsl:if test="@colspan">
2398
2474
  <xsl:attribute name="number-columns-spanned">
2399
2475
  <xsl:value-of select="@colspan"/>
@@ -2531,13 +2607,13 @@
2531
2607
  </xsl:choose>
2532
2608
  </xsl:variable>
2533
2609
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2534
- <xsl:element name="{$ns}:table">
2610
+ <!-- <xsl:element name="{$ns}:table"> -->
2535
2611
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2536
2612
  <tbody>
2537
2613
  <xsl:apply-templates mode="dl"/>
2538
2614
  </tbody>
2539
2615
  </xsl:for-each>
2540
- </xsl:element>
2616
+ <!-- </xsl:element> -->
2541
2617
  </xsl:variable>
2542
2618
 
2543
2619
  <xsl:call-template name="calculate-column-widths">
@@ -2628,6 +2704,8 @@
2628
2704
  <xsl:apply-templates/>
2629
2705
  </fo:inline>
2630
2706
  </xsl:template><xsl:template match="*[local-name()='dl']">
2707
+ <xsl:variable name="isAdded" select="@added"/>
2708
+ <xsl:variable name="isDeleted" select="@deleted"/>
2631
2709
  <fo:block-container>
2632
2710
 
2633
2711
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2644,6 +2722,12 @@
2644
2722
  </xsl:attribute>
2645
2723
 
2646
2724
  </xsl:if>
2725
+
2726
+ <xsl:call-template name="setTrackChangesStyles">
2727
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2728
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2729
+ </xsl:call-template>
2730
+
2647
2731
  <fo:block-container>
2648
2732
 
2649
2733
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2751,11 +2835,11 @@
2751
2835
  </xsl:choose>
2752
2836
  </xsl:variable>
2753
2837
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2754
- <xsl:element name="{$ns}:table">
2838
+ <!-- <xsl:element name="{$ns}:table"> -->
2755
2839
  <tbody>
2756
2840
  <xsl:apply-templates mode="dl"/>
2757
2841
  </tbody>
2758
- </xsl:element>
2842
+ <!-- </xsl:element> -->
2759
2843
  </xsl:variable>
2760
2844
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2761
2845
  <xsl:variable name="colwidths">
@@ -3022,8 +3106,78 @@
3022
3106
  <fo:inline text-decoration="underline">
3023
3107
  <xsl:apply-templates/>
3024
3108
  </fo:inline>
3109
+ </xsl:template><xsl:template match="*[local-name()='add']">
3110
+ <xsl:choose>
3111
+ <xsl:when test="@amendment">
3112
+ <fo:inline>
3113
+ <xsl:call-template name="insertTag">
3114
+ <xsl:with-param name="kind">A</xsl:with-param>
3115
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3116
+ </xsl:call-template>
3117
+ <xsl:apply-templates/>
3118
+ <xsl:call-template name="insertTag">
3119
+ <xsl:with-param name="type">closing</xsl:with-param>
3120
+ <xsl:with-param name="kind">A</xsl:with-param>
3121
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3122
+ </xsl:call-template>
3123
+ </fo:inline>
3124
+ </xsl:when>
3125
+ <xsl:when test="@corrigenda">
3126
+ <fo:inline>
3127
+ <xsl:call-template name="insertTag">
3128
+ <xsl:with-param name="kind">C</xsl:with-param>
3129
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3130
+ </xsl:call-template>
3131
+ <xsl:apply-templates/>
3132
+ <xsl:call-template name="insertTag">
3133
+ <xsl:with-param name="type">closing</xsl:with-param>
3134
+ <xsl:with-param name="kind">C</xsl:with-param>
3135
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3136
+ </xsl:call-template>
3137
+ </fo:inline>
3138
+ </xsl:when>
3139
+ <xsl:otherwise>
3140
+ <fo:inline xsl:use-attribute-sets="add-style">
3141
+ <xsl:apply-templates/>
3142
+ </fo:inline>
3143
+ </xsl:otherwise>
3144
+ </xsl:choose>
3145
+
3146
+ </xsl:template><xsl:template name="insertTag">
3147
+ <xsl:param name="type"/>
3148
+ <xsl:param name="kind"/>
3149
+ <xsl:param name="value"/>
3150
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3151
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3152
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3153
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3154
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3155
+ <xsl:attribute name="height">5mm</xsl:attribute>
3156
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3157
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3158
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3159
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3160
+ <g>
3161
+ <xsl:if test="$type = 'closing'">
3162
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3163
+ </xsl:if>
3164
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3165
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3166
+ </g>
3167
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3168
+ <xsl:if test="$type = 'closing'">
3169
+ <xsl:attribute name="x">25</xsl:attribute>
3170
+ </xsl:if>
3171
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3172
+ </text>
3173
+ </svg>
3174
+ </fo:instream-foreign-object>
3025
3175
  </xsl:template><xsl:template match="*[local-name()='del']">
3026
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3176
+ <fo:inline xsl:use-attribute-sets="del-style">
3177
+ <xsl:apply-templates/>
3178
+ </fo:inline>
3179
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3180
+ <fo:inline background-color="yellow">
3027
3181
  <xsl:apply-templates/>
3028
3182
  </fo:inline>
3029
3183
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3360,12 +3514,23 @@
3360
3514
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3361
3515
  <xsl:value-of select="substring($str, 2)"/>
3362
3516
  </xsl:template><xsl:template match="mathml:math">
3363
- <fo:inline font-family="STIX Two Math"> <!-- -->
3517
+ <xsl:variable name="isAdded" select="@added"/>
3518
+ <xsl:variable name="isDeleted" select="@deleted"/>
3519
+
3520
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3521
+
3522
+
3523
+ <xsl:call-template name="setTrackChangesStyles">
3524
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3525
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3526
+ </xsl:call-template>
3364
3527
 
3365
3528
  <xsl:variable name="mathml">
3366
3529
  <xsl:apply-templates select="." mode="mathml"/>
3367
3530
  </xsl:variable>
3368
3531
  <fo:instream-foreign-object fox:alt-text="Math">
3532
+
3533
+
3369
3534
  <!-- <xsl:copy-of select="."/> -->
3370
3535
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3371
3536
  </fo:instream-foreign-object>
@@ -3384,7 +3549,7 @@
3384
3549
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3385
3550
  </xsl:copy>
3386
3551
  <mathml:mspace width="0.5ex"/>
3387
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3552
+ </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">
3388
3553
  <xsl:variable name="target">
3389
3554
  <xsl:choose>
3390
3555
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3418,8 +3583,6 @@
3418
3583
  </xsl:otherwise>
3419
3584
  </xsl:choose>
3420
3585
  </fo:inline>
3421
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3422
- <fo:inline id="{@id}"/>
3423
3586
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3424
3587
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3425
3588
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3624,8 +3787,15 @@
3624
3787
  </fo:inline>
3625
3788
  </xsl:if>
3626
3789
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3790
+ <xsl:variable name="isAdded" select="@added"/>
3791
+ <xsl:variable name="isDeleted" select="@deleted"/>
3627
3792
  <fo:block-container id="{@id}">
3628
3793
 
3794
+ <xsl:call-template name="setTrackChangesStyles">
3795
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3796
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3797
+ </xsl:call-template>
3798
+
3629
3799
  <fo:block>
3630
3800
  <xsl:apply-templates/>
3631
3801
  </fo:block>
@@ -3639,27 +3809,113 @@
3639
3809
  <fo:block id="{@id}">
3640
3810
  <xsl:apply-templates/>
3641
3811
  </fo:block>
3812
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3642
3813
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3643
3814
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3644
3815
  <xsl:apply-templates/>
3645
3816
  </fo:block>
3646
3817
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3647
- <fo:block xsl:use-attribute-sets="image-style">
3648
-
3649
-
3650
- <xsl:variable name="src">
3651
- <xsl:choose>
3652
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3653
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3654
- </xsl:when>
3655
- <xsl:otherwise>
3656
- <xsl:value-of select="@src"/>
3657
- </xsl:otherwise>
3658
- </xsl:choose>
3659
- </xsl:variable>
3660
-
3661
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3662
- </fo:block>
3818
+ <xsl:variable name="isAdded" select="../@added"/>
3819
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3820
+ <xsl:choose>
3821
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3822
+ <fo:inline padding-left="1mm" padding-right="1mm">
3823
+ <xsl:variable name="src">
3824
+ <xsl:call-template name="image_src"/>
3825
+ </xsl:variable>
3826
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3827
+ </fo:inline>
3828
+ </xsl:when>
3829
+ <xsl:otherwise>
3830
+ <fo:block xsl:use-attribute-sets="image-style">
3831
+
3832
+ <xsl:variable name="src">
3833
+ <xsl:call-template name="image_src"/>
3834
+ </xsl:variable>
3835
+
3836
+ <xsl:choose>
3837
+ <xsl:when test="$isDeleted = 'true'">
3838
+ <!-- enclose in svg -->
3839
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3840
+ <xsl:attribute name="width">100%</xsl:attribute>
3841
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3842
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3843
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3844
+
3845
+
3846
+ <xsl:apply-templates select="." mode="cross_image"/>
3847
+
3848
+ </fo:instream-foreign-object>
3849
+ </xsl:when>
3850
+ <xsl:otherwise>
3851
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3852
+ </xsl:otherwise>
3853
+ </xsl:choose>
3854
+
3855
+ </fo:block>
3856
+ </xsl:otherwise>
3857
+ </xsl:choose>
3858
+ </xsl:template><xsl:template name="image_src">
3859
+ <xsl:choose>
3860
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3861
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3862
+ </xsl:when>
3863
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3864
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3865
+ </xsl:when>
3866
+ <xsl:otherwise>
3867
+ <xsl:value-of select="@src"/>
3868
+ </xsl:otherwise>
3869
+ </xsl:choose>
3870
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3871
+ <xsl:choose>
3872
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3873
+ <xsl:variable name="src">
3874
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3875
+ </xsl:variable>
3876
+ <xsl:variable name="width" select="document($src)/@width"/>
3877
+ <xsl:variable name="height" select="document($src)/@height"/>
3878
+ <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">
3879
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3880
+ </svg>
3881
+ </xsl:when>
3882
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3883
+ <xsl:variable name="src">
3884
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3885
+ </xsl:variable>
3886
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3887
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3888
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3889
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3890
+ <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">
3891
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3892
+ </svg>
3893
+ </xsl:when>
3894
+ <xsl:otherwise>
3895
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3896
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3897
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3898
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3899
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3900
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3901
+ <!-- width=<xsl:value-of select="$width"/> -->
3902
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3903
+ <!-- height=<xsl:value-of select="$height"/> -->
3904
+ <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">
3905
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3906
+ <xsl:call-template name="svg_cross">
3907
+ <xsl:with-param name="width" select="$width"/>
3908
+ <xsl:with-param name="height" select="$height"/>
3909
+ </xsl:call-template>
3910
+ </svg>
3911
+ </xsl:otherwise>
3912
+ </xsl:choose>
3913
+
3914
+ </xsl:template><xsl:template name="svg_cross">
3915
+ <xsl:param name="width"/>
3916
+ <xsl:param name="height"/>
3917
+ <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; "/>
3918
+ <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; "/>
3663
3919
  </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">
3664
3920
  <xsl:apply-templates mode="contents"/>
3665
3921
  <xsl:text> </xsl:text>
@@ -4202,6 +4458,7 @@
4202
4458
  <xsl:variable name="element">
4203
4459
  block
4204
4460
 
4461
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4205
4462
  </xsl:variable>
4206
4463
  <xsl:choose>
4207
4464
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4209,7 +4466,7 @@
4209
4466
  <xsl:apply-templates/>
4210
4467
  </fo:inline>
4211
4468
  </xsl:when>
4212
- <xsl:when test="normalize-space($element) = 'block'">
4469
+ <xsl:when test="contains(normalize-space($element), 'block')">
4213
4470
  <fo:block xsl:use-attribute-sets="example-name-style">
4214
4471
  <xsl:apply-templates/>
4215
4472
  </fo:block>
@@ -4222,10 +4479,11 @@
4222
4479
  </xsl:choose>
4223
4480
 
4224
4481
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4225
-
4482
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4226
4483
  <xsl:variable name="element">
4227
4484
  block
4228
4485
 
4486
+
4229
4487
  </xsl:variable>
4230
4488
  <xsl:choose>
4231
4489
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4321,31 +4579,49 @@
4321
4579
  <xsl:text>— </xsl:text>
4322
4580
  <xsl:apply-templates/>
4323
4581
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4324
- <fo:inline xsl:use-attribute-sets="eref-style">
4325
- <xsl:if test="@type = 'footnote'">
4326
-
4327
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4328
- <xsl:attribute name="font-size">80%</xsl:attribute>
4329
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4330
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4331
-
4332
-
4333
- </xsl:if>
4334
-
4335
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4336
-
4337
- <xsl:if test="@type = 'inline'">
4338
-
4339
-
4340
-
4341
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4342
-
4343
- </xsl:if>
4344
-
4345
-
4346
- <xsl:apply-templates/>
4347
- </fo:basic-link>
4348
- </fo:inline>
4582
+
4583
+ <xsl:variable name="bibitemid">
4584
+ <xsl:choose>
4585
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4586
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4587
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4588
+ </xsl:choose>
4589
+ </xsl:variable>
4590
+
4591
+ <xsl:choose>
4592
+ <xsl:when test="normalize-space($bibitemid) != ''">
4593
+ <fo:inline xsl:use-attribute-sets="eref-style">
4594
+ <xsl:if test="@type = 'footnote'">
4595
+
4596
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4597
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4598
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4599
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4600
+
4601
+
4602
+ </xsl:if>
4603
+
4604
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4605
+ <xsl:if test="normalize-space(@citeas) = ''">
4606
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4607
+ </xsl:if>
4608
+ <xsl:if test="@type = 'inline'">
4609
+
4610
+
4611
+
4612
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4613
+
4614
+ </xsl:if>
4615
+
4616
+ <xsl:apply-templates/>
4617
+ </fo:basic-link>
4618
+
4619
+ </fo:inline>
4620
+ </xsl:when>
4621
+ <xsl:otherwise>
4622
+ <fo:inline><xsl:apply-templates/></fo:inline>
4623
+ </xsl:otherwise>
4624
+ </xsl:choose>
4349
4625
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4350
4626
  <!-- zero-space char -->
4351
4627
  <xsl:variable name="depth">
@@ -4403,7 +4679,8 @@
4403
4679
  </fo:inline>
4404
4680
  </xsl:when>
4405
4681
  <xsl:otherwise>
4406
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4682
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4683
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4407
4684
  </xsl:otherwise>
4408
4685
  </xsl:choose>
4409
4686
 
@@ -4533,6 +4810,153 @@
4533
4810
  </fo:block>
4534
4811
  </xsl:otherwise>
4535
4812
  </xsl:choose>
4813
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4814
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4815
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4816
+ </xsl:for-each>
4817
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4818
+ <xsl:copy>
4819
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4820
+ </xsl:copy>
4821
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4822
+ <xsl:variable name="id">
4823
+ <xsl:call-template name="generateIndexXrefId"/>
4824
+ </xsl:variable>
4825
+ <xsl:copy> <!-- add id to xref -->
4826
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4827
+ <xsl:attribute name="id">
4828
+ <xsl:value-of select="$id"/>
4829
+ </xsl:attribute>
4830
+ <xsl:apply-templates mode="index_add_id"/>
4831
+ </xsl:copy>
4832
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4833
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4834
+ <xsl:if test="@to">
4835
+ <xsl:value-of select="$dash"/>
4836
+ <xsl:copy>
4837
+ <xsl:copy-of select="@*"/>
4838
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4839
+ <xsl:attribute name="id">
4840
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4841
+ </xsl:attribute>
4842
+ <xsl:apply-templates mode="index_add_id"/>
4843
+ </xsl:copy>
4844
+ </xsl:if>
4845
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4846
+ <xsl:copy>
4847
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4848
+ </xsl:copy>
4849
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4850
+ <xsl:copy>
4851
+ <xsl:apply-templates select="@*" mode="index_update"/>
4852
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4853
+ </xsl:copy>
4854
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4855
+ <xsl:param name="element"/>
4856
+ <xsl:param name="remove" select="'false'"/>
4857
+ <xsl:param name="target"/>
4858
+ <!-- <node></node> -->
4859
+ <xsl:choose>
4860
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4861
+ <!-- skip text (i.e. remove it) and process next element -->
4862
+ <!-- [removed_<xsl:value-of select="."/>] -->
4863
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4864
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4865
+ </xsl:apply-templates>
4866
+ </xsl:when>
4867
+ <xsl:when test="self::text()">
4868
+ <xsl:value-of select="."/>
4869
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4870
+ </xsl:when>
4871
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4872
+ <xsl:variable name="id" select="@id"/>
4873
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4874
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4875
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4876
+
4877
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4878
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4879
+
4880
+ <xsl:choose>
4881
+ <!-- 2nd pass -->
4882
+ <!-- if page is equal to page for next and page is not the end of range -->
4883
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4884
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4885
+ <!-- [removed_xref] -->
4886
+
4887
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4888
+ <xsl:with-param name="remove">true</xsl:with-param>
4889
+ <xsl:with-param name="target">
4890
+ <xsl:choose>
4891
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4892
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4893
+ </xsl:choose>
4894
+ </xsl:with-param>
4895
+ </xsl:apply-templates>
4896
+ </xsl:when>
4897
+
4898
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4899
+ <!-- remove xref -->
4900
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4901
+ <xsl:with-param name="remove">true</xsl:with-param>
4902
+ </xsl:apply-templates>
4903
+ </xsl:when>
4904
+
4905
+ <xsl:otherwise>
4906
+ <xsl:apply-templates select="." mode="xref_copy">
4907
+ <xsl:with-param name="target" select="$target"/>
4908
+ </xsl:apply-templates>
4909
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4910
+ </xsl:otherwise>
4911
+ </xsl:choose>
4912
+ </xsl:when>
4913
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4914
+ <!-- ul -->
4915
+ <xsl:apply-templates select="." mode="index_update"/>
4916
+ </xsl:when>
4917
+ <xsl:otherwise>
4918
+ <xsl:apply-templates select="." mode="xref_copy">
4919
+ <xsl:with-param name="target" select="$target"/>
4920
+ </xsl:apply-templates>
4921
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4922
+ </xsl:otherwise>
4923
+ </xsl:choose>
4924
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4925
+ <xsl:param name="target"/>
4926
+ <xsl:copy>
4927
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4928
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4929
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4930
+ </xsl:if>
4931
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4932
+ </xsl:copy>
4933
+ </xsl:template><xsl:template name="generateIndexXrefId">
4934
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4935
+
4936
+ <xsl:variable name="docid">
4937
+ <xsl:call-template name="getDocumentId"/>
4938
+ </xsl:variable>
4939
+ <xsl:variable name="item_number">
4940
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4941
+ </xsl:variable>
4942
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4943
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4944
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4945
+ <xsl:apply-templates/>
4946
+ <fo:block>
4947
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4948
+ <fo:block> </fo:block>
4949
+ </xsl:if>
4950
+ </fo:block>
4951
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4952
+ <xsl:apply-templates/>
4953
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4954
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4955
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4956
+ <xsl:apply-templates/>
4957
+ </fo:block>
4958
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4959
+ <fo:inline id="{@id}" font-size="1pt"/>
4536
4960
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4537
4961
  <!-- <row>
4538
4962
  <date>05-07-2013</date>
@@ -4630,6 +5054,70 @@
4630
5054
  <xsl:value-of select="substring(.,1,1)"/>
4631
5055
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4632
5056
  <fo:inline><xsl:apply-templates/></fo:inline>
5057
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
5058
+ <fo:block>
5059
+ <xsl:apply-templates/>
5060
+ </fo:block>
5061
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
5062
+ <fo:inline><xsl:apply-templates/></fo:inline>
5063
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
5064
+ <fo:inline>
5065
+ <xsl:call-template name="text_input"/>
5066
+ </fo:inline>
5067
+ </xsl:template><xsl:template name="text_input">
5068
+ <xsl:variable name="count">
5069
+ <xsl:choose>
5070
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
5071
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
5072
+ <xsl:otherwise>10</xsl:otherwise>
5073
+ </xsl:choose>
5074
+ </xsl:variable>
5075
+ <xsl:call-template name="repeat">
5076
+ <xsl:with-param name="char" select="'_'"/>
5077
+ <xsl:with-param name="count" select="$count"/>
5078
+ </xsl:call-template>
5079
+ <xsl:text> </xsl:text>
5080
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
5081
+ <xsl:variable name="caption">
5082
+ <xsl:choose>
5083
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
5084
+ <xsl:otherwise>BUTTON</xsl:otherwise>
5085
+ </xsl:choose>
5086
+ </xsl:variable>
5087
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
5088
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
5089
+ <fo:inline padding-right="1mm">
5090
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5091
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5092
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5093
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5094
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5095
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5096
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
5097
+ </svg>
5098
+ </fo:instream-foreign-object>
5099
+ </fo:inline>
5100
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5101
+ <fo:inline padding-right="1mm">
5102
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5103
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5104
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5105
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5106
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5107
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5108
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5109
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5110
+ </svg>
5111
+ </fo:instream-foreign-object>
5112
+ </fo:inline>
5113
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5114
+ <fo:inline>
5115
+ <xsl:call-template name="text_input"/>
5116
+ </fo:inline>
5117
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5118
+ <fo:block-container border="1pt solid black" width="50%">
5119
+ <fo:block> </fo:block>
5120
+ </fo:block-container>
4633
5121
  </xsl:template><xsl:template name="convertDate">
4634
5122
  <xsl:param name="date"/>
4635
5123
  <xsl:param name="format" select="'short'"/>
@@ -4749,70 +5237,68 @@
4749
5237
  <xsl:variable name="lang">
4750
5238
  <xsl:call-template name="getLang"/>
4751
5239
  </xsl:variable>
4752
- <fo:declarations>
4753
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4754
- <pdf:dictionary type="normal" key="ViewerPreferences">
4755
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4756
- </pdf:dictionary>
4757
- </pdf:catalog>
4758
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4759
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4760
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4761
- <!-- Dublin Core properties go here -->
4762
- <dc:title>
4763
- <xsl:variable name="title">
4764
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4765
-
4766
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4767
-
4768
-
4769
-
4770
-
4771
-
4772
-
4773
- </xsl:for-each>
4774
- </xsl:variable>
4775
- <xsl:choose>
4776
- <xsl:when test="normalize-space($title) != ''">
4777
- <xsl:value-of select="$title"/>
4778
- </xsl:when>
4779
- <xsl:otherwise>
4780
- <xsl:text> </xsl:text>
4781
- </xsl:otherwise>
4782
- </xsl:choose>
4783
- </dc:title>
4784
- <dc:creator>
5240
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5241
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5242
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5243
+ </pdf:dictionary>
5244
+ </pdf:catalog>
5245
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5246
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5247
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5248
+ <!-- Dublin Core properties go here -->
5249
+ <dc:title>
5250
+ <xsl:variable name="title">
4785
5251
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4786
5252
 
4787
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4788
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4789
- <xsl:if test="position() != last()">; </xsl:if>
4790
- </xsl:for-each>
5253
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4791
5254
 
4792
5255
 
4793
5256
 
4794
- </xsl:for-each>
4795
- </dc:creator>
4796
- <dc:description>
4797
- <xsl:variable name="abstract">
4798
5257
 
4799
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4800
5258
 
4801
-
4802
- </xsl:variable>
4803
- <xsl:value-of select="normalize-space($abstract)"/>
4804
- </dc:description>
4805
- <pdf:Keywords>
4806
- <xsl:call-template name="insertKeywords"/>
4807
- </pdf:Keywords>
4808
- </rdf:Description>
4809
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4810
- <!-- XMP properties go here -->
4811
- <xmp:CreatorTool/>
4812
- </rdf:Description>
4813
- </rdf:RDF>
4814
- </x:xmpmeta>
4815
- </fo:declarations>
5259
+
5260
+ </xsl:for-each>
5261
+ </xsl:variable>
5262
+ <xsl:choose>
5263
+ <xsl:when test="normalize-space($title) != ''">
5264
+ <xsl:value-of select="$title"/>
5265
+ </xsl:when>
5266
+ <xsl:otherwise>
5267
+ <xsl:text> </xsl:text>
5268
+ </xsl:otherwise>
5269
+ </xsl:choose>
5270
+ </dc:title>
5271
+ <dc:creator>
5272
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5273
+
5274
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5275
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5276
+ <xsl:if test="position() != last()">; </xsl:if>
5277
+ </xsl:for-each>
5278
+
5279
+
5280
+
5281
+ </xsl:for-each>
5282
+ </dc:creator>
5283
+ <dc:description>
5284
+ <xsl:variable name="abstract">
5285
+
5286
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5287
+
5288
+
5289
+ </xsl:variable>
5290
+ <xsl:value-of select="normalize-space($abstract)"/>
5291
+ </dc:description>
5292
+ <pdf:Keywords>
5293
+ <xsl:call-template name="insertKeywords"/>
5294
+ </pdf:Keywords>
5295
+ </rdf:Description>
5296
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5297
+ <!-- XMP properties go here -->
5298
+ <xmp:CreatorTool/>
5299
+ </rdf:Description>
5300
+ </rdf:RDF>
5301
+ </x:xmpmeta>
4816
5302
  </xsl:template><xsl:template name="getId">
4817
5303
  <xsl:choose>
4818
5304
  <xsl:when test="../@id">
@@ -4976,4 +5462,44 @@
4976
5462
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4977
5463
  </xsl:choose>
4978
5464
 
5465
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5466
+ <xsl:param name="isAdded"/>
5467
+ <xsl:param name="isDeleted"/>
5468
+ <xsl:choose>
5469
+ <xsl:when test="local-name() = 'math'">
5470
+ <xsl:if test="$isAdded = 'true'">
5471
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5472
+ </xsl:if>
5473
+ <xsl:if test="$isDeleted = 'true'">
5474
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5475
+ </xsl:if>
5476
+ </xsl:when>
5477
+ <xsl:otherwise>
5478
+ <xsl:if test="$isAdded = 'true'">
5479
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5480
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5481
+ </xsl:if>
5482
+ <xsl:if test="$isDeleted = 'true'">
5483
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5484
+ <xsl:if test="local-name() = 'table'">
5485
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5486
+ </xsl:if>
5487
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5488
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5489
+ </xsl:if>
5490
+ </xsl:otherwise>
5491
+ </xsl:choose>
5492
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5493
+ <xsl:if test="$lang = 'ar'">
5494
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5495
+ </xsl:if>
5496
+ </xsl:template><xsl:template name="setAlignment">
5497
+ <xsl:param name="align" select="normalize-space(@align)"/>
5498
+ <xsl:choose>
5499
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5500
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5501
+ <xsl:when test="$align != ''">
5502
+ <xsl:value-of select="$align"/>
5503
+ </xsl:when>
5504
+ </xsl:choose>
4979
5505
  </xsl:template></xsl:stylesheet>