metanorma-un 0.5.14 → 0.6.2

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,16 @@
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>
2317
+
2245
2318
 
2246
2319
 
2247
2320
 
@@ -2259,6 +2332,9 @@
2259
2332
 
2260
2333
 
2261
2334
 
2335
+ <xsl:if test=".//*[local-name() = 'table']">
2336
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2337
+ </xsl:if>
2262
2338
  <xsl:if test="@colspan">
2263
2339
  <xsl:attribute name="number-columns-spanned">
2264
2340
  <xsl:value-of select="@colspan"/>
@@ -2396,13 +2472,13 @@
2396
2472
  </xsl:choose>
2397
2473
  </xsl:variable>
2398
2474
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2399
- <xsl:element name="{$ns}:table">
2475
+ <!-- <xsl:element name="{$ns}:table"> -->
2400
2476
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2401
2477
  <tbody>
2402
2478
  <xsl:apply-templates mode="dl"/>
2403
2479
  </tbody>
2404
2480
  </xsl:for-each>
2405
- </xsl:element>
2481
+ <!-- </xsl:element> -->
2406
2482
  </xsl:variable>
2407
2483
 
2408
2484
  <xsl:call-template name="calculate-column-widths">
@@ -2493,6 +2569,8 @@
2493
2569
  <xsl:apply-templates/>
2494
2570
  </fo:inline>
2495
2571
  </xsl:template><xsl:template match="*[local-name()='dl']">
2572
+ <xsl:variable name="isAdded" select="@added"/>
2573
+ <xsl:variable name="isDeleted" select="@deleted"/>
2496
2574
  <fo:block-container>
2497
2575
 
2498
2576
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2509,6 +2587,12 @@
2509
2587
  </xsl:attribute>
2510
2588
 
2511
2589
  </xsl:if>
2590
+
2591
+ <xsl:call-template name="setTrackChangesStyles">
2592
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2593
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2594
+ </xsl:call-template>
2595
+
2512
2596
  <fo:block-container>
2513
2597
 
2514
2598
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2616,11 +2700,11 @@
2616
2700
  </xsl:choose>
2617
2701
  </xsl:variable>
2618
2702
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2619
- <xsl:element name="{$ns}:table">
2703
+ <!-- <xsl:element name="{$ns}:table"> -->
2620
2704
  <tbody>
2621
2705
  <xsl:apply-templates mode="dl"/>
2622
2706
  </tbody>
2623
- </xsl:element>
2707
+ <!-- </xsl:element> -->
2624
2708
  </xsl:variable>
2625
2709
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2626
2710
  <xsl:variable name="colwidths">
@@ -2887,8 +2971,78 @@
2887
2971
  <fo:inline text-decoration="underline">
2888
2972
  <xsl:apply-templates/>
2889
2973
  </fo:inline>
2974
+ </xsl:template><xsl:template match="*[local-name()='add']">
2975
+ <xsl:choose>
2976
+ <xsl:when test="@amendment">
2977
+ <fo:inline>
2978
+ <xsl:call-template name="insertTag">
2979
+ <xsl:with-param name="kind">A</xsl:with-param>
2980
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2981
+ </xsl:call-template>
2982
+ <xsl:apply-templates/>
2983
+ <xsl:call-template name="insertTag">
2984
+ <xsl:with-param name="type">closing</xsl:with-param>
2985
+ <xsl:with-param name="kind">A</xsl:with-param>
2986
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2987
+ </xsl:call-template>
2988
+ </fo:inline>
2989
+ </xsl:when>
2990
+ <xsl:when test="@corrigenda">
2991
+ <fo:inline>
2992
+ <xsl:call-template name="insertTag">
2993
+ <xsl:with-param name="kind">C</xsl:with-param>
2994
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2995
+ </xsl:call-template>
2996
+ <xsl:apply-templates/>
2997
+ <xsl:call-template name="insertTag">
2998
+ <xsl:with-param name="type">closing</xsl:with-param>
2999
+ <xsl:with-param name="kind">C</xsl:with-param>
3000
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3001
+ </xsl:call-template>
3002
+ </fo:inline>
3003
+ </xsl:when>
3004
+ <xsl:otherwise>
3005
+ <fo:inline xsl:use-attribute-sets="add-style">
3006
+ <xsl:apply-templates/>
3007
+ </fo:inline>
3008
+ </xsl:otherwise>
3009
+ </xsl:choose>
3010
+
3011
+ </xsl:template><xsl:template name="insertTag">
3012
+ <xsl:param name="type"/>
3013
+ <xsl:param name="kind"/>
3014
+ <xsl:param name="value"/>
3015
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3016
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3017
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3018
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3019
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3020
+ <xsl:attribute name="height">5mm</xsl:attribute>
3021
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3022
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3023
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3024
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3025
+ <g>
3026
+ <xsl:if test="$type = 'closing'">
3027
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3028
+ </xsl:if>
3029
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3030
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3031
+ </g>
3032
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3033
+ <xsl:if test="$type = 'closing'">
3034
+ <xsl:attribute name="x">25</xsl:attribute>
3035
+ </xsl:if>
3036
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3037
+ </text>
3038
+ </svg>
3039
+ </fo:instream-foreign-object>
2890
3040
  </xsl:template><xsl:template match="*[local-name()='del']">
