metanorma-mpfa 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 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
  <xsl:key name="kfn" match="mpfd:p/mpfd:fn" use="@reference"/>
9
11
 
@@ -94,7 +96,9 @@
94
96
 
95
97
  </fo:layout-master-set>
96
98
 
97
- <xsl:call-template name="addPDFUAmeta"/>
99
+ <fo:declarations>
100
+ <xsl:call-template name="addPDFUAmeta"/>
101
+ </fo:declarations>
98
102
 
99
103
  <xsl:call-template name="addBookmarks">
100
104
  <xsl:with-param name="contents" select="$contents"/>
@@ -933,6 +937,7 @@
933
937
  </xsl:choose>
934
938
  </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">
935
939
 
940
+
936
941
  </xsl:attribute-set><xsl:attribute-set name="link-style">
937
942
 
938
943
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1039,6 +1044,7 @@
1039
1044
 
1040
1045
 
1041
1046
 
1047
+
1042
1048
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1043
1049
 
1044
1050
 
@@ -1230,13 +1236,31 @@
1230
1236
 
1231
1237
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1232
1238
 
1233
-
1239
+
1234
1240
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1235
1241
 
1236
1242
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1237
1243
 
1238
1244
 
1239
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1245
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1246
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1247
+ </xsl:variable><xsl:attribute-set name="add-style">
1248
+ <xsl:attribute name="color">red</xsl:attribute>
1249
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1250
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1251
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1252
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1253
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1254
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1255
+ <xsl:text>red</xsl:text>
1256
+ </xsl:variable><xsl:attribute-set name="del-style">
1257
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1258
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1259
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1260
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1261
+
1262
+
1263
+ </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">
1240
1264
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1241
1265
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1242
1266
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1281,16 +1305,17 @@
1281
1305
  <xsl:call-template name="add-zero-spaces-java"/>
1282
1306
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1283
1307
 
1308
+ <xsl:variable name="table-preamble">
1309
+
1310
+
1311
+ </xsl:variable>
1312
+
1284
1313
  <xsl:variable name="table">
1285
1314
 
1286
1315
  <xsl:variable name="simple-table">
1287
1316
  <xsl:call-template name="getSimpleTable"/>
1288
1317
  </xsl:variable>
1289
1318
 
1290
-
1291
-
1292
-
1293
-
1294
1319
  <!-- <xsl:if test="$namespace = 'bipm'">
1295
1320
  <fo:block>&#xA0;</fo:block>
1296
1321
  </xsl:if> -->
@@ -1305,7 +1330,7 @@
1305
1330
 
1306
1331
 
1307
1332
 
1308
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1333
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1309
1334
 
1310
1335
  <!-- <xsl:variable name="cols-count">
1311
1336
  <xsl:choose>
@@ -1324,8 +1349,6 @@
1324
1349
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1325
1350
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1326
1351
 
1327
-
1328
-
1329
1352
  <xsl:variable name="colwidths">
1330
1353
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1331
1354
  <xsl:call-template name="calculate-column-widths">
@@ -1353,6 +1376,7 @@
1353
1376
  </xsl:choose>
1354
1377
  </xsl:variable>
1355
1378
 
1379
+
1356
1380
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1357
1381
 
1358
1382
 
@@ -1388,6 +1412,7 @@
1388
1412
 
1389
1413
 
1390
1414
 
1415
+
1391
1416
 
1392
1417
 
1393
1418
 
@@ -1480,7 +1505,8 @@
1480
1505
  </fo:block-container>
1481
1506
  </xsl:variable>
1482
1507
 
1483
-
1508
+ <xsl:variable name="isAdded" select="@added"/>
1509
+ <xsl:variable name="isDeleted" select="@deleted"/>
1484
1510
 
1485
1511
  <xsl:choose>
1486
1512
  <xsl:when test="@width">
@@ -1494,7 +1520,14 @@
1494
1520
  <fo:table-body>
1495
1521
  <fo:table-row>
1496
1522
  <fo:table-cell column-number="2">
1497
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1523
+ <xsl:copy-of select="$table-preamble"/>
1524
+ <fo:block>
1525
+ <xsl:call-template name="setTrackChangesStyles">
1526
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1527
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1528
+ </xsl:call-template>
1529
+ <xsl:copy-of select="$table"/>
1530
+ </fo:block>
1498
1531
  </fo:table-cell>
1499
1532
  </fo:table-row>
1500
1533
  </fo:table-body>
@@ -1505,7 +1538,22 @@
1505
1538
 
