metanorma-un 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1210,6 +1210,7 @@
1210
1210
  </xsl:choose>
1211
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">
1212
1212
 
1213
+
1213
1214
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1214
1215
 
1215
1216
 
@@ -1520,13 +1521,25 @@
1520
1521
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1521
1522
 
1522
1523
 
1523
- </xsl:attribute-set><xsl:attribute-set name="add-style">
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">
1524
1527
  <xsl:attribute name="color">red</xsl:attribute>
1525
1528
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1526
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1527
- <xsl:attribute name="color">red</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>
1528
1537
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1529
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
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">
1530
1543
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1531
1544
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1532
1545
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1571,16 +1584,17 @@
1571
1584
  <xsl:call-template name="add-zero-spaces-java"/>
1572
1585
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1573
1586
 
1587
+ <xsl:variable name="table-preamble">
1588
+
1589
+
1590
+ </xsl:variable>
1591
+
1574
1592
  <xsl:variable name="table">
1575
1593
 
1576
1594
  <xsl:variable name="simple-table">
1577
1595
  <xsl:call-template name="getSimpleTable"/>
1578
1596
  </xsl:variable>
1579
1597
 
1580
-
1581
-
1582
-
1583
-
1584
1598
  <!-- <xsl:if test="$namespace = 'bipm'">
1585
1599
  <fo:block>&#xA0;</fo:block>
1586
1600
  </xsl:if> -->
@@ -1595,7 +1609,7 @@
1595
1609
 
1596
1610
 
1597
1611
 
1598
- <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)"/>
1599
1613
 
1600
1614
  <!-- <xsl:variable name="cols-count">
1601
1615
  <xsl:choose>
@@ -1614,8 +1628,6 @@
1614
1628
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1615
1629
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1616
1630
 
1617
-
1618
-
1619
1631
  <xsl:variable name="colwidths">
1620
1632
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1621
1633
  <xsl:call-template name="calculate-column-widths">
@@ -1643,6 +1655,7 @@
1643
1655
  </xsl:choose>
1644
1656
  </xsl:variable>
1645
1657
 
1658
+
1646
1659
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1647
1660
 
1648
1661
 
@@ -1684,6 +1697,7 @@
1684
1697
 
1685
1698
 
1686
1699
 
1700
+
1687
1701
 
1688
1702
 
1689
1703
  <xsl:if test="ancestor::*[local-name()='sections']">
@@ -1778,7 +1792,8 @@
1778
1792
  </fo:block-container>
1779
1793
  </xsl:variable>
1780
1794
 
1781
-
1795
+ <xsl:variable name="isAdded" select="@added"/>
1796
+ <xsl:variable name="isDeleted" select="@deleted"/>
1782
1797
 
1783
1798
  <xsl:choose>
1784
1799
  <xsl:when test="@width">
@@ -1787,12 +1802,42 @@
1787
1802
 
1788
1803
 
1789
1804
 
1790
- <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>
1791
1821
 
1792
1822
 
1793
1823
  </xsl:when>
1794
1824
  <xsl:otherwise>
1795
- <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>
1796
1841
  </xsl:otherwise>
1797
1842
  </xsl:choose>
1798
1843
 
@@ -1853,7 +1898,7 @@
1853
1898
  </xsl:for-each>
1854
1899
  </xsl:when>
1855
1900
  <xsl:otherwise>
1856
- <xsl:for-each select="xalan:nodeset($table)//tr">
1901
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1857
1902
  <xsl:variable name="td_text">
1858
1903
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1859
1904
 
@@ -2193,7 +2238,8 @@
2193
2238
  <xsl:attribute name="text-align">
2194
2239
  <xsl:choose>
2195
2240
  <xsl:when test="@align">
2196
- <xsl:value-of select="@align"/>
2241
+ <xsl:call-template name="setAlignment"/>
2242
+ <!-- <xsl:value-of select="@align"/> -->
2197
2243
  </xsl:when>
2198
2244
  <xsl:otherwise>center</xsl:otherwise>
2199
2245
  </xsl:choose>
@@ -2225,6 +2271,9 @@
2225
2271
 
2226
2272
 
2227
2273
 
2274
+ <xsl:if test="$lang = 'ar'">
2275
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2276
+ </xsl:if>
2228
2277
  <xsl:if test="@colspan">
2229
2278
  <xsl:attribute name="number-columns-spanned">
2230
2279
  <xsl:value-of select="@colspan"/>
