metanorma-un 0.5.13 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -83,7 +85,9 @@
83
85
 
84
86
  </fo:layout-master-set>
85
87
 
86
- <xsl:call-template name="addPDFUAmeta"/>
88
+ <fo:declarations>
89
+ <xsl:call-template name="addPDFUAmeta"/>
90
+ </fo:declarations>
87
91
 
88
92
  <xsl:call-template name="addBookmarks">
89
93
  <xsl:with-param name="contents" select="$contents"/>
@@ -1206,6 +1210,7 @@
1206
1210
  </xsl:choose>
1207
1211
  </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">
1208
1212
 
1213
+
1209
1214
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1210
1215
 
1211
1216
 
@@ -1307,6 +1312,7 @@
1307
1312
 
1308
1313
 
1309
1314
 
1315
+
1310
1316
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1311
1317
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1312
1318
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1509,13 +1515,31 @@
1509
1515
 
1510
1516
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1511
1517
 
1512
-
1518
+
1513
1519
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1514
1520
 
1515
1521
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1516
1522
 
1517
1523
 
1518
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1524
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1525
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1526
+ </xsl:variable><xsl:attribute-set name="add-style">
1527
+ <xsl:attribute name="color">red</xsl:attribute>
1528
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1529
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1530
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1531
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1532
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1533
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1534
+ <xsl:text>red</xsl:text>
1535
+ </xsl:variable><xsl:attribute-set name="del-style">
1536
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1537
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1538
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1539
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1540
+
1541
+
1542
+ </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">
1519
1543
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1520
1544
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1521
1545
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1560,16 +1584,17 @@
1560
1584
  <xsl:call-template name="add-zero-spaces-java"/>
1561
1585
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1562
1586
 
1587
+ <xsl:variable name="table-preamble">
1588
+
1589
+
1590
+ </xsl:variable>
1591
+
1563
1592
  <xsl:variable name="table">
1564
1593
 
1565
1594
  <xsl:variable name="simple-table">
1566
1595
  <xsl:call-template name="getSimpleTable"/>
1567
1596
  </xsl:variable>
1568
1597
 
1569
-
1570
-
1571
-
1572
-
1573
1598
  <!-- <xsl:if test="$namespace = 'bipm'">
1574
1599
  <fo:block>&#xA0;</fo:block>
1575
1600
  </xsl:if> -->
@@ -1584,7 +1609,7 @@
1584
1609
 
1585
1610
 
1586
1611
 
1587
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1612
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1588
1613
 
1589
1614
  <!-- <xsl:variable name="cols-count">
1590
1615
  <xsl:choose>
@@ -1603,8 +1628,6 @@
1603
1628
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1604
1629
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1605
1630
 
1606
-
1607
-
1608
1631
  <xsl:variable name="colwidths">
1609
1632
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1610
1633
  <xsl:call-template name="calculate-column-widths">
@@ -1632,6 +1655,7 @@
1632
1655
  </xsl:choose>
1633
1656
  </xsl:variable>
1634
1657
 
1658
+
1635
1659
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1636
1660
 
1637
1661
 
@@ -1673,6 +1697,7 @@
1673
1697
 
1674
1698
 
1675
1699
 
1700
+
1676
1701
 
1677
1702
 
1678
1703
  <xsl:if test="ancestor::*[local-name()='sections']">
@@ -1767,7 +1792,8 @@
1767
1792
  </fo:block-container>
1768
1793
  </xsl:variable>
1769
1794
 
1770
-
1795
+ <xsl:variable name="isAdded" select="@added"/>
1796
+ <xsl:variable name="isDeleted" select="@deleted"/>
1771
1797
 
1772
1798
  <xsl:choose>
1773
1799
  <xsl:when test="@width">
@@ -1776,12 +1802,42 @@
1776
1802
 
1777
1803
 
1778
1804
 
1779
- <xsl:copy-of select="$table"/>
1805
+ <xsl:choose>
1806
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1807
+ <xsl:copy-of select="$table-preamble"/>
1808
+ <fo:block>
1809
+ <xsl:call-template name="setTrackChangesStyles">
1810
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1811
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1812
+ </xsl:call-template>
1813
+ <xsl:copy-of select="$table"/>
1814
+ </fo:block>
1815
+ </xsl:when>
1816
+ <xsl:otherwise>
1817
+ <xsl:copy-of select="$table-preamble"/>
1818
+ <xsl:copy-of select="$table"/>
1819
+ </xsl:otherwise>
1820
+ </xsl:choose>
1780
1821
 