1506
1539
  </xsl:when>
1507
1540
  <xsl:otherwise>
1508
- <xsl:copy-of select="$table"/>
1541
+ <xsl:choose>
1542
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1543
+ <xsl:copy-of select="$table-preamble"/>
1544
+ <fo:block>
1545
+ <xsl:call-template name="setTrackChangesStyles">
1546
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1547
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1548
+ </xsl:call-template>
1549
+ <xsl:copy-of select="$table"/>
1550
+ </fo:block>
1551
+ </xsl:when>
1552
+ <xsl:otherwise>
1553
+ <xsl:copy-of select="$table-preamble"/>
1554
+ <xsl:copy-of select="$table"/>
1555
+ </xsl:otherwise>
1556
+ </xsl:choose>
1509
1557
  </xsl:otherwise>
1510
1558
  </xsl:choose>
1511
1559
 
@@ -1566,7 +1614,7 @@
1566
1614
  </xsl:for-each>
1567
1615
  </xsl:when>
1568
1616
  <xsl:otherwise>
1569
- <xsl:for-each select="xalan:nodeset($table)//tr">
1617
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1570
1618
  <xsl:variable name="td_text">
1571
1619
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1572
1620
 
@@ -1636,7 +1684,15 @@
1636
1684
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1637
1685
  <xsl:value-of select="@target"/>
1638
1686
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1639
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1687
+ <xsl:variable name="mathml">
1688
+ <xsl:for-each select="*">
1689
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1690
+ <xsl:copy-of select="."/>
1691
+ </xsl:if>
1692
+ </xsl:for-each>
1693
+ </xsl:variable>
1694
+
1695
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1640
1696
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1641
1697
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1642
1698
  <xsl:param name="cols-count"/>
@@ -1898,7 +1954,8 @@
1898
1954
  <xsl:attribute name="text-align">
1899
1955
  <xsl:choose>
1900
1956
  <xsl:when test="@align">
1901
- <xsl:value-of select="@align"/>
1957
+ <xsl:call-template name="setAlignment"/>
1958
+ <!-- <xsl:value-of select="@align"/> -->
1902
1959
  </xsl:when>
1903
1960
  <xsl:otherwise>center</xsl:otherwise>
1904
1961
  </xsl:choose>
@@ -1917,6 +1974,9 @@
1917
1974
  <xsl:attribute name="border-bottom">solid black 2pt</xsl:attribute>
1918
1975
 
1919
1976
 
1977
+ <xsl:if test="$lang = 'ar'">
1978
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1979
+ </xsl:if>
1920
1980
  <xsl:if test="@colspan">
1921
1981
  <xsl:attribute name="number-columns-spanned">
1922
1982
  <xsl:value-of select="@colspan"/>
@@ -1948,11 +2008,16 @@
1948
2008
  <xsl:attribute name="text-align">
1949
2009
  <xsl:choose>
1950
2010
  <xsl:when test="@align">
1951
- <xsl:value-of select="@align"/>
2011
+ <xsl:call-template name="setAlignment"/>
2012
+ <!-- <xsl:value-of select="@align"/> -->
1952
2013
  </xsl:when>
1953
2014
  <xsl:otherwise>left</xsl:otherwise>
1954
2015
  </xsl:choose>
1955
2016
  </xsl:attribute>
2017
+ <xsl:if test="$lang = 'ar'">
2018
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2019
+ </xsl:if>
2020
+
1956
2021
 
1957
2022
 
1958
2023
 
@@ -1964,6 +2029,9 @@
1964
2029
 
1965
2030
 
1966
2031
 
2032
+ <xsl:if test=".//*[local-name() = 'table']">
2033
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2034
+ </xsl:if>
1967
2035
  <xsl:if test="@colspan">
1968
2036
  <xsl:attribute name="number-columns-spanned">
1969
2037
  <xsl:value-of select="@colspan"/>
@@ -2089,13 +2157,13 @@
2089
2157
  </xsl:choose>
2090
2158
  </xsl:variable>
2091
2159
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2092
- <xsl:element name="{$ns}:table">
2160
+ <!-- <xsl:element name="{$ns}:table"> -->
2093
2161
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2094
2162
  <tbody>
2095
2163
  <xsl:apply-templates mode="dl"/>
2096
2164
  </tbody>
2097
2165
  </xsl:for-each>
2098
- </xsl:element>
2166
+ <!-- </xsl:element> -->
2099
2167
  </xsl:variable>
2100
2168
 