@@ -2256,11 +2305,15 @@
2256
2305
  <xsl:attribute name="text-align">
2257
2306
  <xsl:choose>
2258
2307
  <xsl:when test="@align">
2259
- <xsl:value-of select="@align"/>
2308
+ <xsl:call-template name="setAlignment"/>
2309
+ <!-- <xsl:value-of select="@align"/> -->
2260
2310
  </xsl:when>
2261
2311
  <xsl:otherwise>left</xsl:otherwise>
2262
2312
  </xsl:choose>
2263
2313
  </xsl:attribute>
2314
+ <xsl:if test="$lang = 'ar'">
2315
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2316
+ </xsl:if>
2264
2317
 
2265
2318
 
2266
2319
 
@@ -2278,6 +2331,9 @@
2278
2331
 
2279
2332
 
2280
2333
 
2334
+ <xsl:if test=".//*[local-name() = 'table']">
2335
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2336
+ </xsl:if>
2281
2337
  <xsl:if test="@colspan">
2282
2338
  <xsl:attribute name="number-columns-spanned">
2283
2339
  <xsl:value-of select="@colspan"/>
@@ -2415,13 +2471,13 @@
2415
2471
  </xsl:choose>
2416
2472
  </xsl:variable>
2417
2473
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2418
- <xsl:element name="{$ns}:table">
2474
+ <!-- <xsl:element name="{$ns}:table"> -->
2419
2475
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2420
2476
  <tbody>
2421
2477
  <xsl:apply-templates mode="dl"/>
2422
2478
  </tbody>
2423
2479
  </xsl:for-each>
2424
- </xsl:element>
2480
+ <!-- </xsl:element> -->
2425
2481
  </xsl:variable>
2426
2482
 
2427
2483
  <xsl:call-template name="calculate-column-widths">
@@ -2512,6 +2568,8 @@
2512
2568
  <xsl:apply-templates/>
2513
2569
  </fo:inline>
2514
2570
  </xsl:template><xsl:template match="*[local-name()='dl']">
2571
+ <xsl:variable name="isAdded" select="@added"/>
2572
+ <xsl:variable name="isDeleted" select="@deleted"/>
2515
2573
  <fo:block-container>
2516
2574
 
2517
2575
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2528,6 +2586,12 @@
2528
2586
  </xsl:attribute>
2529
2587
 
2530
2588
  </xsl:if>
2589
+
2590
+ <xsl:call-template name="setTrackChangesStyles">
2591
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2592
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2593
+ </xsl:call-template>
2594
+
2531
2595
  <fo:block-container>
2532
2596
 
2533
2597
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2635,11 +2699,11 @@
2635
2699
  </xsl:choose>
2636
2700
  </xsl:variable>
2637
2701
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2638
- <xsl:element name="{$ns}:table">
2702
+ <!-- <xsl:element name="{$ns}:table"> -->
2639
2703
  <tbody>
2640
2704
  <xsl:apply-templates mode="dl"/>
2641
2705
  </tbody>
2642
- </xsl:element>
2706
+ <!-- </xsl:element> -->
2643
2707
  </xsl:variable>
2644
2708
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2645
2709
  <xsl:variable name="colwidths">
@@ -2907,9 +2971,71 @@
2907
2971
  <xsl:apply-templates/>
2908
2972
  </fo:inline>
2909
2973
  </xsl:template><xsl:template match="*[local-name()='add']">