1781
1822
 
1782
1823
  </xsl:when>
1783
1824
  <xsl:otherwise>
1784
- <xsl:copy-of select="$table"/>
1825
+ <xsl:choose>
1826
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1827
+ <xsl:copy-of select="$table-preamble"/>
1828
+ <fo:block>
1829
+ <xsl:call-template name="setTrackChangesStyles">
1830
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1831
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1832
+ </xsl:call-template>
1833
+ <xsl:copy-of select="$table"/>
1834
+ </fo:block>
1835
+ </xsl:when>
1836
+ <xsl:otherwise>
1837
+ <xsl:copy-of select="$table-preamble"/>
1838
+ <xsl:copy-of select="$table"/>
1839
+ </xsl:otherwise>
1840
+ </xsl:choose>
1785
1841
  </xsl:otherwise>
1786
1842
  </xsl:choose>
1787
1843
 
@@ -1842,7 +1898,7 @@
1842
1898
  </xsl:for-each>
1843
1899
  </xsl:when>
1844
1900
  <xsl:otherwise>
1845
- <xsl:for-each select="xalan:nodeset($table)//tr">
1901
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1846
1902
  <xsl:variable name="td_text">
1847
1903
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1848
1904
 
@@ -1912,7 +1968,15 @@
1912
1968
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1913
1969
  <xsl:value-of select="@target"/>
1914
1970
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1915
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1971
+ <xsl:variable name="mathml">
1972
+ <xsl:for-each select="*">
1973
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1974
+ <xsl:copy-of select="."/>
1975
+ </xsl:if>
1976
+ </xsl:for-each>
1977
+ </xsl:variable>
1978
+
1979
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1916
1980
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1917
1981
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1918
1982
  <xsl:param name="cols-count"/>
@@ -2174,7 +2238,8 @@
2174
2238
  <xsl:attribute name="text-align">
2175
2239
  <xsl:choose>
2176
2240
  <xsl:when test="@align">
2177
- <xsl:value-of select="@align"/>
2241
+ <xsl:call-template name="setAlignment"/>
2242
+ <!-- <xsl:value-of select="@align"/> -->
2178
2243
  </xsl:when>
2179
2244
  <xsl:otherwise>center</xsl:otherwise>
2180
2245
  </xsl:choose>
@@ -2206,6 +2271,9 @@
2206
2271
 
2207
2272
 
2208
2273
 
2274
+ <xsl:if test="$lang = 'ar'">
2275
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2276
+ </xsl:if>
2209
2277
  <xsl:if test="@colspan">
2210
2278
  <xsl:attribute name="number-columns-spanned">
2211
2279
  <xsl:value-of select="@colspan"/>
@@ -2237,11 +2305,15 @@
2237
2305
  <xsl:attribute name="text-align">
2238
2306
  <xsl:choose>
2239
2307
  <xsl:when test="@align">
2240
- <xsl:value-of select="@align"/>
2308
+ <xsl:call-template name="setAlignment"/>
2309
+ <!-- <xsl:value-of select="@align"/> -->
2241
2310
  </xsl:when>
2242
2311
  <xsl:otherwise>left</xsl:otherwise>
2243
2312
  </xsl:choose>
2244
2313
  </xsl:attribute>
2314
+ <xsl:if test="$lang = 'ar'">
2315
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2316
+ </xsl:if>
2245
2317
 
2246
2318
 
2247
2319
 
@@ -2259,6 +2331,9 @@
2259
2331
 
2260
2332
 
2261
2333
 
2334
+ <xsl:if test=".//*[local-name() = 'table']">
2335
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2336
+ </xsl:if>
2262
2337
  <xsl:if test="@colspan">
2263
2338
  <xsl:attribute name="number-columns-spanned">
2264
2339
  <xsl:value-of select="@colspan"/>
@@ -2396,13 +2471,13 @@
2396
2471
  </xsl:choose>
2397
2472
  </xsl:variable>