2101
2169
  <xsl:call-template name="calculate-column-widths">
@@ -2186,6 +2254,8 @@
2186
2254
  <xsl:apply-templates/>
2187
2255
  </fo:inline>
2188
2256
  </xsl:template><xsl:template match="*[local-name()='dl']">
2257
+ <xsl:variable name="isAdded" select="@added"/>
2258
+ <xsl:variable name="isDeleted" select="@deleted"/>
2189
2259
  <fo:block-container>
2190
2260
 
2191
2261
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2202,6 +2272,12 @@
2202
2272
  </xsl:attribute>
2203
2273
 
2204
2274
  </xsl:if>
2275
+
2276
+ <xsl:call-template name="setTrackChangesStyles">
2277
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2278
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2279
+ </xsl:call-template>
2280
+
2205
2281
  <fo:block-container>
2206
2282
 
2207
2283
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2309,11 +2385,11 @@
2309
2385
  </xsl:choose>
2310
2386
  </xsl:variable>
2311
2387
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2312
- <xsl:element name="{$ns}:table">
2388
+ <!-- <xsl:element name="{$ns}:table"> -->
2313
2389
  <tbody>
2314
2390
  <xsl:apply-templates mode="dl"/>
2315
2391
  </tbody>
2316
- </xsl:element>
2392
+ <!-- </xsl:element> -->
2317
2393
  </xsl:variable>
2318
2394
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2319
2395
  <xsl:variable name="colwidths">
@@ -2580,8 +2656,78 @@
2580
2656
  <fo:inline text-decoration="underline">
2581
2657
  <xsl:apply-templates/>
2582
2658
  </fo:inline>
2659
+ </xsl:template><xsl:template match="*[local-name()='add']">
2660
+ <xsl:choose>
2661
+ <xsl:when test="@amendment">
2662
+ <fo:inline>
2663
+ <xsl:call-template name="insertTag">
2664
+ <xsl:with-param name="kind">A</xsl:with-param>
2665
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2666
+ </xsl:call-template>
2667
+ <xsl:apply-templates/>
2668
+ <xsl:call-template name="insertTag">
2669
+ <xsl:with-param name="type">closing</xsl:with-param>
2670
+ <xsl:with-param name="kind">A</xsl:with-param>
2671
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2672
+ </xsl:call-template>
2673
+ </fo:inline>
2674
+ </xsl:when>
2675
+ <xsl:when test="@corrigenda">
2676
+ <fo:inline>
2677
+ <xsl:call-template name="insertTag">
2678
+ <xsl:with-param name="kind">C</xsl:with-param>
2679
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2680
+ </xsl:call-template>
2681
+ <xsl:apply-templates/>
2682
+ <xsl:call-template name="insertTag">
2683
+ <xsl:with-param name="type">closing</xsl:with-param>
2684
+ <xsl:with-param name="kind">C</xsl:with-param>
2685
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2686
+ </xsl:call-template>
2687
+ </fo:inline>
2688
+ </xsl:when>
2689
+ <xsl:otherwise>
2690
+ <fo:inline xsl:use-attribute-sets="add-style">
2691
+ <xsl:apply-templates/>
2692
+ </fo:inline>
2693
+ </xsl:otherwise>
2694
+ </xsl:choose>
2695
+
2696
+ </xsl:template><xsl:template name="insertTag">
2697
+ <xsl:param name="type"/>
2698
+ <xsl:param name="kind"/>
2699
+ <xsl:param name="value"/>
2700
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2701
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2702
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2703
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2704
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2705
+ <xsl:attribute name="height">5mm</xsl:attribute>
2706
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2707
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2708
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2709
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2710
+ <g>
2711
+ <xsl:if test="$type = 'closing'">
2712
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2713
+ </xsl:if>
2714
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2715
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2716
+ </g>
2717
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2718
+ <xsl:if test="$type = 'closing'">
2719
+ <xsl:attribute name="x">25</xsl:attribute>
2720
+ </xsl:if>
2721
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2722
+ </text>
2723
+ </svg>
2724
+ </fo:instream-foreign-object>
2583
2725
  </xsl:template><xsl:template match="*[local-name()='del']">
2584
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2726
+ <fo:inline xsl:use-attribute-sets="del-style">
2727
+ <xsl:apply-templates/>
2728
+ </fo:inline>
2729
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2730
+ <fo:inline background-color="yellow">
2585
2731
  <xsl:apply-templates/>
2586
2732
  </fo:inline>