2910
- <fo:inline xsl:use-attribute-sets="add-style">
2911
- <xsl:apply-templates/>
2912
- </fo:inline>
2974
+ <xsl:choose>
2975
+ <xsl:when test="@amendment">
2976
+ <fo:inline>
2977
+ <xsl:call-template name="insertTag">
2978
+ <xsl:with-param name="kind">A</xsl:with-param>
2979
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2980
+ </xsl:call-template>
2981
+ <xsl:apply-templates/>
2982
+ <xsl:call-template name="insertTag">
2983
+ <xsl:with-param name="type">closing</xsl:with-param>
2984
+ <xsl:with-param name="kind">A</xsl:with-param>
2985
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2986
+ </xsl:call-template>
2987
+ </fo:inline>
2988
+ </xsl:when>
2989
+ <xsl:when test="@corrigenda">
2990
+ <fo:inline>
2991
+ <xsl:call-template name="insertTag">
2992
+ <xsl:with-param name="kind">C</xsl:with-param>
2993
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2994
+ </xsl:call-template>
2995
+ <xsl:apply-templates/>
2996
+ <xsl:call-template name="insertTag">
2997
+ <xsl:with-param name="type">closing</xsl:with-param>
2998
+ <xsl:with-param name="kind">C</xsl:with-param>
2999
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3000
+ </xsl:call-template>
3001
+ </fo:inline>
3002
+ </xsl:when>
3003
+ <xsl:otherwise>
3004
+ <fo:inline xsl:use-attribute-sets="add-style">
3005
+ <xsl:apply-templates/>
3006
+ </fo:inline>
3007
+ </xsl:otherwise>
3008
+ </xsl:choose>
3009
+
3010
+ </xsl:template><xsl:template name="insertTag">
3011
+ <xsl:param name="type"/>
3012
+ <xsl:param name="kind"/>
3013
+ <xsl:param name="value"/>
3014
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3015
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3016
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3017
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3018
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3019
+ <xsl:attribute name="height">5mm</xsl:attribute>
3020
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3021
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3022
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3023
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3024
+ <g>
3025
+ <xsl:if test="$type = 'closing'">
3026
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3027
+ </xsl:if>
3028
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3029
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3030
+ </g>
3031
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3032
+ <xsl:if test="$type = 'closing'">
3033
+ <xsl:attribute name="x">25</xsl:attribute>
3034
+ </xsl:if>
3035
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3036
+ </text>
3037
+ </svg>
3038
+ </fo:instream-foreign-object>
2913
3039
  </xsl:template><xsl:template match="*[local-name()='del']">
2914
3040
  <fo:inline xsl:use-attribute-sets="del-style">
2915
3041
  <xsl:apply-templates/>
@@ -3252,13 +3378,23 @@
3252
3378
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3253
3379
  <xsl:value-of select="substring($str, 2)"/>
3254
3380
  </xsl:template><xsl:template match="mathml:math">
3255
- <fo:inline font-family="STIX Two Math"> <!-- -->
3381
+ <xsl:variable name="isAdded" select="@added"/>
3382
+ <xsl:variable name="isDeleted" select="@deleted"/>
3383
+
3384
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3385
+
3386
+
3387
+ <xsl:call-template name="setTrackChangesStyles">
3388
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3389
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3390
+ </xsl:call-template>
3256
3391
 
3257
3392
  <xsl:variable name="mathml">
3258
3393
  <xsl:apply-templates select="." mode="mathml"/>
3259
3394
  </xsl:variable>
3260
3395
  <fo:instream-foreign-object fox:alt-text="Math">
3261
3396
 
3397
+
3262
3398
  <!-- <xsl:copy-of select="."/> -->
3263
3399
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3264
3400
  </fo:instream-foreign-object>
@@ -3519,8 +3655,15 @@
3519
3655
  </fo:inline>
3520
3656
  </xsl:if>
3521
3657
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3658
+ <xsl:variable name="isAdded" select="@added"/>
3659
+ <xsl:variable name="isDeleted" select="@deleted"/>
3522
3660
  <fo:block-container id="{@id}">
3523
3661
 
3662
+ <xsl:call-template name="setTrackChangesStyles">
3663
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3664
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3665
+ </xsl:call-template>
3666
+
3524
3667
  <fo:block>
3525
3668
  <xsl:apply-templates/>
3526
3669
  </fo:block>
@@ -3540,6 +3683,8 @@
3540
3683
  <xsl:apply-templates/>
3541
3684
  </fo:block>
3542
3685
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3686
+ <xsl:variable name="isAdded" select="../@added"/>
3687
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3543
3688
  <xsl:choose>
3544
3689
  <xsl:when test="ancestor::*[local-name() = 'title']">
3545
3690
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3560,7 +3705,26 @@
3560
3705
  <xsl:variable name="src">
3561
3706
  <xsl:call-template name="image_src"/>
3562
3707
  </xsl:variable>
3563
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3708
+
3709
+ <xsl:choose>
3710
+ <xsl:when test="$isDeleted = 'true'">
3711
+ <!-- enclose in svg -->
3712
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3713
+ <xsl:attribute name="width">100%</xsl:attribute>
3714
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3715
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3716
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3717
+
3718
+
3719
+ <xsl:apply-templates select="." mode="cross_image"/>
3720
+
3721
+ </fo:instream-foreign-object>
3722
+ </xsl:when>
3723
+ <xsl:otherwise>
3724
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3725
+ </xsl:otherwise>
3726
+ </xsl:choose>
3727
+
3564
3728
  </fo:block>
