metanorma-ogc 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1052,6 +1052,7 @@
1052
1052
  </xsl:choose>
1053
1053
  </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">
1054
1054
 
1055
+
1055
1056
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1056
1057
 
1057
1058
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1453,13 +1454,25 @@
1453
1454
  <xsl:attribute name="space-after">6pt</xsl:attribute>
1454
1455
 
1455
1456
 
1456
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1457
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1458
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1459
+ </xsl:variable><xsl:attribute-set name="add-style">
1457
1460
  <xsl:attribute name="color">red</xsl:attribute>
1458
1461
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1459
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1460
- <xsl:attribute name="color">red</xsl:attribute>
1462
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1463
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1464
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1465
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1466
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1467
+ <xsl:text>red</xsl:text>
1468
+ </xsl:variable><xsl:attribute-set name="del-style">
1469
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1461
1470
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1462
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1471
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1472
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1473
+
1474
+
1475
+ </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">
1463
1476
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1464
1477
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1465
1478
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1504,16 +1517,17 @@
1504
1517
  <xsl:call-template name="add-zero-spaces-java"/>
1505
1518
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1506
1519
 
1520
+ <xsl:variable name="table-preamble">
1521
+
1522
+
1523
+ </xsl:variable>
1524
+
1507
1525
  <xsl:variable name="table">
1508
1526
 
1509
1527
  <xsl:variable name="simple-table">
1510
1528
  <xsl:call-template name="getSimpleTable"/>
1511
1529
  </xsl:variable>
1512
1530
 
1513
-
1514
-
1515
-
1516
-
1517
1531
  <!-- <xsl:if test="$namespace = 'bipm'">
1518
1532
  <fo:block>&#xA0;</fo:block>
1519
1533
  </xsl:if> -->
@@ -1526,7 +1540,7 @@
1526
1540
 
1527
1541
 
1528
1542
 
1529
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1543
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1530
1544
 
1531
1545
  <!-- <xsl:variable name="cols-count">
1532
1546
  <xsl:choose>
@@ -1545,8 +1559,6 @@
1545
1559
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1546
1560
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1547
1561
 
1548
-
1549
-
1550
1562
  <xsl:variable name="colwidths">
1551
1563
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1552
1564
  <xsl:call-template name="calculate-column-widths">
@@ -1574,6 +1586,7 @@
1574
1586
  </xsl:choose>
1575
1587
  </xsl:variable>
1576
1588
 
1589
+
1577
1590
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1578
1591
 
1579
1592
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1617,6 +1630,7 @@
1617
1630
 
1618
1631
 
1619
1632
 
1633
+
1620
1634
  <attribute name="margin-left">0mm</attribute>
1621
1635
  <attribute name="margin-right">0mm</attribute>
1622
1636
 
@@ -1710,7 +1724,8 @@
1710
1724
  </fo:block-container>
1711
1725
  </xsl:variable>
1712
1726
 
1713
-
1727
+ <xsl:variable name="isAdded" select="@added"/>
1728
+ <xsl:variable name="isDeleted" select="@deleted"/>
1714
1729
 
1715
1730
  <xsl:choose>
1716
1731
  <xsl:when test="@width">
@@ -1719,12 +1734,42 @@
1719
1734
 
1720
1735
 
1721
1736
 
1722
- <xsl:copy-of select="$table"/>
1737
+ <xsl:choose>
1738
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1739
+ <xsl:copy-of select="$table-preamble"/>
1740
+ <fo:block>
1741
+ <xsl:call-template name="setTrackChangesStyles">
1742
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1743
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1744
+ </xsl:call-template>
1745
+ <xsl:copy-of select="$table"/>
1746
+ </fo:block>
1747
+ </xsl:when>
1748
+ <xsl:otherwise>
1749
+ <xsl:copy-of select="$table-preamble"/>
1750
+ <xsl:copy-of select="$table"/>
1751
+ </xsl:otherwise>
1752
+ </xsl:choose>
1723
1753
 