2587
2733
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -2918,12 +3064,23 @@
2918
3064
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2919
3065
  <xsl:value-of select="substring($str, 2)"/>
2920
3066
  </xsl:template><xsl:template match="mathml:math">
2921
- <fo:inline font-family="STIX Two Math"> <!-- -->
3067
+ <xsl:variable name="isAdded" select="@added"/>
3068
+ <xsl:variable name="isDeleted" select="@deleted"/>
3069
+
3070
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3071
+
3072
+
3073
+ <xsl:call-template name="setTrackChangesStyles">
3074
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3075
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3076
+ </xsl:call-template>
2922
3077
 
2923
3078
  <xsl:variable name="mathml">
2924
3079
  <xsl:apply-templates select="." mode="mathml"/>
2925
3080
  </xsl:variable>
2926
3081
  <fo:instream-foreign-object fox:alt-text="Math">
3082
+
3083
+
2927
3084
  <!-- <xsl:copy-of select="."/> -->
2928
3085
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2929
3086
  </fo:instream-foreign-object>
@@ -2942,7 +3099,7 @@
2942
3099
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
2943
3100
  </xsl:copy>
2944
3101
  <mathml:mspace width="0.5ex"/>
2945
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3102
+ </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">
2946
3103
  <xsl:variable name="target">
2947
3104
  <xsl:choose>
2948
3105
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -2976,8 +3133,6 @@
2976
3133
  </xsl:otherwise>
2977
3134
  </xsl:choose>
2978
3135
  </fo:inline>
2979
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
2980
- <fo:inline id="{@id}"/>
2981
3136
  </xsl:template><xsl:template match="*[local-name()='appendix']">
2982
3137
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
2983
3138
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3169,8 +3324,15 @@
3169
3324
  </fo:inline>
3170
3325
  </xsl:if>
3171
3326
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3327
+ <xsl:variable name="isAdded" select="@added"/>
3328
+ <xsl:variable name="isDeleted" select="@deleted"/>
3172
3329
  <fo:block-container id="{@id}">
3173
3330
 
3331
+ <xsl:call-template name="setTrackChangesStyles">
3332
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3333
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3334
+ </xsl:call-template>
3335
+
3174
3336
  <fo:block>
3175
3337
  <xsl:apply-templates/>
3176
3338
  </fo:block>
@@ -3184,27 +3346,113 @@
3184
3346
  <fo:block id="{@id}">
3185
3347
  <xsl:apply-templates/>
3186
3348
  </fo:block>
3349
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3187
3350
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3188
3351
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3189
3352
  <xsl:apply-templates/>
3190
3353
  </fo:block>
3191
3354
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3192
- <fo:block xsl:use-attribute-sets="image-style">
3193
-
3194
-
3195
- <xsl:variable name="src">
3196
- <xsl:choose>
3197
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3198
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3199
- </xsl:when>
3200
- <xsl:otherwise>
3201
- <xsl:value-of select="@src"/>
3202
- </xsl:otherwise>
3203
- </xsl:choose>
3204
- </xsl:variable>
3205
-
3206
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3207
- </fo:block>
3355
+ <xsl:variable name="isAdded" select="../@added"/>
3356
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3357
+ <xsl:choose>
3358
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3359
+ <fo:inline padding-left="1mm" padding-right="1mm">
3360
+ <xsl:variable name="src">
3361
+ <xsl:call-template name="image_src"/>
3362
+ </xsl:variable>
3363
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3364
+ </fo:inline>
3365
+ </xsl:when>
3366
+ <xsl:otherwise>
3367
+ <fo:block xsl:use-attribute-sets="image-style">
3368
+
3369
+ <xsl:variable name="src">
3370
+ <xsl:call-template name="image_src"/>
3371
+ </xsl:variable>
3372
+
3373
+ <xsl:choose>
3374
+ <xsl:when test="$isDeleted = 'true'">
3375
+ <!-- enclose in svg -->
3376
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3377
+ <xsl:attribute name="width">100%</xsl:attribute>
3378
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3379
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3380
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3381
+
3382
+
3383
+ <xsl:apply-templates select="." mode="cross_image"/>
3384
+
3385
+ </fo:instream-foreign-object>
3386
+ </xsl:when>
3387
+ <xsl:otherwise>
3388
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3389
+ </xsl:otherwise>
3390
+ </xsl:choose>
3391
+
3392
+ </fo:block>
3393
+ </xsl:otherwise>
3394
+ </xsl:choose>
3395
+ </xsl:template><xsl:template name="image_src">
3396
+ <xsl:choose>
3397
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3398
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3399
+ </xsl:when>
3400
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3401
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3402
+ </xsl:when>
3403
+ <xsl:otherwise>
3404
+ <xsl:value-of select="@src"/>
3405
+ </xsl:otherwise>
3406
+ </xsl:choose>
3407
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3408
+ <xsl:choose>
3409
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3410
+ <xsl:variable name="src">
3411
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3412
+ </xsl:variable>
3413
+ <xsl:variable name="width" select="document($src)/@width"/>
3414
+ <xsl:variable name="height" select="document($src)/@height"/>
3415
+ <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">
3416
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3417
+ </svg>
3418
+ </xsl:when>
3419
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3420
+ <xsl:variable name="src">
3421
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3422
+ </xsl:variable>
3423
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3424
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3425
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3426
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3427
+ <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">
3428
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3429
+ </svg>
3430
+ </xsl:when>
3431
+ <xsl:otherwise>
3432
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3433
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3434
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3435
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3436
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3437
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3438
+ <!-- width=<xsl:value-of select="$width"/> -->
3439
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3440
+ <!-- height=<xsl:value-of select="$height"/> -->
3441
+ <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">
3442
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3443
+ <xsl:call-template name="svg_cross">
3444
+ <xsl:with-param name="width" select="$width"/>
3445
+ <xsl:with-param name="height" select="$height"/>
3446
+ </xsl:call-template>
3447
+ </svg>
3448
+ </xsl:otherwise>
3449
+ </xsl:choose>
3450
+
3451
+ </xsl:template><xsl:template name="svg_cross">
3452
+ <xsl:param name="width"/>
3453
+ <xsl:param name="height"/>
3454
+ <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; "/>
3455
+ <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; "/>
3208
3456
  </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">