2891
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3041
+ <fo:inline xsl:use-attribute-sets="del-style">
3042
+ <xsl:apply-templates/>
3043
+ </fo:inline>
3044
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3045
+ <fo:inline background-color="yellow">
2892
3046
  <xsl:apply-templates/>
2893
3047
  </fo:inline>
2894
3048
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3225,12 +3379,23 @@
3225
3379
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3226
3380
  <xsl:value-of select="substring($str, 2)"/>
3227
3381
  </xsl:template><xsl:template match="mathml:math">
3228
- <fo:inline font-family="STIX Two Math"> <!-- -->
3382
+ <xsl:variable name="isAdded" select="@added"/>
3383
+ <xsl:variable name="isDeleted" select="@deleted"/>
3384
+
3385
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3386
+
3387
+
3388
+ <xsl:call-template name="setTrackChangesStyles">
3389
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3390
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3391
+ </xsl:call-template>
3229
3392
 
3230
3393
  <xsl:variable name="mathml">
3231
3394
  <xsl:apply-templates select="." mode="mathml"/>
3232
3395
  </xsl:variable>
3233
3396
  <fo:instream-foreign-object fox:alt-text="Math">
3397
+
3398
+
3234
3399
  <!-- <xsl:copy-of select="."/> -->
3235
3400
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3236
3401
  </fo:instream-foreign-object>
@@ -3249,7 +3414,7 @@
3249
3414
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3250
3415
  </xsl:copy>
3251
3416
  <mathml:mspace width="0.5ex"/>
3252
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3417
+ </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
3418
  <xsl:variable name="target">
3254
3419
  <xsl:choose>
3255
3420
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3283,8 +3448,6 @@
3283
3448
  </xsl:otherwise>
3284
3449
  </xsl:choose>
3285
3450
  </fo:inline>
3286
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3287
- <fo:inline id="{@id}"/>
3288
3451
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3289
3452
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3290
3453
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3493,8 +3656,15 @@
3493
3656
  </fo:inline>
3494
3657
  </xsl:if>
3495
3658
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3659
+ <xsl:variable name="isAdded" select="@added"/>
3660
+ <xsl:variable name="isDeleted" select="@deleted"/>
3496
3661
  <fo:block-container id="{@id}">
3497
3662
 
3663
+ <xsl:call-template name="setTrackChangesStyles">
3664
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3665
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3666
+ </xsl:call-template>
3667
+
3498
3668
  <fo:block>
3499
3669
  <xsl:apply-templates/>
3500
3670
  </fo:block>
@@ -3508,32 +3678,118 @@
3508
3678
  <fo:block id="{@id}">
3509
3679
  <xsl:apply-templates/>
3510
3680
  </fo:block>
3681
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3511
3682
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3512
3683
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3513
3684
  <xsl:apply-templates/>
3514
3685
  </fo:block>
3515
3686
  </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>