2398
2473
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2399
- <xsl:element name="{$ns}:table">
2474
+ <!-- <xsl:element name="{$ns}:table"> -->
2400
2475
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2401
2476
  <tbody>
2402
2477
  <xsl:apply-templates mode="dl"/>
2403
2478
  </tbody>
2404
2479
  </xsl:for-each>
2405
- </xsl:element>
2480
+ <!-- </xsl:element> -->
2406
2481
  </xsl:variable>
2407
2482
 
2408
2483
  <xsl:call-template name="calculate-column-widths">
@@ -2493,6 +2568,8 @@
2493
2568
  <xsl:apply-templates/>
2494
2569
  </fo:inline>
2495
2570
  </xsl:template><xsl:template match="*[local-name()='dl']">
2571
+ <xsl:variable name="isAdded" select="@added"/>
2572
+ <xsl:variable name="isDeleted" select="@deleted"/>
2496
2573
  <fo:block-container>
2497
2574
 
2498
2575
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2509,6 +2586,12 @@
2509
2586
  </xsl:attribute>
2510
2587
 
2511
2588
  </xsl:if>
2589
+
2590
+ <xsl:call-template name="setTrackChangesStyles">
2591
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2592
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2593
+ </xsl:call-template>
2594
+
2512
2595
  <fo:block-container>
2513
2596
 
2514
2597
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2616,11 +2699,11 @@
2616
2699
  </xsl:choose>
2617
2700
  </xsl:variable>
2618
2701
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2619
- <xsl:element name="{$ns}:table">
2702
+ <!-- <xsl:element name="{$ns}:table"> -->
2620
2703
  <tbody>
2621
2704
  <xsl:apply-templates mode="dl"/>
2622
2705
  </tbody>
2623
- </xsl:element>
2706
+ <!-- </xsl:element> -->
2624
2707
  </xsl:variable>
2625
2708
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2626
2709
  <xsl:variable name="colwidths">
@@ -2887,8 +2970,78 @@
2887
2970
  <fo:inline text-decoration="underline">
2888
2971
  <xsl:apply-templates/>
2889
2972
  </fo:inline>
2973
+ </xsl:template><xsl:template match="*[local-name()='add']">
2974
+ <xsl:choose>
2975
+ <xsl:when test="@amendment">
2976
+ <fo:inline>
2977
+ <xsl:call-template name="insertTag">
2978
+ <xsl:with-param name="kind">A</xsl:with-param>
2979
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2980
+ </xsl:call-template>
2981
+ <xsl:apply-templates/>
2982
+ <xsl:call-template name="insertTag">
2983
+ <xsl:with-param name="type">closing</xsl:with-param>
2984
+ <xsl:with-param name="kind">A</xsl:with-param>
2985
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2986
+ </xsl:call-template>
2987
+ </fo:inline>
2988
+ </xsl:when>
2989
+ <xsl:when test="@corrigenda">
2990
+ <fo:inline>
2991
+ <xsl:call-template name="insertTag">
2992
+ <xsl:with-param name="kind">C</xsl:with-param>
2993
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2994
+ </xsl:call-template>
2995
+ <xsl:apply-templates/>
2996
+ <xsl:call-template name="insertTag">
2997
+ <xsl:with-param name="type">closing</xsl:with-param>
2998
+ <xsl:with-param name="kind">C</xsl:with-param>
2999
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3000
+ </xsl:call-template>
3001
+ </fo:inline>
3002
+ </xsl:when>
3003
+ <xsl:otherwise>
3004
+ <fo:inline xsl:use-attribute-sets="add-style">
3005
+ <xsl:apply-templates/>
3006
+ </fo:inline>
3007
+ </xsl:otherwise>
3008
+ </xsl:choose>
3009
+
3010
+ </xsl:template><xsl:template name="insertTag">
3011
+ <xsl:param name="type"/>
3012
+ <xsl:param name="kind"/>
3013
+ <xsl:param name="value"/>
3014
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3015
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3016
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3017
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3018
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3019
+ <xsl:attribute name="height">5mm</xsl:attribute>
3020
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3021
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3022
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3023
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3024
+ <g>
3025
+ <xsl:if test="$type = 'closing'">
3026
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3027
+ </xsl:if>
3028
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3029
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3030
+ </g>
3031
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3032
+ <xsl:if test="$type = 'closing'">
3033
+ <xsl:attribute name="x">25</xsl:attribute>
3034
+ </xsl:if>
3035
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3036
+ </text>
3037
+ </svg>
3038
+ </fo:instream-foreign-object>
2890
3039
  </xsl:template><xsl:template match="*[local-name()='del']">