3209
3457
  <xsl:apply-templates mode="contents"/>
3210
3458
  <xsl:text> </xsl:text>
@@ -3747,6 +3995,7 @@
3747
3995
  <xsl:variable name="element">
3748
3996
  block
3749
3997
 
3998
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3750
3999
  </xsl:variable>
3751
4000
  <xsl:choose>
3752
4001
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3754,7 +4003,7 @@
3754
4003
  <xsl:apply-templates/>
3755
4004
  </fo:inline>
3756
4005
  </xsl:when>
3757
- <xsl:when test="normalize-space($element) = 'block'">
4006
+ <xsl:when test="contains(normalize-space($element), 'block')">
3758
4007
  <fo:block xsl:use-attribute-sets="example-name-style">
3759
4008
  <xsl:apply-templates/>
3760
4009
  </fo:block>
@@ -3767,10 +4016,11 @@
3767
4016
  </xsl:choose>
3768
4017
 
3769
4018
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3770
-
4019
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3771
4020
  <xsl:variable name="element">
3772
4021
  block
3773
4022
 
4023
+
3774
4024
  </xsl:variable>
3775
4025
  <xsl:choose>
3776
4026
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3870,32 +4120,50 @@
3870
4120
  <xsl:text>— </xsl:text>
3871
4121
  <xsl:apply-templates/>
3872
4122
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3873
- <fo:inline xsl:use-attribute-sets="eref-style">
3874
- <xsl:if test="@type = 'footnote'">
3875
-
3876
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3877
- <xsl:attribute name="font-size">80%</xsl:attribute>
3878
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3879
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3880
-
3881
-
3882
- </xsl:if>
3883
-
3884
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3885
-
3886
- <xsl:if test="@type = 'inline'">
3887
-
3888
- <xsl:attribute name="color">blue</xsl:attribute>
3889
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3890
-
3891
-
3892
-
3893
- </xsl:if>
3894
-
3895
-
3896
- <xsl:apply-templates/>
3897
- </fo:basic-link>
3898
- </fo:inline>
4123
+
4124
+ <xsl:variable name="bibitemid">
4125
+ <xsl:choose>
4126
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4127
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4128
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4129
+ </xsl:choose>
4130
+ </xsl:variable>
4131
+
4132
+ <xsl:choose>
4133
+ <xsl:when test="normalize-space($bibitemid) != ''">
4134
+ <fo:inline xsl:use-attribute-sets="eref-style">
4135
+ <xsl:if test="@type = 'footnote'">
4136
+
4137
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4138
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4139
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4140
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4141
+
4142
+
4143
+ </xsl:if>
4144
+
4145
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4146
+ <xsl:if test="normalize-space(@citeas) = ''">
4147
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4148
+ </xsl:if>
4149
+ <xsl:if test="@type = 'inline'">
4150
+
4151
+ <xsl:attribute name="color">blue</xsl:attribute>
4152
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4153
+
4154
+
4155
+
4156
+ </xsl:if>
4157
+
4158
+ <xsl:apply-templates/>
4159
+ </fo:basic-link>
4160
+
4161
+ </fo:inline>
4162
+ </xsl:when>
4163
+ <xsl:otherwise>
4164
+ <fo:inline><xsl:apply-templates/></fo:inline>
4165
+ </xsl:otherwise>
4166
+ </xsl:choose>
3899
4167
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3900
4168
  <!-- zero-space char -->