1724
1754
 
1725
1755
  </xsl:when>
1726
1756
  <xsl:otherwise>
1727
- <xsl:copy-of select="$table"/>
1757
+ <xsl:choose>
1758
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1759
+ <xsl:copy-of select="$table-preamble"/>
1760
+ <fo:block>
1761
+ <xsl:call-template name="setTrackChangesStyles">
1762
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1763
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1764
+ </xsl:call-template>
1765
+ <xsl:copy-of select="$table"/>
1766
+ </fo:block>
1767
+ </xsl:when>
1768
+ <xsl:otherwise>
1769
+ <xsl:copy-of select="$table-preamble"/>
1770
+ <xsl:copy-of select="$table"/>
1771
+ </xsl:otherwise>
1772
+ </xsl:choose>
1728
1773
  </xsl:otherwise>
1729
1774
  </xsl:choose>
1730
1775
 
@@ -1785,7 +1830,7 @@
1785
1830
  </xsl:for-each>
1786
1831
  </xsl:when>
1787
1832
  <xsl:otherwise>
1788
- <xsl:for-each select="xalan:nodeset($table)//tr">
1833
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1789
1834
  <xsl:variable name="td_text">
1790
1835
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1791
1836
 
@@ -2125,7 +2170,8 @@
2125
2170
  <xsl:attribute name="text-align">
2126
2171
  <xsl:choose>
2127
2172
  <xsl:when test="@align">
2128
- <xsl:value-of select="@align"/>
2173
+ <xsl:call-template name="setAlignment"/>
2174
+ <!-- <xsl:value-of select="@align"/> -->
2129
2175
  </xsl:when>
2130
2176
  <xsl:otherwise>center</xsl:otherwise>
2131
2177
  </xsl:choose>
@@ -2147,6 +2193,9 @@
2147
2193
 
2148
2194
 
2149
2195
 
2196
+ <xsl:if test="$lang = 'ar'">
2197
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2198
+ </xsl:if>
2150
2199
  <xsl:if test="@colspan">
2151
2200
  <xsl:attribute name="number-columns-spanned">
2152
2201
  <xsl:value-of select="@colspan"/>
@@ -2178,11 +2227,15 @@
2178
2227
  <xsl:attribute name="text-align">
2179
2228
  <xsl:choose>
2180
2229
  <xsl:when test="@align">
2181
- <xsl:value-of select="@align"/>
2230
+ <xsl:call-template name="setAlignment"/>
2231
+ <!-- <xsl:value-of select="@align"/> -->
2182
2232
  </xsl:when>
2183
2233
  <xsl:otherwise>left</xsl:otherwise>
2184
2234
  </xsl:choose>
2185
2235
  </xsl:attribute>
2236
+ <xsl:if test="$lang = 'ar'">
2237
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2238
+ </xsl:if>
2186
2239
 
2187
2240
 
2188
2241
 
@@ -2198,6 +2251,9 @@
2198
2251
 
2199
2252
 
2200
2253
 
2254
+ <xsl:if test=".//*[local-name() = 'table']">
2255
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2256
+ </xsl:if>
2201
2257
  <xsl:if test="@colspan">
2202
2258
  <xsl:attribute name="number-columns-spanned">
2203
2259
  <xsl:value-of select="@colspan"/>
@@ -2331,13 +2387,13 @@
2331
2387
  </xsl:choose>
2332
2388
  </xsl:variable>
2333
2389
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2334
- <xsl:element name="{$ns}:table">
2390
+ <!-- <xsl:element name="{$ns}:table"> -->
2335
2391
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2336
2392
  <tbody>
2337
2393
  <xsl:apply-templates mode="dl"/>
2338
2394
  </tbody>
2339
2395
  </xsl:for-each>
2340
- </xsl:element>
2396
+ <!-- </xsl:element> -->
2341
2397
  </xsl:variable>