3565
3729
  </xsl:otherwise>
3566
3730
  </xsl:choose>
@@ -3576,6 +3740,55 @@
3576
3740
  <xsl:value-of select="@src"/>
3577
3741
  </xsl:otherwise>
3578
3742
  </xsl:choose>
3743
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3744
+ <xsl:choose>
3745
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3746
+ <xsl:variable name="src">
3747
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3748
+ </xsl:variable>
3749
+ <xsl:variable name="width" select="document($src)/@width"/>
3750
+ <xsl:variable name="height" select="document($src)/@height"/>
3751
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3752
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3753
+ </svg>
3754
+ </xsl:when>
3755
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3756
+ <xsl:variable name="src">
3757
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3758
+ </xsl:variable>
3759
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3760
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3761
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3762
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3763
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3764
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3765
+ </svg>
3766
+ </xsl:when>
3767
+ <xsl:otherwise>
3768
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3769
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3770
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3771
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3772
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3773
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3774
+ <!-- width=<xsl:value-of select="$width"/> -->
3775
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3776
+ <!-- height=<xsl:value-of select="$height"/> -->
3777
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3778
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3779
+ <xsl:call-template name="svg_cross">
3780
+ <xsl:with-param name="width" select="$width"/>
3781
+ <xsl:with-param name="height" select="$height"/>
3782
+ </xsl:call-template>
3783
+ </svg>
3784
+ </xsl:otherwise>
3785
+ </xsl:choose>
3786
+
3787
+ </xsl:template><xsl:template name="svg_cross">
3788
+ <xsl:param name="width"/>
3789
+ <xsl:param name="height"/>
3790
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3791
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3579
3792
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3580
3793
  <xsl:apply-templates mode="contents"/>
3581
3794
  <xsl:text> </xsl:text>
@@ -4118,6 +4331,7 @@
4118
4331
  <xsl:variable name="element">
4119
4332
  block
4120
4333
 
4334
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4121
4335
  </xsl:variable>
4122
4336
  <xsl:choose>
4123
4337
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4125,7 +4339,7 @@
4125
4339
  <xsl:apply-templates/>
4126
4340
  </fo:inline>
4127
4341
  </xsl:when>
4128
- <xsl:when test="normalize-space($element) = 'block'">
4342
+ <xsl:when test="contains(normalize-space($element), 'block')">
4129
4343
  <fo:block xsl:use-attribute-sets="example-name-style">
4130
4344
  <xsl:apply-templates/>
4131
4345
  </fo:block>
@@ -4336,7 +4550,8 @@
4336
4550
  </fo:inline>
4337
4551
  </xsl:when>
4338
4552
  <xsl:otherwise>
4339
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4553
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4554
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4340
4555
  </xsl:otherwise>
4341
4556
  </xsl:choose>
4342
4557
 
@@ -5056,4 +5271,44 @@
5056
5271
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5057
5272
  </xsl:choose>
5058
5273
 
5274
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5275
+ <xsl:param name="isAdded"/>
5276
+ <xsl:param name="isDeleted"/>
5277
+ <xsl:choose>
5278
+ <xsl:when test="local-name() = 'math'">
5279
+ <xsl:if test="$isAdded = 'true'">
5280
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5281
+ </xsl:if>
5282
+ <xsl:if test="$isDeleted = 'true'">
5283
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5284
+ </xsl:if>
5285
+ </xsl:when>
5286
+ <xsl:otherwise>
5287
+ <xsl:if test="$isAdded = 'true'">
5288
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5289
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5290
+ </xsl:if>
5291
+ <xsl:if test="$isDeleted = 'true'">
5292
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5293
+ <xsl:if test="local-name() = 'table'">
5294
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5295
+ </xsl:if>
5296
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5297
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5298
+ </xsl:if>
5299
+ </xsl:otherwise>
5300
+ </xsl:choose>
5301
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5302
+ <xsl:if test="$lang = 'ar'">
5303
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5304
+ </xsl:if>
5305
+ </xsl:template><xsl:template name="setAlignment">
5306
+ <xsl:param name="align" select="normalize-space(@align)"/>
5307
+ <xsl:choose>
5308
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5309
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5310
+ <xsl:when test="$align != ''">
5311
+ <xsl:value-of select="$align"/>
5312
+ </xsl:when>
5313
+ </xsl:choose>
5059
5314
  </xsl:template></xsl:stylesheet>