3687
+ <xsl:variable name="isAdded" select="../@added"/>
3688
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3689
+ <xsl:choose>
3690
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3691
+ <fo:inline padding-left="1mm" padding-right="1mm">
3692
+ <xsl:variable name="src">
3693
+ <xsl:call-template name="image_src"/>
3694
+ </xsl:variable>
3695
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3696
+ </fo:inline>
3697
+ </xsl:when>
3698
+ <xsl:otherwise>
3699
+ <fo:block xsl:use-attribute-sets="image-style">
3700
+
3701
+ <xsl:if test="ancestor::un:admonition">
3702
+ <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3703
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3704
+ </xsl:if>
3705
+
3706
+ <xsl:variable name="src">
3707
+ <xsl:call-template name="image_src"/>
3708
+ </xsl:variable>
3709
+
3710
+ <xsl:choose>
3711
+ <xsl:when test="$isDeleted = 'true'">
3712
+ <!-- enclose in svg -->
3713
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3714
+ <xsl:attribute name="width">100%</xsl:attribute>
3715
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3716
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3717
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3718
+
3719
+
3720
+ <xsl:apply-templates select="." mode="cross_image"/>
3721
+
3722
+ </fo:instream-foreign-object>
3723
+ </xsl:when>
3724
+ <xsl:otherwise>
3725
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3726
+ </xsl:otherwise>
3727
+ </xsl:choose>
3728
+
3729
+ </fo:block>
3730
+ </xsl:otherwise>
3731
+ </xsl:choose>
3732
+ </xsl:template><xsl:template name="image_src">
3733
+ <xsl:choose>
3734
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3735
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3736
+ </xsl:when>
3737
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3738
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3739
+ </xsl:when>
3740
+ <xsl:otherwise>
3741
+ <xsl:value-of select="@src"/>
3742
+ </xsl:otherwise>
3743
+ </xsl:choose>
3744
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3745
+ <xsl:choose>
3746
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3747
+ <xsl:variable name="src">
3748
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3749
+ </xsl:variable>
3750
+ <xsl:variable name="width" select="document($src)/@width"/>
3751
+ <xsl:variable name="height" select="document($src)/@height"/>
3752
+ <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">
3753
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3754
+ </svg>
3755
+ </xsl:when>
3756
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3757
+ <xsl:variable name="src">
3758
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3759
+ </xsl:variable>
3760
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3761
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3762
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3763
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3764
+ <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">
3765
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3766
+ </svg>
3767
+ </xsl:when>
3768
+ <xsl:otherwise>
3769
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3770
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3771
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3772
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3773
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3774
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3775
+ <!-- width=<xsl:value-of select="$width"/> -->
3776
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3777
+ <!-- height=<xsl:value-of select="$height"/> -->
3778
+ <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">
3779
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3780
+ <xsl:call-template name="svg_cross">
3781
+ <xsl:with-param name="width" select="$width"/>
3782
+ <xsl:with-param name="height" select="$height"/>
3783
+ </xsl:call-template>
3784
+ </svg>
3785
+ </xsl:otherwise>
3786
+ </xsl:choose>
3787
+
3788
+ </xsl:template><xsl:template name="svg_cross">
3789
+ <xsl:param name="width"/>
3790
+ <xsl:param name="height"/>
3791
+ <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; "/>
3792
+ <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
3793
  </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
3794
  <xsl:apply-templates mode="contents"/>
3539
3795
  <xsl:text> </xsl:text>
@@ -4076,6 +4332,7 @@
4076
4332
  <xsl:variable name="element">
4077
4333
  block
4078
4334
 
4335
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4079
4336
  </xsl:variable>
4080
4337
  <xsl:choose>
4081
4338
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4083,7 +4340,7 @@
4083
4340
  <xsl:apply-templates/>
4084
4341
  </fo:inline>
4085
4342
  </xsl:when>
4086
- <xsl:when test="normalize-space($element) = 'block'">
4343
+ <xsl:when test="contains(normalize-space($element), 'block')">
4087
4344
  <fo:block xsl:use-attribute-sets="example-name-style">
4088
4345
  <xsl:apply-templates/>
4089
4346
  </fo:block>
@@ -4096,10 +4353,11 @@
4096
4353
  </xsl:choose>
4097
4354
 
4098
4355
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4099
-
4356
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4100
4357
  <xsl:variable name="element">
4101
4358
  block
4102
4359
 
4360
+
4103
4361
  </xsl:variable>
4104
4362
  <xsl:choose>
4105
4363
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4195,29 +4453,47 @@
4195
4453
  <xsl:text>— </xsl:text>