2342
2398
 
2343
2399
  <xsl:call-template name="calculate-column-widths">
@@ -2438,6 +2494,8 @@
2438
2494
  <xsl:apply-templates/>
2439
2495
  </fo:inline>
2440
2496
  </xsl:template><xsl:template match="*[local-name()='dl']">
2497
+ <xsl:variable name="isAdded" select="@added"/>
2498
+ <xsl:variable name="isDeleted" select="@deleted"/>
2441
2499
  <fo:block-container>
2442
2500
 
2443
2501
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2454,6 +2512,12 @@
2454
2512
  </xsl:attribute>
2455
2513
 
2456
2514
  </xsl:if>
2515
+
2516
+ <xsl:call-template name="setTrackChangesStyles">
2517
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2518
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2519
+ </xsl:call-template>
2520
+
2457
2521
  <fo:block-container>
2458
2522
 
2459
2523
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2561,11 +2625,11 @@
2561
2625
  </xsl:choose>
2562
2626
  </xsl:variable>
2563
2627
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2564
- <xsl:element name="{$ns}:table">
2628
+ <!-- <xsl:element name="{$ns}:table"> -->
2565
2629
  <tbody>
2566
2630
  <xsl:apply-templates mode="dl"/>
2567
2631
  </tbody>
2568
- </xsl:element>
2632
+ <!-- </xsl:element> -->
2569
2633
  </xsl:variable>
2570
2634
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2571
2635
  <xsl:variable name="colwidths">
@@ -2836,9 +2900,71 @@
2836
2900
  <xsl:apply-templates/>
2837
2901
  </fo:inline>
2838
2902
  </xsl:template><xsl:template match="*[local-name()='add']">
2839
- <fo:inline xsl:use-attribute-sets="add-style">
2840
- <xsl:apply-templates/>
2841
- </fo:inline>
2903
+ <xsl:choose>
2904
+ <xsl:when test="@amendment">
2905
+ <fo:inline>
2906
+ <xsl:call-template name="insertTag">
2907
+ <xsl:with-param name="kind">A</xsl:with-param>
2908
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2909
+ </xsl:call-template>
2910
+ <xsl:apply-templates/>
2911
+ <xsl:call-template name="insertTag">
2912
+ <xsl:with-param name="type">closing</xsl:with-param>
2913
+ <xsl:with-param name="kind">A</xsl:with-param>
2914
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2915
+ </xsl:call-template>
2916
+ </fo:inline>
2917
+ </xsl:when>
2918
+ <xsl:when test="@corrigenda">
2919
+ <fo:inline>
2920
+ <xsl:call-template name="insertTag">
2921
+ <xsl:with-param name="kind">C</xsl:with-param>
2922
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2923
+ </xsl:call-template>
2924
+ <xsl:apply-templates/>
2925
+ <xsl:call-template name="insertTag">
2926
+ <xsl:with-param name="type">closing</xsl:with-param>
2927
+ <xsl:with-param name="kind">C</xsl:with-param>
2928
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2929
+ </xsl:call-template>
2930
+ </fo:inline>
2931
+ </xsl:when>
2932
+ <xsl:otherwise>
2933
+ <fo:inline xsl:use-attribute-sets="add-style">
2934
+ <xsl:apply-templates/>
2935
+ </fo:inline>
2936
+ </xsl:otherwise>
2937
+ </xsl:choose>
2938
+
2939
+ </xsl:template><xsl:template name="insertTag">
2940
+ <xsl:param name="type"/>
2941
+ <xsl:param name="kind"/>
2942
+ <xsl:param name="value"/>
2943
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2944
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2945
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2946
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2947
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2948
+ <xsl:attribute name="height">5mm</xsl:attribute>
2949
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2950
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2951
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2952
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2953
+ <g>
2954
+ <xsl:if test="$type = 'closing'">
2955
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2956
+ </xsl:if>
2957
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2958
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2959
+ </g>
2960
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2961
+ <xsl:if test="$type = 'closing'">
2962
+ <xsl:attribute name="x">25</xsl:attribute>
2963
+ </xsl:if>
2964
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2965
+ </text>
2966
+ </svg>
2967
+ </fo:instream-foreign-object>
2842
2968
  </xsl:template><xsl:template match="*[local-name()='del']">