3901
4169
  <xsl:variable name="depth">
@@ -3948,7 +4216,8 @@
3948
4216
  </fo:inline>
3949
4217
  </xsl:when>
3950
4218
  <xsl:otherwise>
3951
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4219
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4220
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
3952
4221
  </xsl:otherwise>
3953
4222
  </xsl:choose>
3954
4223
 
@@ -4068,6 +4337,153 @@
4068
4337
  </fo:block>
4069
4338
  </xsl:otherwise>
4070
4339
  </xsl:choose>
4340
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4341
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4342
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4343
+ </xsl:for-each>
4344
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4345
+ <xsl:copy>
4346
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4347
+ </xsl:copy>
4348
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4349
+ <xsl:variable name="id">
4350
+ <xsl:call-template name="generateIndexXrefId"/>
4351
+ </xsl:variable>
4352
+ <xsl:copy> <!-- add id to xref -->
4353
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4354
+ <xsl:attribute name="id">
4355
+ <xsl:value-of select="$id"/>
4356
+ </xsl:attribute>
4357
+ <xsl:apply-templates mode="index_add_id"/>
4358
+ </xsl:copy>
4359
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4360
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4361
+ <xsl:if test="@to">
4362
+ <xsl:value-of select="$dash"/>
4363
+ <xsl:copy>
4364
+ <xsl:copy-of select="@*"/>
4365
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4366
+ <xsl:attribute name="id">
4367
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4368
+ </xsl:attribute>
4369
+ <xsl:apply-templates mode="index_add_id"/>
4370
+ </xsl:copy>
4371
+ </xsl:if>
4372
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4373
+ <xsl:copy>
4374
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4375
+ </xsl:copy>
4376
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4377
+ <xsl:copy>
4378
+ <xsl:apply-templates select="@*" mode="index_update"/>
4379
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4380
+ </xsl:copy>
4381
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4382
+ <xsl:param name="element"/>
4383
+ <xsl:param name="remove" select="'false'"/>
4384
+ <xsl:param name="target"/>
4385
+ <!-- <node></node> -->
4386
+ <xsl:choose>
4387
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4388
+ <!-- skip text (i.e. remove it) and process next element -->
4389
+ <!-- [removed_<xsl:value-of select="."/>] -->
4390
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4391
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4392
+ </xsl:apply-templates>
4393
+ </xsl:when>
4394
+ <xsl:when test="self::text()">
4395
+ <xsl:value-of select="."/>
4396
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4397
+ </xsl:when>
4398
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4399
+ <xsl:variable name="id" select="@id"/>
4400
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4401
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4402
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4403
+
4404
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4405
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4406
+
4407
+ <xsl:choose>
4408
+ <!-- 2nd pass -->
4409
+ <!-- if page is equal to page for next and page is not the end of range -->
4410
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4411
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4412
+ <!-- [removed_xref] -->
4413
+
4414
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4415
+ <xsl:with-param name="remove">true</xsl:with-param>
4416
+ <xsl:with-param name="target">
4417
+ <xsl:choose>
4418
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4419
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4420
+ </xsl:choose>
4421
+ </xsl:with-param>
4422
+ </xsl:apply-templates>
4423
+ </xsl:when>
4424
+
4425
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4426
+ <!-- remove xref -->
4427
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4428
+ <xsl:with-param name="remove">true</xsl:with-param>
4429
+ </xsl:apply-templates>
4430
+ </xsl:when>
4431
+
4432
+ <xsl:otherwise>
4433
+ <xsl:apply-templates select="." mode="xref_copy">
4434
+ <xsl:with-param name="target" select="$target"/>
4435
+ </xsl:apply-templates>
4436
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4437
+ </xsl:otherwise>
4438
+ </xsl:choose>
4439
+ </xsl:when>
4440
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4441
+ <!-- ul -->
4442
+ <xsl:apply-templates select="." mode="index_update"/>
4443
+ </xsl:when>
4444
+ <xsl:otherwise>
4445
+ <xsl:apply-templates select="." mode="xref_copy">
4446
+ <xsl:with-param name="target" select="$target"/>
4447
+ </xsl:apply-templates>
4448
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4449
+ </xsl:otherwise>
4450
+ </xsl:choose>
4451
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4452
+ <xsl:param name="target"/>
4453
+ <xsl:copy>
4454
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4455
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4456
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4457
+ </xsl:if>
4458
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4459
+ </xsl:copy>
4460
+ </xsl:template><xsl:template name="generateIndexXrefId">
4461
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4462
+
4463
+ <xsl:variable name="docid">
4464
+ <xsl:call-template name="getDocumentId"/>
4465
+ </xsl:variable>
4466
+ <xsl:variable name="item_number">
4467
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4468
+ </xsl:variable>
4469
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4470
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4471
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4472
+ <xsl:apply-templates/>
4473
+ <fo:block>
4474
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4475
+ <fo:block> </fo:block>
4476
+ </xsl:if>
4477
+ </fo:block>
4478
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4479
+ <xsl:apply-templates/>
4480
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4481
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4482
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4483
+ <xsl:apply-templates/>
4484
+ </fo:block>
4485
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4486
+ <fo:inline id="{@id}" font-size="1pt"/>
4071
4487
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4072
4488
  <!-- <row>
