metanorma-un 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1351,6 +1351,7 @@
1351
1351
  </xsl:choose>
1352
1352
  </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">
1353
1353
 
1354
+
1354
1355
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1355
1356
 
1356
1357
 
@@ -1660,13 +1661,25 @@
1660
1661
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1661
1662
 
1662
1663
 
1663
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1664
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1665
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1666
+ </xsl:variable><xsl:attribute-set name="add-style">
1664
1667
  <xsl:attribute name="color">red</xsl:attribute>
1665
1668
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1666
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1667
- <xsl:attribute name="color">red</xsl:attribute>
1669
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1670
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1671
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1672
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1673
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1674
+ <xsl:text>red</xsl:text>
1675
+ </xsl:variable><xsl:attribute-set name="del-style">
1676
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1668
1677
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1669
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1678
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1679
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1680
+
1681
+
1682
+ </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">
1670
1683
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1671
1684
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1672
1685
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1711,16 +1724,17 @@
1711
1724
  <xsl:call-template name="add-zero-spaces-java"/>
1712
1725
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1713
1726
 
1727
+ <xsl:variable name="table-preamble">
1728
+
1729
+
1730
+ </xsl:variable>
1731
+
1714
1732
  <xsl:variable name="table">
1715
1733
 
1716
1734
  <xsl:variable name="simple-table">
1717
1735
  <xsl:call-template name="getSimpleTable"/>
1718
1736
  </xsl:variable>
1719
1737
 
1720
-
1721
-
1722
-
1723
-
1724
1738
  <!-- <xsl:if test="$namespace = 'bipm'">
1725
1739
  <fo:block>&#xA0;</fo:block>
1726
1740
  </xsl:if> -->
@@ -1735,7 +1749,7 @@
1735
1749
 
1736
1750
 
1737
1751
 
1738
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1752
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1739
1753
 
1740
1754
  <!-- <xsl:variable name="cols-count">
1741
1755
  <xsl:choose>
@@ -1754,8 +1768,6 @@
1754
1768
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1755
1769
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1756
1770
 
1757
-
1758
-
1759
1771
  <xsl:variable name="colwidths">
1760
1772
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1761
1773
  <xsl:call-template name="calculate-column-widths">
@@ -1783,6 +1795,7 @@
1783
1795
  </xsl:choose>
1784
1796
  </xsl:variable>
1785
1797
 
1798
+
1786
1799
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1787
1800
 
1788
1801
 
@@ -1822,6 +1835,7 @@
1822
1835
 
1823
1836
 
1824
1837
 
1838
+
1825
1839
 
1826
1840
 
1827
1841
 
@@ -1913,7 +1927,8 @@
1913
1927
  </fo:block-container>
1914
1928
  </xsl:variable>
1915
1929
 
1916
-
1930
+ <xsl:variable name="isAdded" select="@added"/>
1931
+ <xsl:variable name="isDeleted" select="@deleted"/>
1917
1932
 
1918
1933
  <xsl:choose>
1919
1934
  <xsl:when test="@width">
@@ -1922,12 +1937,42 @@
1922
1937
 
1923
1938
 
1924
1939
 
1925
- <xsl:copy-of select="$table"/>
1940
+ <xsl:choose>
1941
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1942
+ <xsl:copy-of select="$table-preamble"/>
1943
+ <fo:block>
1944
+ <xsl:call-template name="setTrackChangesStyles">
1945
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1946
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1947
+ </xsl:call-template>
1948
+ <xsl:copy-of select="$table"/>
1949
+ </fo:block>
1950
+ </xsl:when>
1951
+ <xsl:otherwise>
1952
+ <xsl:copy-of select="$table-preamble"/>
1953
+ <xsl:copy-of select="$table"/>
1954
+ </xsl:otherwise>
1955
+ </xsl:choose>
1926
1956
 
1927
1957
 
1928
1958
  </xsl:when>