2843
2969
  <fo:inline xsl:use-attribute-sets="del-style">
2844
2970
  <xsl:apply-templates/>
@@ -3181,13 +3307,23 @@
3181
3307
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3182
3308
  <xsl:value-of select="substring($str, 2)"/>
3183
3309
  </xsl:template><xsl:template match="mathml:math">
3184
- <fo:inline font-family="STIX Two Math"> <!-- -->
3310
+ <xsl:variable name="isAdded" select="@added"/>
3311
+ <xsl:variable name="isDeleted" select="@deleted"/>
3312
+
3313
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3314
+
3315
+
3316
+ <xsl:call-template name="setTrackChangesStyles">
3317
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3318
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3319
+ </xsl:call-template>
3185
3320
 
3186
3321
  <xsl:variable name="mathml">
3187
3322
  <xsl:apply-templates select="." mode="mathml"/>
3188
3323
  </xsl:variable>
3189
3324
  <fo:instream-foreign-object fox:alt-text="Math">
3190
3325
 
3326
+
3191
3327
  <!-- <xsl:copy-of select="."/> -->
3192
3328
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3193
3329
  </fo:instream-foreign-object>
@@ -3437,8 +3573,15 @@
3437
3573
  </fo:inline>
3438
3574
  </xsl:if>
3439
3575
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3576
+ <xsl:variable name="isAdded" select="@added"/>
3577
+ <xsl:variable name="isDeleted" select="@deleted"/>
3440
3578
  <fo:block-container id="{@id}">
3441
3579
 
3580
+ <xsl:call-template name="setTrackChangesStyles">
3581
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3582
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3583
+ </xsl:call-template>
3584
+
3442
3585
  <fo:block>
3443
3586
  <xsl:apply-templates/>
3444
3587
  </fo:block>
@@ -3458,6 +3601,8 @@
3458
3601
  <xsl:apply-templates/>
3459
3602
  </fo:block>
3460
3603
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3604
+ <xsl:variable name="isAdded" select="../@added"/>
3605
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3461
3606
  <xsl:choose>
3462
3607
  <xsl:when test="ancestor::*[local-name() = 'title']">
3463
3608
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3473,7 +3618,26 @@
3473
3618
  <xsl:variable name="src">
3474
3619
  <xsl:call-template name="image_src"/>
3475
3620
  </xsl:variable>
3476
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3621
+
3622
+ <xsl:choose>
3623
+ <xsl:when test="$isDeleted = 'true'">
3624
+ <!-- enclose in svg -->
3625
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3626
+ <xsl:attribute name="width">100%</xsl:attribute>
3627
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3628
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3629
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3630
+
3631
+
3632
+ <xsl:apply-templates select="." mode="cross_image"/>
3633
+
3634
+ </fo:instream-foreign-object>
3635
+ </xsl:when>
3636
+ <xsl:otherwise>
3637
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3638
+ </xsl:otherwise>
3639
+ </xsl:choose>
3640
+
3477
3641
  </fo:block>
3478
3642
  </xsl:otherwise>
3479
3643
  </xsl:choose>
@@ -3489,6 +3653,55 @@
3489
3653
  <xsl:value-of select="@src"/>
3490
3654
  </xsl:otherwise>
3491
3655
  </xsl:choose>