4196
4454
  <xsl:apply-templates/>
4197
4455
  </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>
4456
+
4457
+ <xsl:variable name="bibitemid">
4458
+ <xsl:choose>
4459
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4460
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4461
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4462
+ </xsl:choose>
4463
+ </xsl:variable>
4464
+
4465
+ <xsl:choose>
4466
+ <xsl:when test="normalize-space($bibitemid) != ''">
4467
+ <fo:inline xsl:use-attribute-sets="eref-style">
4468
+ <xsl:if test="@type = 'footnote'">
4469
+
4470
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4471
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4472
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4473
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4474
+
4475
+
4476
+ </xsl:if>
4477
+
4478
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4479
+ <xsl:if test="normalize-space(@citeas) = ''">
4480
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4481
+ </xsl:if>
4482
+ <xsl:if test="@type = 'inline'">
4483
+
4484
+
4485
+
4486
+ </xsl:if>
4487
+
4488
+ <xsl:apply-templates/>
4489
+ </fo:basic-link>
4490
+
4491
+ </fo:inline>
4492
+ </xsl:when>
4493
+ <xsl:otherwise>
4494
+ <fo:inline><xsl:apply-templates/></fo:inline>
4495
+ </xsl:otherwise>
4496
+ </xsl:choose>
4221
4497
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4222
4498
  <!-- zero-space char -->
4223
4499
  <xsl:variable name="depth">
@@ -4275,7 +4551,8 @@
4275
4551
  </fo:inline>
4276
4552
  </xsl:when>
4277
4553
  <xsl:otherwise>
4278
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4554
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4555
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4279
4556
  </xsl:otherwise>
4280
4557
  </xsl:choose>
4281
4558
 
@@ -4407,6 +4684,153 @@
4407
4684
  </fo:block>
4408
4685
  </xsl:otherwise>
4409
4686
  </xsl:choose>