1929
1959
  <xsl:otherwise>
1930
- <xsl:copy-of select="$table"/>
1960
+ <xsl:choose>
1961
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1962
+ <xsl:copy-of select="$table-preamble"/>
1963
+ <fo:block>
1964
+ <xsl:call-template name="setTrackChangesStyles">
1965
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1966
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1967
+ </xsl:call-template>
1968
+ <xsl:copy-of select="$table"/>
1969
+ </fo:block>
1970
+ </xsl:when>
1971
+ <xsl:otherwise>
1972
+ <xsl:copy-of select="$table-preamble"/>
1973
+ <xsl:copy-of select="$table"/>
1974
+ </xsl:otherwise>
1975
+ </xsl:choose>
1931
1976
  </xsl:otherwise>
1932
1977
  </xsl:choose>
1933
1978
 
@@ -1988,7 +2033,7 @@
1988
2033
  </xsl:for-each>
1989
2034
  </xsl:when>
1990
2035
  <xsl:otherwise>
1991
- <xsl:for-each select="xalan:nodeset($table)//tr">
2036
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1992
2037
  <xsl:variable name="td_text">
1993
2038
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1994
2039
 
@@ -2332,7 +2377,8 @@
2332
2377
  <xsl:attribute name="text-align">
2333
2378
  <xsl:choose>
2334
2379
  <xsl:when test="@align">
2335
- <xsl:value-of select="@align"/>
2380
+ <xsl:call-template name="setAlignment"/>
2381
+ <!-- <xsl:value-of select="@align"/> -->
2336
2382
  </xsl:when>
2337
2383
  <xsl:otherwise>center</xsl:otherwise>
2338
2384
  </xsl:choose>
@@ -2358,6 +2404,9 @@
2358
2404
 
2359
2405
 
2360
2406
 
2407
+ <xsl:if test="$lang = 'ar'">
2408
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2409
+ </xsl:if>
2361
2410
  <xsl:if test="@colspan">
2362
2411
  <xsl:attribute name="number-columns-spanned">
2363
2412
  <xsl:value-of select="@colspan"/>
@@ -2389,11 +2438,15 @@
2389
2438
  <xsl:attribute name="text-align">
2390
2439
  <xsl:choose>
2391
2440
  <xsl:when test="@align">
2392
- <xsl:value-of select="@align"/>
2441
+ <xsl:call-template name="setAlignment"/>
2442
+ <!-- <xsl:value-of select="@align"/> -->
2393
2443
  </xsl:when>
2394
2444
  <xsl:otherwise>left</xsl:otherwise>
2395
2445
  </xsl:choose>
2396
2446
  </xsl:attribute>
2447
+ <xsl:if test="$lang = 'ar'">
2448
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2449
+ </xsl:if>
2397
2450
 
2398
2451
 
2399
2452
 
@@ -2413,6 +2466,9 @@
2413
2466
 
2414
2467
 
2415
2468
 
2469
+ <xsl:if test=".//*[local-name() = 'table']">
2470
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2471
+ </xsl:if>
2416
2472
  <xsl:if test="@colspan">
2417
2473
  <xsl:attribute name="number-columns-spanned">
2418
2474
  <xsl:value-of select="@colspan"/>
@@ -2550,13 +2606,13 @@
2550
2606
  </xsl:choose>
2551
2607
  </xsl:variable>
2552
2608
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2553
- <xsl:element name="{$ns}:table">
2609
+ <!-- <xsl:element name="{$ns}:table"> -->
2554
2610
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2555
2611
  <tbody>
2556
2612
  <xsl:apply-templates mode="dl"/>
2557
2613
  </tbody>
2558
2614
  </xsl:for-each>
2559
- </xsl:element>
2615
+ <!-- </xsl:element> -->
2560
2616
  </xsl:variable>
2561
2617
 
2562
2618
  <xsl:call-template name="calculate-column-widths">