4073
4489
  <date>05-07-2013</date>
@@ -4165,6 +4581,70 @@
4165
4581
  <xsl:value-of select="substring(.,1,1)"/>
4166
4582
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4167
4583
  <fo:inline><xsl:apply-templates/></fo:inline>
4584
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4585
+ <fo:block>
4586
+ <xsl:apply-templates/>
4587
+ </fo:block>
4588
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4589
+ <fo:inline><xsl:apply-templates/></fo:inline>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4591
+ <fo:inline>
4592
+ <xsl:call-template name="text_input"/>
4593
+ </fo:inline>
4594
+ </xsl:template><xsl:template name="text_input">
4595
+ <xsl:variable name="count">
4596
+ <xsl:choose>
4597
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4598
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4599
+ <xsl:otherwise>10</xsl:otherwise>
4600
+ </xsl:choose>
4601
+ </xsl:variable>
4602
+ <xsl:call-template name="repeat">
4603
+ <xsl:with-param name="char" select="'_'"/>
4604
+ <xsl:with-param name="count" select="$count"/>
4605
+ </xsl:call-template>
4606
+ <xsl:text> </xsl:text>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4608
+ <xsl:variable name="caption">
4609
+ <xsl:choose>
4610
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4611
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4612
+ </xsl:choose>
4613
+ </xsl:variable>
4614
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4615
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4616
+ <fo:inline padding-right="1mm">
4617
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4618
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4619
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4620
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4621
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4622
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4623
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4624
+ </svg>
4625
+ </fo:instream-foreign-object>
4626
+ </fo:inline>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4628
+ <fo:inline padding-right="1mm">
4629
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4630
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4631
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4632
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4633
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4634
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4635
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4636
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4637
+ </svg>
4638
+ </fo:instream-foreign-object>
4639
+ </fo:inline>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4641
+ <fo:inline>
4642
+ <xsl:call-template name="text_input"/>
4643
+ </fo:inline>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4645
+ <fo:block-container border="1pt solid black" width="50%">
4646
+ <fo:block> </fo:block>
4647
+ </fo:block-container>
4168
4648
  </xsl:template><xsl:template name="convertDate">
4169
4649
  <xsl:param name="date"/>
4170
4650
  <xsl:param name="format" select="'short'"/>
@@ -4284,63 +4764,61 @@
4284
4764
  <xsl:variable name="lang">
4285
4765
  <xsl:call-template name="getLang"/>
4286
4766
  </xsl:variable>