2891
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3040
+ <fo:inline xsl:use-attribute-sets="del-style">
3041
+ <xsl:apply-templates/>
3042
+ </fo:inline>
3043
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3044
+ <fo:inline background-color="yellow">
2892
3045
  <xsl:apply-templates/>
2893
3046
  </fo:inline>
2894
3047
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3225,12 +3378,23 @@
3225
3378
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3226
3379
  <xsl:value-of select="substring($str, 2)"/>
3227
3380
  </xsl:template><xsl:template match="mathml:math">
3228
- <fo:inline font-family="STIX Two Math"> <!-- -->
3381
+ <xsl:variable name="isAdded" select="@added"/>
3382
+ <xsl:variable name="isDeleted" select="@deleted"/>
3383
+
3384
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3385
+
3386
+
3387
+ <xsl:call-template name="setTrackChangesStyles">
3388
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3389
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3390
+ </xsl:call-template>
3229
3391
 
3230
3392
  <xsl:variable name="mathml">
3231
3393
  <xsl:apply-templates select="." mode="mathml"/>
3232
3394
  </xsl:variable>
3233
3395
  <fo:instream-foreign-object fox:alt-text="Math">
3396
+
3397
+
3234
3398
  <!-- <xsl:copy-of select="."/> -->
3235
3399
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3236
3400
  </fo:instream-foreign-object>
@@ -3249,7 +3413,7 @@
3249
3413
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3250
3414
  </xsl:copy>
3251
3415
  <mathml:mspace width="0.5ex"/>
3252
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3416
+ </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">
3253
3417
  <xsl:variable name="target">
3254
3418
  <xsl:choose>
3255
3419
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3283,8 +3447,6 @@
3283
3447
  </xsl:otherwise>
3284
3448
  </xsl:choose>
3285
3449
  </fo:inline>
3286
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3287
- <fo:inline id="{@id}"/>
3288
3450
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3289
3451
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3290
3452
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3493,8 +3655,15 @@
3493
3655
  </fo:inline>
3494
3656
  </xsl:if>
3495
3657
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3658
+ <xsl:variable name="isAdded" select="@added"/>
3659
+ <xsl:variable name="isDeleted" select="@deleted"/>
3496
3660
  <fo:block-container id="{@id}">
3497
3661
 
3662
+ <xsl:call-template name="setTrackChangesStyles">
3663
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3664
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3665
+ </xsl:call-template>
3666
+
3498
3667
  <fo:block>
3499
3668
  <xsl:apply-templates/>
3500
3669
  </fo:block>
@@ -3508,32 +3677,118 @@
3508
3677
  <fo:block id="{@id}">
3509
3678
  <xsl:apply-templates/>
3510
3679
  </fo:block>
3680
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3511
3681
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3512
3682
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3513
3683
  <xsl:apply-templates/>
3514
3684
  </fo:block>