@@ -2647,6 +2703,8 @@
2647
2703
  <xsl:apply-templates/>
2648
2704
  </fo:inline>
2649
2705
  </xsl:template><xsl:template match="*[local-name()='dl']">
2706
+ <xsl:variable name="isAdded" select="@added"/>
2707
+ <xsl:variable name="isDeleted" select="@deleted"/>
2650
2708
  <fo:block-container>
2651
2709
 
2652
2710
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2663,6 +2721,12 @@
2663
2721
  </xsl:attribute>
2664
2722
 
2665
2723
  </xsl:if>
2724
+
2725
+ <xsl:call-template name="setTrackChangesStyles">
2726
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2727
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2728
+ </xsl:call-template>
2729
+
2666
2730
  <fo:block-container>
2667
2731
 
2668
2732
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2770,11 +2834,11 @@
2770
2834
  </xsl:choose>
2771
2835
  </xsl:variable>
2772
2836
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2773
- <xsl:element name="{$ns}:table">
2837
+ <!-- <xsl:element name="{$ns}:table"> -->
2774
2838
  <tbody>
2775
2839
  <xsl:apply-templates mode="dl"/>
2776
2840
  </tbody>
2777
- </xsl:element>
2841
+ <!-- </xsl:element> -->
2778
2842
  </xsl:variable>
2779
2843
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2780
2844
  <xsl:variable name="colwidths">
@@ -3042,9 +3106,71 @@
3042
3106
  <xsl:apply-templates/>
3043
3107
  </fo:inline>
3044
3108
  </xsl:template><xsl:template match="*[local-name()='add']">
3045
- <fo:inline xsl:use-attribute-sets="add-style">
3046
- <xsl:apply-templates/>
3047
- </fo:inline>
3109
+ <xsl:choose>
3110
+ <xsl:when test="@amendment">
3111
+ <fo:inline>
3112
+ <xsl:call-template name="insertTag">
3113
+ <xsl:with-param name="kind">A</xsl:with-param>
3114
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3115
+ </xsl:call-template>
3116
+ <xsl:apply-templates/>
3117
+ <xsl:call-template name="insertTag">
3118
+ <xsl:with-param name="type">closing</xsl:with-param>
3119
+ <xsl:with-param name="kind">A</xsl:with-param>
3120
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3121
+ </xsl:call-template>
3122
+ </fo:inline>
3123
+ </xsl:when>
3124
+ <xsl:when test="@corrigenda">
3125
+ <fo:inline>
3126
+ <xsl:call-template name="insertTag">
3127
+ <xsl:with-param name="kind">C</xsl:with-param>
3128
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3129
+ </xsl:call-template>
3130
+ <xsl:apply-templates/>
3131
+ <xsl:call-template name="insertTag">
3132
+ <xsl:with-param name="type">closing</xsl:with-param>
3133
+ <xsl:with-param name="kind">C</xsl:with-param>
3134
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3135
+ </xsl:call-template>
3136
+ </fo:inline>
3137
+ </xsl:when>
3138
+ <xsl:otherwise>
3139
+ <fo:inline xsl:use-attribute-sets="add-style">
3140
+ <xsl:apply-templates/>
3141
+ </fo:inline>
3142
+ </xsl:otherwise>
3143
+ </xsl:choose>
3144
+
3145
+ </xsl:template><xsl:template name="insertTag">
3146
+ <xsl:param name="type"/>
3147
+ <xsl:param name="kind"/>
3148
+ <xsl:param name="value"/>
3149
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3150
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3151
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3152
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3153
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3154
+ <xsl:attribute name="height">5mm</xsl:attribute>
3155
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3156
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3157
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3158
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3159
+ <g>
3160
+ <xsl:if test="$type = 'closing'">
3161
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3162
+ </xsl:if>
3163
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3164
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3165
+ </g>
3166
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3167
+ <xsl:if test="$type = 'closing'">
3168
+ <xsl:attribute name="x">25</xsl:attribute>
3169
+ </xsl:if>
3170
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3171
+ </text>
3172
+ </svg>
3173
+ </fo:instream-foreign-object>
3048
3174
  </xsl:template><xsl:template match="*[local-name()='del']">