4687
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4688
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4689
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4690
+ </xsl:for-each>
4691
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4692
+ <xsl:copy>
4693
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4694
+ </xsl:copy>
4695
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4696
+ <xsl:variable name="id">
4697
+ <xsl:call-template name="generateIndexXrefId"/>
4698
+ </xsl:variable>
4699
+ <xsl:copy> <!-- add id to xref -->
4700
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4701
+ <xsl:attribute name="id">
4702
+ <xsl:value-of select="$id"/>
4703
+ </xsl:attribute>
4704
+ <xsl:apply-templates mode="index_add_id"/>
4705
+ </xsl:copy>
4706
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4707
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4708
+ <xsl:if test="@to">
4709
+ <xsl:value-of select="$dash"/>
4710
+ <xsl:copy>
4711
+ <xsl:copy-of select="@*"/>
4712
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4713
+ <xsl:attribute name="id">
4714
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4715
+ </xsl:attribute>
4716
+ <xsl:apply-templates mode="index_add_id"/>
4717
+ </xsl:copy>
4718
+ </xsl:if>
4719
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4720
+ <xsl:copy>
4721
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4722
+ </xsl:copy>
4723
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4724
+ <xsl:copy>
4725
+ <xsl:apply-templates select="@*" mode="index_update"/>
4726
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4727
+ </xsl:copy>
4728
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4729
+ <xsl:param name="element"/>
4730
+ <xsl:param name="remove" select="'false'"/>
4731
+ <xsl:param name="target"/>
4732
+ <!-- <node></node> -->
4733
+ <xsl:choose>
4734
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4735
+ <!-- skip text (i.e. remove it) and process next element -->
4736
+ <!-- [removed_<xsl:value-of select="."/>] -->
4737
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4738
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4739
+ </xsl:apply-templates>
4740
+ </xsl:when>
4741
+ <xsl:when test="self::text()">
4742
+ <xsl:value-of select="."/>
4743
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4744
+ </xsl:when>
4745
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4746
+ <xsl:variable name="id" select="@id"/>
4747
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4748
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4749
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4750
+
4751
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4752
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4753
+
4754
+ <xsl:choose>
4755
+ <!-- 2nd pass -->
4756
+ <!-- if page is equal to page for next and page is not the end of range -->
4757
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4758
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4759
+ <!-- [removed_xref] -->
4760
+
4761
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4762
+ <xsl:with-param name="remove">true</xsl:with-param>
4763
+ <xsl:with-param name="target">
4764
+ <xsl:choose>
4765
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4766
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4767
+ </xsl:choose>
4768
+ </xsl:with-param>
4769
+ </xsl:apply-templates>
4770
+ </xsl:when>
4771
+
4772
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4773
+ <!-- remove xref -->
4774
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4775
+ <xsl:with-param name="remove">true</xsl:with-param>
4776
+ </xsl:apply-templates>
4777
+ </xsl:when>
4778
+
4779
+ <xsl:otherwise>
4780
+ <xsl:apply-templates select="." mode="xref_copy">
4781
+ <xsl:with-param name="target" select="$target"/>
4782
+ </xsl:apply-templates>
4783
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4784
+ </xsl:otherwise>
4785
+ </xsl:choose>
4786
+ </xsl:when>
4787
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4788
+ <!-- ul -->
4789
+ <xsl:apply-templates select="." mode="index_update"/>
4790
+ </xsl:when>
4791
+ <xsl:otherwise>
4792
+ <xsl:apply-templates select="." mode="xref_copy">
4793
+ <xsl:with-param name="target" select="$target"/>
4794
+ </xsl:apply-templates>
4795
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4796
+ </xsl:otherwise>
4797
+ </xsl:choose>
4798
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4799
+ <xsl:param name="target"/>
4800
+ <xsl:copy>
4801
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4802
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4803
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4804
+ </xsl:if>
4805
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4806
+ </xsl:copy>
4807
+ </xsl:template><xsl:template name="generateIndexXrefId">
4808
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4809
+
4810
+ <xsl:variable name="docid">
4811
+ <xsl:call-template name="getDocumentId"/>
4812
+ </xsl:variable>
4813
+ <xsl:variable name="item_number">
4814
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4815
+ </xsl:variable>
4816
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4817
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4818
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4819
+ <xsl:apply-templates/>
4820
+ <fo:block>
4821
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4822
+ <fo:block> </fo:block>
4823
+ </xsl:if>
4824
+ </fo:block>
4825
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4826
+ <xsl:apply-templates/>
4827
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4828
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4829
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4830
+ <xsl:apply-templates/>
4831
+ </fo:block>
4832
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4833
+ <fo:inline id="{@id}" font-size="1pt"/>
4410
4834
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4411
4835
  <!-- <row>
4412
4836
  <date>05-07-2013</date>
@@ -4504,6 +4928,70 @@
4504
4928
  <xsl:value-of select="substring(.,1,1)"/>
4505
4929
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4506
4930
  <fo:inline><xsl:apply-templates/></fo:inline>
4931
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4932
+ <fo:block>
4933
+ <xsl:apply-templates/>
4934
+ </fo:block>
4935
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4936
+ <fo:inline><xsl:apply-templates/></fo:inline>
4937
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4938
+ <fo:inline>
4939
+ <xsl:call-template name="text_input"/>
4940
+ </fo:inline>
4941
+ </xsl:template><xsl:template name="text_input">
4942
+ <xsl:variable name="count">
4943
+ <xsl:choose>
4944
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4945
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4946
+ <xsl:otherwise>10</xsl:otherwise>
4947
+ </xsl:choose>
4948
+ </xsl:variable>
4949
+ <xsl:call-template name="repeat">
4950
+ <xsl:with-param name="char" select="'_'"/>
4951
+ <xsl:with-param name="count" select="$count"/>
4952
+ </xsl:call-template>
4953
+ <xsl:text> </xsl:text>
4954
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4955
+ <xsl:variable name="caption">
4956
+ <xsl:choose>
4957
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4958
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4959
+ </xsl:choose>
4960
+ </xsl:variable>
4961
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4962
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4963
+ <fo:inline padding-right="1mm">
4964
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4965
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4966
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4967
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4968
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4969
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4970
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4971
+ </svg>
4972
+ </fo:instream-foreign-object>
4973
+ </fo:inline>
4974
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4975
+ <fo:inline padding-right="1mm">
4976
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4977
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4978
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4979
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4980
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4981
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4982
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4983
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4984
+ </svg>
4985
+ </fo:instream-foreign-object>
4986
+ </fo:inline>
4987
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4988
+ <fo:inline>
4989
+ <xsl:call-template name="text_input"/>
4990
+ </fo:inline>
4991
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4992
+ <fo:block-container border="1pt solid black" width="50%">
4993
+ <fo:block> </fo:block>
4994
+ </fo:block-container>
4507
4995
  </xsl:template><xsl:template name="convertDate">