3515
3685
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3516
- <fo:block xsl:use-attribute-sets="image-style">
3517
-
3518
- <xsl:if test="ancestor::un:admonition">
3519
- <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3520
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3521
- </xsl:if>
3522
-
3523
-
3524
- <xsl:variable name="src">
3525
- <xsl:choose>
3526
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3527
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3528
- </xsl:when>
3529
- <xsl:otherwise>
3530
- <xsl:value-of select="@src"/>
3531
- </xsl:otherwise>
3532
- </xsl:choose>
3533
- </xsl:variable>
3534
-
3535
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3536
- </fo:block>
3686
+ <xsl:variable name="isAdded" select="../@added"/>
3687
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3688
+ <xsl:choose>
3689
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3690
+ <fo:inline padding-left="1mm" padding-right="1mm">
3691
+ <xsl:variable name="src">
3692
+ <xsl:call-template name="image_src"/>
3693
+ </xsl:variable>
3694
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3695
+ </fo:inline>
3696
+ </xsl:when>
3697
+ <xsl:otherwise>
3698
+ <fo:block xsl:use-attribute-sets="image-style">
3699
+
3700
+ <xsl:if test="ancestor::un:admonition">
3701
+ <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3702
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3703
+ </xsl:if>
3704
+
3705
+ <xsl:variable name="src">
3706
+ <xsl:call-template name="image_src"/>
3707
+ </xsl:variable>
3708
+
3709
+ <xsl:choose>
3710
+ <xsl:when test="$isDeleted = 'true'">
3711
+ <!-- enclose in svg -->
3712
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3713
+ <xsl:attribute name="width">100%</xsl:attribute>
3714
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3715
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3716
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3717
+
3718
+
3719
+ <xsl:apply-templates select="." mode="cross_image"/>
3720
+
3721
+ </fo:instream-foreign-object>
3722
+ </xsl:when>
3723
+ <xsl:otherwise>
3724
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3725
+ </xsl:otherwise>
3726
+ </xsl:choose>
3727
+
3728
+ </fo:block>
3729
+ </xsl:otherwise>
3730
+ </xsl:choose>
3731
+ </xsl:template><xsl:template name="image_src">
3732
+ <xsl:choose>
3733
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3734
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3735
+ </xsl:when>
3736
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3737
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3738
+ </xsl:when>
3739
+ <xsl:otherwise>
3740
+ <xsl:value-of select="@src"/>
3741
+ </xsl:otherwise>
3742
+ </xsl:choose>
3743
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3744
+ <xsl:choose>
3745
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3746
+ <xsl:variable name="src">
3747
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3748
+ </xsl:variable>
3749
+ <xsl:variable name="width" select="document($src)/@width"/>
3750
+ <xsl:variable name="height" select="document($src)/@height"/>
3751
+ <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">
3752
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3753
+ </svg>
3754
+ </xsl:when>
3755
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3756
+ <xsl:variable name="src">
3757
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3758
+ </xsl:variable>
3759
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3760
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3761
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3762
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3763
+ <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">
3764
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3765
+ </svg>
3766
+ </xsl:when>
3767
+ <xsl:otherwise>
3768
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3769
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3770
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3771
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3772
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3773
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3774
+ <!-- width=<xsl:value-of select="$width"/> -->
3775
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3776
+ <!-- height=<xsl:value-of select="$height"/> -->
3777
+ <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">
3778
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3779
+ <xsl:call-template name="svg_cross">
3780
+ <xsl:with-param name="width" select="$width"/>
3781
+ <xsl:with-param name="height" select="$height"/>
3782
+ </xsl:call-template>
3783
+ </svg>
3784
+ </xsl:otherwise>
3785
+ </xsl:choose>
3786
+
3787
+ </xsl:template><xsl:template name="svg_cross">
3788
+ <xsl:param name="width"/>
3789
+ <xsl:param name="height"/>
3790
+ <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; "/>
3791
+ <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; "/>
3537
3792
  </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">
3538
3793
  <xsl:apply-templates mode="contents"/>
3539
3794
  <xsl:text> </xsl:text>
@@ -4076,6 +4331,7 @@
4076
4331
  <xsl:variable name="element">
4077
4332
  block
4078
4333
 
4334
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4079
4335
  </xsl:variable>
4080
4336
  <xsl:choose>
4081
4337
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4083,7 +4339,7 @@
4083
4339
  <xsl:apply-templates/>
4084
4340
  </fo:inline>
4085
4341
  </xsl:when>
4086
- <xsl:when test="normalize-space($element) = 'block'">
4342
+ <xsl:when test="contains(normalize-space($element), 'block')">
4087
4343
  <fo:block xsl:use-attribute-sets="example-name-style">
4088
4344
  <xsl:apply-templates/>
4089
4345
  </fo:block>
@@ -4096,10 +4352,11 @@
4096
4352
  </xsl:choose>
4097
4353
 
4098
4354
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4099
-
4355
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4100
4356
  <xsl:variable name="element">
4101
4357
  block
4102
4358
 
4359
+
4103
4360
  </xsl:variable>
4104
4361
  <xsl:choose>
4105
4362
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4195,29 +4452,47 @@
4195
4452
  <xsl:text>— </xsl:text>
4196
4453
  <xsl:apply-templates/>