3049
3175
  <fo:inline xsl:use-attribute-sets="del-style">
3050
3176
  <xsl:apply-templates/>
@@ -3387,13 +3513,23 @@
3387
3513
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3388
3514
  <xsl:value-of select="substring($str, 2)"/>
3389
3515
  </xsl:template><xsl:template match="mathml:math">
3390
- <fo:inline font-family="STIX Two Math"> <!-- -->
3516
+ <xsl:variable name="isAdded" select="@added"/>
3517
+ <xsl:variable name="isDeleted" select="@deleted"/>
3518
+
3519
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3520
+
3521
+
3522
+ <xsl:call-template name="setTrackChangesStyles">
3523
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3524
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3525
+ </xsl:call-template>
3391
3526
 
3392
3527
  <xsl:variable name="mathml">
3393
3528
  <xsl:apply-templates select="." mode="mathml"/>
3394
3529
  </xsl:variable>
3395
3530
  <fo:instream-foreign-object fox:alt-text="Math">
3396
3531
 
3532
+
3397
3533
  <!-- <xsl:copy-of select="."/> -->
3398
3534
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3399
3535
  </fo:instream-foreign-object>
@@ -3650,8 +3786,15 @@
3650
3786
  </fo:inline>
3651
3787
  </xsl:if>
3652
3788
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3789
+ <xsl:variable name="isAdded" select="@added"/>
3790
+ <xsl:variable name="isDeleted" select="@deleted"/>
3653
3791
  <fo:block-container id="{@id}">
3654
3792
 
3793
+ <xsl:call-template name="setTrackChangesStyles">
3794
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3795
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3796
+ </xsl:call-template>
3797
+
3655
3798
  <fo:block>
3656
3799
  <xsl:apply-templates/>
3657
3800
  </fo:block>
@@ -3671,6 +3814,8 @@
3671
3814
  <xsl:apply-templates/>
3672
3815
  </fo:block>
3673
3816
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3817
+ <xsl:variable name="isAdded" select="../@added"/>
3818
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3674
3819
  <xsl:choose>
3675
3820
  <xsl:when test="ancestor::*[local-name() = 'title']">
3676
3821
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3686,7 +3831,26 @@
3686
3831
  <xsl:variable name="src">
3687
3832
  <xsl:call-template name="image_src"/>
3688
3833
  </xsl:variable>
3689
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3834
+
3835
+ <xsl:choose>
3836
+ <xsl:when test="$isDeleted = 'true'">
3837
+ <!-- enclose in svg -->
3838
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3839
+ <xsl:attribute name="width">100%</xsl:attribute>
3840
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3841
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3842
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3843
+
3844
+
3845
+ <xsl:apply-templates select="." mode="cross_image"/>
3846
+
3847
+ </fo:instream-foreign-object>
3848
+ </xsl:when>
3849
+ <xsl:otherwise>
3850
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3851
+ </xsl:otherwise>
3852
+ </xsl:choose>
3853
+
3690
3854
  </fo:block>
3691
3855
  </xsl:otherwise>
3692
3856
  </xsl:choose>
@@ -3702,6 +3866,55 @@
3702
3866
  <xsl:value-of select="@src"/>
3703
3867
  </xsl:otherwise>
3704
3868
  </xsl:choose>