4287
- <fo:declarations>
4288
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4289
- <pdf:dictionary type="normal" key="ViewerPreferences">
4290
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4291
- </pdf:dictionary>
4292
- </pdf:catalog>
4293
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4294
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4295
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4296
- <!-- Dublin Core properties go here -->
4297
- <dc:title>
4298
- <xsl:variable name="title">
4299
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4300
-
4301
-
4302
-
4303
-
4304
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4305
-
4306
-
4307
-
4308
- </xsl:for-each>
4309
- </xsl:variable>
4310
- <xsl:choose>
4311
- <xsl:when test="normalize-space($title) != ''">
4312
- <xsl:value-of select="$title"/>
4313
- </xsl:when>
4314
- <xsl:otherwise>
4315
- <xsl:text> </xsl:text>
4316
- </xsl:otherwise>
4317
- </xsl:choose>
4318
- </dc:title>
4319
- <dc:creator>
4767
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4768
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4769
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4770
+ </pdf:dictionary>
4771
+ </pdf:catalog>
4772
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4773
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4774
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4775
+ <!-- Dublin Core properties go here -->
4776
+ <dc:title>
4777
+ <xsl:variable name="title">
4320
4778
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4321
4779
 
4322
4780
 
4323
4781
 
4324
- </xsl:for-each>
4325
- </dc:creator>
4326
- <dc:description>
4327
- <xsl:variable name="abstract">
4782
+
4783
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4328
4784
 
4329
4785
 
4330
- </xsl:variable>
4331
- <xsl:value-of select="normalize-space($abstract)"/>
4332
- </dc:description>
4333
- <pdf:Keywords>
4334
- <xsl:call-template name="insertKeywords"/>
4335
- </pdf:Keywords>
4336
- </rdf:Description>
4337
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4338
- <!-- XMP properties go here -->
4339
- <xmp:CreatorTool/>
4340
- </rdf:Description>
4341
- </rdf:RDF>
4342
- </x:xmpmeta>
4343
- </fo:declarations>
4786
+
4787
+ </xsl:for-each>
4788
+ </xsl:variable>
4789
+ <xsl:choose>
4790
+ <xsl:when test="normalize-space($title) != ''">
4791
+ <xsl:value-of select="$title"/>
4792
+ </xsl:when>
4793
+ <xsl:otherwise>
4794
+ <xsl:text> </xsl:text>
4795
+ </xsl:otherwise>
4796
+ </xsl:choose>
4797
+ </dc:title>
4798
+ <dc:creator>
4799
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4800
+
4801
+
4802
+
4803
+ </xsl:for-each>
4804
+ </dc:creator>
4805
+ <dc:description>
4806
+ <xsl:variable name="abstract">
4807
+
4808
+
4809
+ </xsl:variable>
4810
+ <xsl:value-of select="normalize-space($abstract)"/>
4811
+ </dc:description>
4812
+ <pdf:Keywords>
4813
+ <xsl:call-template name="insertKeywords"/>
4814
+ </pdf:Keywords>
4815
+ </rdf:Description>
4816
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4817
+ <!-- XMP properties go here -->
4818
+ <xmp:CreatorTool/>
4819
+ </rdf:Description>
4820
+ </rdf:RDF>
4821
+ </x:xmpmeta>
4344
4822
  </xsl:template><xsl:template name="getId">
4345
4823
  <xsl:choose>
4346
4824
  <xsl:when test="../@id">
@@ -4504,4 +4982,44 @@
4504
4982
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4505
4983
  </xsl:choose>
4506
4984
 
4985
+ </xsl:template><xsl:template name="setTrackChangesStyles">
4986
+ <xsl:param name="isAdded"/>
4987
+ <xsl:param name="isDeleted"/>
4988
+ <xsl:choose>
4989
+ <xsl:when test="local-name() = 'math'">
4990
+ <xsl:if test="$isAdded = 'true'">
4991
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4992
+ </xsl:if>
4993
+ <xsl:if test="$isDeleted = 'true'">
4994
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
4995
+ </xsl:if>
4996
+ </xsl:when>
4997
+ <xsl:otherwise>
4998
+ <xsl:if test="$isAdded = 'true'">
4999
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5000
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5001
+ </xsl:if>
5002
+ <xsl:if test="$isDeleted = 'true'">
5003
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5004
+ <xsl:if test="local-name() = 'table'">
5005
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5006
+ </xsl:if>
5007
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5008
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5009
+ </xsl:if>
5010
+ </xsl:otherwise>
5011
+ </xsl:choose>
5012
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5013
+ <xsl:if test="$lang = 'ar'">
5014
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5015
+ </xsl:if>
5016
+ </xsl:template><xsl:template name="setAlignment">
5017
+ <xsl:param name="align" select="normalize-space(@align)"/>
5018
+ <xsl:choose>
5019
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5020
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5021
+ <xsl:when test="$align != ''">
5022
+ <xsl:value-of select="$align"/>
5023
+ </xsl:when>
5024
+ </xsl:choose>
4507
5025
  </xsl:template></xsl:stylesheet>