4197
4454
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4198
- <fo:inline xsl:use-attribute-sets="eref-style">
4199
- <xsl:if test="@type = 'footnote'">
4200
-
4201
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4202
- <xsl:attribute name="font-size">80%</xsl:attribute>
4203
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4204
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4205
-
4206
-
4207
- </xsl:if>
4208
-
4209
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4210
-
4211
- <xsl:if test="@type = 'inline'">
4212
-
4213
-
4214
-
4215
- </xsl:if>
4216
-
4217
-
4218
- <xsl:apply-templates/>
4219
- </fo:basic-link>
4220
- </fo:inline>
4455
+
4456
+ <xsl:variable name="bibitemid">
4457
+ <xsl:choose>
4458
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4459
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4460
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4461
+ </xsl:choose>
4462
+ </xsl:variable>
4463
+
4464
+ <xsl:choose>
4465
+ <xsl:when test="normalize-space($bibitemid) != ''">
4466
+ <fo:inline xsl:use-attribute-sets="eref-style">
4467
+ <xsl:if test="@type = 'footnote'">
4468
+
4469
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4470
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4471
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4472
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4473
+
4474
+
4475
+ </xsl:if>
4476
+
4477
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4478
+ <xsl:if test="normalize-space(@citeas) = ''">
4479
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4480
+ </xsl:if>
4481
+ <xsl:if test="@type = 'inline'">
4482
+
4483
+
4484
+
4485
+ </xsl:if>
4486
+
4487
+ <xsl:apply-templates/>
4488
+ </fo:basic-link>
4489
+
4490
+ </fo:inline>
4491
+ </xsl:when>
4492
+ <xsl:otherwise>
4493
+ <fo:inline><xsl:apply-templates/></fo:inline>
4494
+ </xsl:otherwise>
4495
+ </xsl:choose>
4221
4496
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4222
4497
  <!-- zero-space char -->
4223
4498
  <xsl:variable name="depth">
@@ -4275,7 +4550,8 @@
4275
4550
  </fo:inline>
4276
4551
  </xsl:when>
4277
4552
  <xsl:otherwise>
4278
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4553
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4554
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4279
4555
  </xsl:otherwise>
4280
4556
  </xsl:choose>
4281
4557
 
@@ -4407,6 +4683,153 @@
4407
4683
  </fo:block>
4408
4684
  </xsl:otherwise>
4409
4685
  </xsl:choose>