3869
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3870
+ <xsl:choose>
3871
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3872
+ <xsl:variable name="src">
3873
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3874
+ </xsl:variable>
3875
+ <xsl:variable name="width" select="document($src)/@width"/>
3876
+ <xsl:variable name="height" select="document($src)/@height"/>
3877
+ <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">
3878
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3879
+ </svg>
3880
+ </xsl:when>
3881
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3882
+ <xsl:variable name="src">
3883
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3884
+ </xsl:variable>
3885
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3886
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3887
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3888
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3889
+ <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">
3890
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3891
+ </svg>
3892
+ </xsl:when>
3893
+ <xsl:otherwise>
3894
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3895
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3896
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3897
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3898
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3899
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3900
+ <!-- width=<xsl:value-of select="$width"/> -->
3901
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3902
+ <!-- height=<xsl:value-of select="$height"/> -->
3903
+ <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">
3904
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3905
+ <xsl:call-template name="svg_cross">
3906
+ <xsl:with-param name="width" select="$width"/>
3907
+ <xsl:with-param name="height" select="$height"/>
3908
+ </xsl:call-template>
3909
+ </svg>
3910
+ </xsl:otherwise>
3911
+ </xsl:choose>
3912
+
3913
+ </xsl:template><xsl:template name="svg_cross">
3914
+ <xsl:param name="width"/>
3915
+ <xsl:param name="height"/>
3916
+ <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; "/>
3917
+ <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; "/>
3705
3918
  </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">
3706
3919
  <xsl:apply-templates mode="contents"/>
3707
3920
  <xsl:text> </xsl:text>
@@ -4244,6 +4457,7 @@
4244
4457
  <xsl:variable name="element">
4245
4458
  block
4246
4459
 
4460
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4247
4461
  </xsl:variable>
4248
4462
  <xsl:choose>
4249
4463
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4251,7 +4465,7 @@
4251
4465
  <xsl:apply-templates/>
4252
4466
  </fo:inline>
4253
4467
  </xsl:when>
4254
- <xsl:when test="normalize-space($element) = 'block'">
4468
+ <xsl:when test="contains(normalize-space($element), 'block')">
4255
4469
  <fo:block xsl:use-attribute-sets="example-name-style">
4256
4470
  <xsl:apply-templates/>
4257
4471
  </fo:block>
@@ -4464,7 +4678,8 @@
4464
4678
  </fo:inline>
4465
4679
  </xsl:when>
4466
4680
  <xsl:otherwise>
4467
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4681
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4682
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4468
4683
  </xsl:otherwise>
4469
4684
  </xsl:choose>
4470
4685
 
@@ -5182,4 +5397,44 @@
5182
5397
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5183
5398
  </xsl:choose>
5184
5399
 
5400
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5401
+ <xsl:param name="isAdded"/>
5402
+ <xsl:param name="isDeleted"/>
5403
+ <xsl:choose>
5404
+ <xsl:when test="local-name() = 'math'">
5405
+ <xsl:if test="$isAdded = 'true'">
5406
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5407
+ </xsl:if>
5408
+ <xsl:if test="$isDeleted = 'true'">
5409
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5410
+ </xsl:if>
5411
+ </xsl:when>
5412
+ <xsl:otherwise>
5413
+ <xsl:if test="$isAdded = 'true'">
5414
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5415
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5416
+ </xsl:if>
5417
+ <xsl:if test="$isDeleted = 'true'">
5418
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5419
+ <xsl:if test="local-name() = 'table'">
5420
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5421
+ </xsl:if>
5422
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5423
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5424
+ </xsl:if>
5425
+ </xsl:otherwise>
5426
+ </xsl:choose>
5427
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5428
+ <xsl:if test="$lang = 'ar'">
5429
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5430
+ </xsl:if>
5431
+ </xsl:template><xsl:template name="setAlignment">
5432
+ <xsl:param name="align" select="normalize-space(@align)"/>
5433
+ <xsl:choose>
5434
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5435
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5436
+ <xsl:when test="$align != ''">
5437
+ <xsl:value-of select="$align"/>
5438
+ </xsl:when>
5439
+ </xsl:choose>
5185
5440
  </xsl:template></xsl:stylesheet>