4508
4996
  <xsl:param name="date"/>
4509
4997
  <xsl:param name="format" select="'short'"/>
@@ -4623,70 +5111,68 @@
4623
5111
  <xsl:variable name="lang">
4624
5112
  <xsl:call-template name="getLang"/>
4625
5113
  </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>
5114
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5115
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5116
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5117
+ </pdf:dictionary>
5118
+ </pdf:catalog>
5119
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5120
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5121
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5122
+ <!-- Dublin Core properties go here -->
5123
+ <dc:title>
5124
+ <xsl:variable name="title">
4659
5125
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4660
5126
 
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>
5127
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4665
5128
 
4666
5129
 
4667
5130
 
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
5131
 
4675
5132
 
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>
5133
+
5134
+ </xsl:for-each>
5135
+ </xsl:variable>
5136
+ <xsl:choose>
5137
+ <xsl:when test="normalize-space($title) != ''">
5138
+ <xsl:value-of select="$title"/>
5139
+ </xsl:when>
5140
+ <xsl:otherwise>
5141
+ <xsl:text> </xsl:text>
5142
+ </xsl:otherwise>
5143
+ </xsl:choose>
5144
+ </dc:title>
5145
+ <dc:creator>
5146
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5147
+
5148
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5149
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5150
+ <xsl:if test="position() != last()">; </xsl:if>
5151
+ </xsl:for-each>
5152
+
5153
+
5154
+
5155
+ </xsl:for-each>
5156
+ </dc:creator>
5157
+ <dc:description>
5158
+ <xsl:variable name="abstract">
5159
+
5160
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5161
+
5162
+
5163
+ </xsl:variable>
5164
+ <xsl:value-of select="normalize-space($abstract)"/>
5165
+ </dc:description>
5166
+ <pdf:Keywords>
5167
+ <xsl:call-template name="insertKeywords"/>
5168
+ </pdf:Keywords>
5169
+ </rdf:Description>
5170
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5171
+ <!-- XMP properties go here -->
5172
+ <xmp:CreatorTool/>
5173
+ </rdf:Description>
5174
+ </rdf:RDF>
5175
+ </x:xmpmeta>
4690
5176
  </xsl:template><xsl:template name="getId">
4691
5177
  <xsl:choose>
4692
5178
  <xsl:when test="../@id">
@@ -4850,4 +5336,44 @@
4850
5336
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4851
5337
  </xsl:choose>
4852
5338
 
5339
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5340
+ <xsl:param name="isAdded"/>
5341
+ <xsl:param name="isDeleted"/>
5342
+ <xsl:choose>
5343
+ <xsl:when test="local-name() = 'math'">
5344
+ <xsl:if test="$isAdded = 'true'">
5345
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5346
+ </xsl:if>
5347
+ <xsl:if test="$isDeleted = 'true'">
5348
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5349
+ </xsl:if>
5350
+ </xsl:when>
5351
+ <xsl:otherwise>
5352
+ <xsl:if test="$isAdded = 'true'">
5353
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5354
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5355
+ </xsl:if>
5356
+ <xsl:if test="$isDeleted = 'true'">
5357
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5358
+ <xsl:if test="local-name() = 'table'">
5359
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5360
+ </xsl:if>
5361
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5362
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5363
+ </xsl:if>
5364
+ </xsl:otherwise>
5365
+ </xsl:choose>
5366
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5367
+ <xsl:if test="$lang = 'ar'">
5368
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5369
+ </xsl:if>
5370
+ </xsl:template><xsl:template name="setAlignment">
5371
+ <xsl:param name="align" select="normalize-space(@align)"/>
5372
+ <xsl:choose>
5373
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5374
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5375
+ <xsl:when test="$align != ''">
5376
+ <xsl:value-of select="$align"/>
5377
+ </xsl:when>
5378
+ </xsl:choose>
4853
5379
  </xsl:template></xsl:stylesheet>