4686
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4687
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4688
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4689
+ </xsl:for-each>
4690
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4691
+ <xsl:copy>
4692
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4693
+ </xsl:copy>
4694
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4695
+ <xsl:variable name="id">
4696
+ <xsl:call-template name="generateIndexXrefId"/>
4697
+ </xsl:variable>
4698
+ <xsl:copy> <!-- add id to xref -->
4699
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4700
+ <xsl:attribute name="id">
4701
+ <xsl:value-of select="$id"/>
4702
+ </xsl:attribute>
4703
+ <xsl:apply-templates mode="index_add_id"/>
4704
+ </xsl:copy>
4705
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4706
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4707
+ <xsl:if test="@to">
4708
+ <xsl:value-of select="$dash"/>
4709
+ <xsl:copy>
4710
+ <xsl:copy-of select="@*"/>
4711
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4712
+ <xsl:attribute name="id">
4713
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4714
+ </xsl:attribute>
4715
+ <xsl:apply-templates mode="index_add_id"/>
4716
+ </xsl:copy>
4717
+ </xsl:if>
4718
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4719
+ <xsl:copy>
4720
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4721
+ </xsl:copy>
4722
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4723
+ <xsl:copy>
4724
+ <xsl:apply-templates select="@*" mode="index_update"/>
4725
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4726
+ </xsl:copy>
4727
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4728
+ <xsl:param name="element"/>
4729
+ <xsl:param name="remove" select="'false'"/>
4730
+ <xsl:param name="target"/>
4731
+ <!-- <node></node> -->
4732
+ <xsl:choose>
4733
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4734
+ <!-- skip text (i.e. remove it) and process next element -->
4735
+ <!-- [removed_<xsl:value-of select="."/>] -->
4736
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4737
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4738
+ </xsl:apply-templates>
4739
+ </xsl:when>
4740
+ <xsl:when test="self::text()">
4741
+ <xsl:value-of select="."/>
4742
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4743
+ </xsl:when>
4744
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4745
+ <xsl:variable name="id" select="@id"/>
4746
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4747
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4748
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4749
+
4750
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4751
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4752
+
4753
+ <xsl:choose>
4754
+ <!-- 2nd pass -->
4755
+ <!-- if page is equal to page for next and page is not the end of range -->
4756
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4757
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4758
+ <!-- [removed_xref] -->
4759
+
4760
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4761
+ <xsl:with-param name="remove">true</xsl:with-param>
4762
+ <xsl:with-param name="target">
4763
+ <xsl:choose>
4764
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4765
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4766
+ </xsl:choose>
4767
+ </xsl:with-param>
4768
+ </xsl:apply-templates>
4769
+ </xsl:when>
4770
+
4771
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4772
+ <!-- remove xref -->
4773
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4774
+ <xsl:with-param name="remove">true</xsl:with-param>
4775
+ </xsl:apply-templates>
4776
+ </xsl:when>
4777
+
4778
+ <xsl:otherwise>
4779
+ <xsl:apply-templates select="." mode="xref_copy">
4780
+ <xsl:with-param name="target" select="$target"/>
4781
+ </xsl:apply-templates>
4782
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4783
+ </xsl:otherwise>
4784
+ </xsl:choose>
4785
+ </xsl:when>
4786
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4787
+ <!-- ul -->
4788
+ <xsl:apply-templates select="." mode="index_update"/>
4789
+ </xsl:when>
4790
+ <xsl:otherwise>
4791
+ <xsl:apply-templates select="." mode="xref_copy">
4792
+ <xsl:with-param name="target" select="$target"/>
4793
+ </xsl:apply-templates>
4794
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4795
+ </xsl:otherwise>
4796
+ </xsl:choose>
4797
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4798
+ <xsl:param name="target"/>
4799
+ <xsl:copy>
4800
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4801
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4802
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4803
+ </xsl:if>
4804
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4805
+ </xsl:copy>
4806
+ </xsl:template><xsl:template name="generateIndexXrefId">
4807
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4808
+
4809
+ <xsl:variable name="docid">
4810
+ <xsl:call-template name="getDocumentId"/>
4811
+ </xsl:variable>
4812
+ <xsl:variable name="item_number">
4813
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4814
+ </xsl:variable>
4815
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4816
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4817
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4818
+ <xsl:apply-templates/>
4819
+ <fo:block>
4820
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4821
+ <fo:block> </fo:block>
4822
+ </xsl:if>
4823
+ </fo:block>
4824
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4825
+ <xsl:apply-templates/>
4826
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4827
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4828
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4829
+ <xsl:apply-templates/>
4830
+ </fo:block>
4831
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4832
+ <fo:inline id="{@id}" font-size="1pt"/>
4410
4833
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4411
4834
  <!-- <row>
4412
4835
  <date>05-07-2013</date>
@@ -4623,70 +5046,68 @@
4623
5046
  <xsl:variable name="lang">
4624
5047
  <xsl:call-template name="getLang"/>
4625
5048
  </xsl:variable>
4626
- <fo:declarations>
4627
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4628
- <pdf:dictionary type="normal" key="ViewerPreferences">
4629
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4630
- </pdf:dictionary>
4631
- </pdf:catalog>
4632
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4633
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4634
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4635
- <!-- Dublin Core properties go here -->
4636
- <dc:title>
4637
- <xsl:variable name="title">
4638
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4639
-
4640
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4641
-
4642
-
4643
-
4644
-
4645
-
4646
-
4647
- </xsl:for-each>
4648
- </xsl:variable>
4649
- <xsl:choose>
4650
- <xsl:when test="normalize-space($title) != ''">
4651
- <xsl:value-of select="$title"/>
4652
- </xsl:when>
4653
- <xsl:otherwise>
4654
- <xsl:text> </xsl:text>
4655
- </xsl:otherwise>
4656
- </xsl:choose>
4657
- </dc:title>
4658
- <dc:creator>
5049
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5050
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5051
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5052
+ </pdf:dictionary>
5053
+ </pdf:catalog>
5054
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5055
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5056
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5057
+ <!-- Dublin Core properties go here -->
5058
+ <dc:title>
5059
+ <xsl:variable name="title">
4659
5060
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4660
5061
 