3656
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3657
+ <xsl:choose>
3658
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3659
+ <xsl:variable name="src">
3660
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3661
+ </xsl:variable>
3662
+ <xsl:variable name="width" select="document($src)/@width"/>
3663
+ <xsl:variable name="height" select="document($src)/@height"/>
3664
+ <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">
3665
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3666
+ </svg>
3667
+ </xsl:when>
3668
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3669
+ <xsl:variable name="src">
3670
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3671
+ </xsl:variable>
3672
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3673
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3674
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3675
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3676
+ <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">
3677
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3678
+ </svg>
3679
+ </xsl:when>
3680
+ <xsl:otherwise>
3681
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3682
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3683
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3684
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3685
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3686
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3687
+ <!-- width=<xsl:value-of select="$width"/> -->
3688
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3689
+ <!-- height=<xsl:value-of select="$height"/> -->
3690
+ <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">
3691
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3692
+ <xsl:call-template name="svg_cross">
3693
+ <xsl:with-param name="width" select="$width"/>
3694
+ <xsl:with-param name="height" select="$height"/>
3695
+ </xsl:call-template>
3696
+ </svg>
3697
+ </xsl:otherwise>
3698
+ </xsl:choose>
3699
+
3700
+ </xsl:template><xsl:template name="svg_cross">
3701
+ <xsl:param name="width"/>
3702
+ <xsl:param name="height"/>
3703
+ <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; "/>
3704
+ <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; "/>
3492
3705
  </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">
3493
3706
  <xsl:apply-templates mode="contents"/>
3494
3707
  <xsl:text> </xsl:text>
@@ -4050,6 +4263,7 @@
4050
4263
  <xsl:variable name="element">
4051
4264
  block
4052
4265
 
4266
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4053
4267
  </xsl:variable>
4054
4268
  <xsl:choose>
4055
4269
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4057,7 +4271,7 @@
4057
4271
  <xsl:apply-templates/>
4058
4272
  </fo:inline>
4059
4273
  </xsl:when>
4060
- <xsl:when test="normalize-space($element) = 'block'">
4274
+ <xsl:when test="contains(normalize-space($element), 'block')">
4061
4275
  <fo:block xsl:use-attribute-sets="example-name-style">
4062
4276
  <xsl:apply-templates/>
4063
4277
  </fo:block>
@@ -4283,7 +4497,8 @@
4283
4497
  </fo:inline>
4284
4498
  </xsl:when>
4285
4499
  <xsl:otherwise>
4286
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4500
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4501
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4287
4502
  </xsl:otherwise>
4288
4503
  </xsl:choose>
4289
4504
 
@@ -5136,4 +5351,44 @@
5136
5351
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5137
5352
  </xsl:choose>
5138
5353
 
5354
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5355
+ <xsl:param name="isAdded"/>
5356
+ <xsl:param name="isDeleted"/>
5357
+ <xsl:choose>
5358
+ <xsl:when test="local-name() = 'math'">
5359
+ <xsl:if test="$isAdded = 'true'">
5360
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5361
+ </xsl:if>
5362
+ <xsl:if test="$isDeleted = 'true'">
5363
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5364
+ </xsl:if>
5365
+ </xsl:when>
5366
+ <xsl:otherwise>
5367
+ <xsl:if test="$isAdded = 'true'">
5368
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5369
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5370
+ </xsl:if>
5371
+ <xsl:if test="$isDeleted = 'true'">
5372
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5373
+ <xsl:if test="local-name() = 'table'">
5374
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5375
+ </xsl:if>
5376
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5377
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5378
+ </xsl:if>
5379
+ </xsl:otherwise>
5380
+ </xsl:choose>
5381
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5382
+ <xsl:if test="$lang = 'ar'">
5383
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5384
+ </xsl:if>
5385
+ </xsl:template><xsl:template name="setAlignment">
5386
+ <xsl:param name="align" select="normalize-space(@align)"/>
5387
+ <xsl:choose>
5388
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5389
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5390
+ <xsl:when test="$align != ''">
5391
+ <xsl:value-of select="$align"/>
5392
+ </xsl:when>
5393
+ </xsl:choose>
5139
5394
  </xsl:template></xsl:stylesheet>