4661
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4662
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4663
- <xsl:if test="position() != last()">; </xsl:if>
4664
- </xsl:for-each>
5062
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4665
5063
 
4666
5064
 
4667
5065
 
4668
- </xsl:for-each>
4669
- </dc:creator>
4670
- <dc:description>
4671
- <xsl:variable name="abstract">
4672
-
4673
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4674
5066
 
4675
5067
 
4676
- </xsl:variable>
4677
- <xsl:value-of select="normalize-space($abstract)"/>
4678
- </dc:description>
4679
- <pdf:Keywords>
4680
- <xsl:call-template name="insertKeywords"/>
4681
- </pdf:Keywords>
4682
- </rdf:Description>
4683
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4684
- <!-- XMP properties go here -->
4685
- <xmp:CreatorTool/>
4686
- </rdf:Description>
4687
- </rdf:RDF>
4688
- </x:xmpmeta>
4689
- </fo:declarations>
5068
+
5069
+ </xsl:for-each>
5070
+ </xsl:variable>
5071
+ <xsl:choose>
5072
+ <xsl:when test="normalize-space($title) != ''">
5073
+ <xsl:value-of select="$title"/>
5074
+ </xsl:when>
5075
+ <xsl:otherwise>
5076
+ <xsl:text> </xsl:text>
5077
+ </xsl:otherwise>
5078
+ </xsl:choose>
5079
+ </dc:title>
5080
+ <dc:creator>
5081
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5082
+
5083
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5084
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5085
+ <xsl:if test="position() != last()">; </xsl:if>
5086
+ </xsl:for-each>
5087
+
5088
+
5089
+
5090
+ </xsl:for-each>
5091
+ </dc:creator>
5092
+ <dc:description>
5093
+ <xsl:variable name="abstract">
5094
+
5095
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5096
+
5097
+
5098
+ </xsl:variable>
5099
+ <xsl:value-of select="normalize-space($abstract)"/>
5100
+ </dc:description>
5101
+ <pdf:Keywords>
5102
+ <xsl:call-template name="insertKeywords"/>
5103
+ </pdf:Keywords>
5104
+ </rdf:Description>
5105
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5106
+ <!-- XMP properties go here -->
5107
+ <xmp:CreatorTool/>
5108
+ </rdf:Description>
5109
+ </rdf:RDF>
5110
+ </x:xmpmeta>
4690
5111
  </xsl:template><xsl:template name="getId">
4691
5112
  <xsl:choose>
4692
5113
  <xsl:when test="../@id">
@@ -4850,4 +5271,44 @@
4850
5271
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4851
5272
  </xsl:choose>
4852
5273
 
5274
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5275
+ <xsl:param name="isAdded"/>
5276
+ <xsl:param name="isDeleted"/>
5277
+ <xsl:choose>
5278
+ <xsl:when test="local-name() = 'math'">
5279
+ <xsl:if test="$isAdded = 'true'">
5280
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5281
+ </xsl:if>
5282
+ <xsl:if test="$isDeleted = 'true'">
5283
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5284
+ </xsl:if>
5285
+ </xsl:when>
5286
+ <xsl:otherwise>
5287
+ <xsl:if test="$isAdded = 'true'">
5288
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5289
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5290
+ </xsl:if>
5291
+ <xsl:if test="$isDeleted = 'true'">
5292
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5293
+ <xsl:if test="local-name() = 'table'">
5294
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5295
+ </xsl:if>
5296
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5297
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5298
+ </xsl:if>
5299
+ </xsl:otherwise>
5300
+ </xsl:choose>
5301
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5302
+ <xsl:if test="$lang = 'ar'">
5303
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5304
+ </xsl:if>
5305
+ </xsl:template><xsl:template name="setAlignment">
5306
+ <xsl:param name="align" select="normalize-space(@align)"/>
5307
+ <xsl:choose>
5308
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5309
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5310
+ <xsl:when test="$align != ''">
5311
+ <xsl:value-of select="$align"/>
5312
+ </xsl:when>
5313
+ </xsl:choose>
4853
5314
  </xsl:template></xsl:stylesheet>