metanorma-mpfa 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c850bc3f9548054cb46adf8b4fd2dc76a6797c530768c04388b52c0f6cc4459
4
- data.tar.gz: 5dc6dcf8de8aa47770b2fcb416cfda5583ce6f85316ad3a0c49b14149f2833c9
3
+ metadata.gz: 7cf80fd86c575baa2b2be05c6ec24b19208cb22bdc65f0ae3cfa45d91e4b3377
4
+ data.tar.gz: d50a921655abc971e49a66252129cddc97ba2087361e26266070ed6436374142
5
5
  SHA512:
6
- metadata.gz: 162809da11dc05fcaac058497b274f75423334ebeb5f48053733466d20bb7fa6f90faaa230b8b707ebeff9092143048e5400e458bdfd378bd5ab40d23b246d5d
7
- data.tar.gz: 8ff45aa01b37df1020341f6eb7012636de639e926ebe31b2fcab3edebf2326a20c2aff2ced231688441ca86f9901df95d7721d65751fd669f1197b2b5874154a
6
+ metadata.gz: a5ca83830fe46a0805e1fd26fcd919ce0cc5d35a3528c884298e113437ebea74fa280bf825eaecff4f0030b2cb3661bff4a118d9db54316b8190ec0e129f00df
7
+ data.tar.gz: 6926cb26f467c51f33d5e27ae9e152aa6fc3ce54031674e86ebdc4c3f739c81ecda9ea7a277e55be6903c03e04aa3cb7acb9632b3093c0a5229e076b9c84708e
@@ -937,6 +937,7 @@
937
937
  </xsl:choose>
938
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">
939
939
 
940
+
940
941
  </xsl:attribute-set><xsl:attribute-set name="link-style">
941
942
 
942
943
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1241,13 +1242,25 @@
1241
1242
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1242
1243
 
1243
1244
 
1244
- </xsl:attribute-set><xsl:attribute-set name="add-style">
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">
1245
1248
  <xsl:attribute name="color">red</xsl:attribute>
1246
1249
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1247
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1248
- <xsl:attribute name="color">red</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>
1249
1258
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1250
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
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">
1251
1264
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1252
1265
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1253
1266
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1292,16 +1305,17 @@
1292
1305
  <xsl:call-template name="add-zero-spaces-java"/>
1293
1306
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1294
1307
 
1308
+ <xsl:variable name="table-preamble">
1309
+
1310
+
1311
+ </xsl:variable>
1312
+
1295
1313
  <xsl:variable name="table">
1296
1314
 
1297
1315
  <xsl:variable name="simple-table">
1298
1316
  <xsl:call-template name="getSimpleTable"/>
1299
1317
  </xsl:variable>
1300
1318
 
1301
-
1302
-
1303
-
1304
-
1305
1319
  <!-- <xsl:if test="$namespace = 'bipm'">
1306
1320
  <fo:block>&#xA0;</fo:block>
1307
1321
  </xsl:if> -->
@@ -1316,7 +1330,7 @@
1316
1330
 
1317
1331
 
1318
1332
 
1319
- <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)"/>
1320
1334
 
1321
1335
  <!-- <xsl:variable name="cols-count">
1322
1336
  <xsl:choose>
@@ -1335,8 +1349,6 @@
1335
1349
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1336
1350
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1337
1351
 
1338
-
1339
-
1340
1352
  <xsl:variable name="colwidths">
1341
1353
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1342
1354
  <xsl:call-template name="calculate-column-widths">
@@ -1364,6 +1376,7 @@
1364
1376
  </xsl:choose>
1365
1377
  </xsl:variable>
1366
1378
 
1379
+
1367
1380
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1368
1381
 
1369
1382
 
@@ -1399,6 +1412,7 @@
1399
1412
 
1400
1413
 
1401
1414
 
1415
+
1402
1416
 
1403
1417
 
1404
1418
 
@@ -1491,7 +1505,8 @@
1491
1505
  </fo:block-container>
1492
1506
  </xsl:variable>
1493
1507
 
1494
-
1508
+ <xsl:variable name="isAdded" select="@added"/>
1509
+ <xsl:variable name="isDeleted" select="@deleted"/>
1495
1510
 
1496
1511
  <xsl:choose>
1497
1512
  <xsl:when test="@width">
@@ -1505,7 +1520,14 @@
1505
1520
  <fo:table-body>
1506
1521
  <fo:table-row>
1507
1522
  <fo:table-cell column-number="2">
1508
- <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>
1509
1531
  </fo:table-cell>
1510
1532
  </fo:table-row>
1511
1533
  </fo:table-body>
@@ -1516,7 +1538,22 @@
1516
1538
 
1517
1539
  </xsl:when>
1518
1540
  <xsl:otherwise>
1519
- <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>
1520
1557
  </xsl:otherwise>
1521
1558
  </xsl:choose>
1522
1559
 
@@ -1577,7 +1614,7 @@
1577
1614
  </xsl:for-each>
1578
1615
  </xsl:when>
1579
1616
  <xsl:otherwise>
1580
- <xsl:for-each select="xalan:nodeset($table)//tr">
1617
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1581
1618
  <xsl:variable name="td_text">
1582
1619
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1583
1620
 
@@ -1917,7 +1954,8 @@
1917
1954
  <xsl:attribute name="text-align">
1918
1955
  <xsl:choose>
1919
1956
  <xsl:when test="@align">
1920
- <xsl:value-of select="@align"/>
1957
+ <xsl:call-template name="setAlignment"/>
1958
+ <!-- <xsl:value-of select="@align"/> -->
1921
1959
  </xsl:when>
1922
1960
  <xsl:otherwise>center</xsl:otherwise>
1923
1961
  </xsl:choose>
@@ -1936,6 +1974,9 @@
1936
1974
  <xsl:attribute name="border-bottom">solid black 2pt</xsl:attribute>
1937
1975
 
1938
1976
 
1977
+ <xsl:if test="$lang = 'ar'">
1978
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1979
+ </xsl:if>
1939
1980
  <xsl:if test="@colspan">
1940
1981
  <xsl:attribute name="number-columns-spanned">
1941
1982
  <xsl:value-of select="@colspan"/>
@@ -1967,11 +2008,15 @@
1967
2008
  <xsl:attribute name="text-align">
1968
2009
  <xsl:choose>
1969
2010
  <xsl:when test="@align">
1970
- <xsl:value-of select="@align"/>
2011
+ <xsl:call-template name="setAlignment"/>
2012
+ <!-- <xsl:value-of select="@align"/> -->
1971
2013
  </xsl:when>
1972
2014
  <xsl:otherwise>left</xsl:otherwise>
1973
2015
  </xsl:choose>
1974
2016
  </xsl:attribute>
2017
+ <xsl:if test="$lang = 'ar'">
2018
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2019
+ </xsl:if>
1975
2020
 
1976
2021
 
1977
2022
 
@@ -1983,6 +2028,9 @@
1983
2028
 
1984
2029
 
1985
2030
 
2031
+ <xsl:if test=".//*[local-name() = 'table']">
2032
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
+ </xsl:if>
1986
2034
  <xsl:if test="@colspan">
1987
2035
  <xsl:attribute name="number-columns-spanned">
1988
2036
  <xsl:value-of select="@colspan"/>
@@ -2108,13 +2156,13 @@
2108
2156
  </xsl:choose>
2109
2157
  </xsl:variable>
2110
2158
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2111
- <xsl:element name="{$ns}:table">
2159
+ <!-- <xsl:element name="{$ns}:table"> -->
2112
2160
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2113
2161
  <tbody>
2114
2162
  <xsl:apply-templates mode="dl"/>
2115
2163
  </tbody>
2116
2164
  </xsl:for-each>
2117
- </xsl:element>
2165
+ <!-- </xsl:element> -->
2118
2166
  </xsl:variable>
2119
2167
 
2120
2168
  <xsl:call-template name="calculate-column-widths">
@@ -2205,6 +2253,8 @@
2205
2253
  <xsl:apply-templates/>
2206
2254
  </fo:inline>
2207
2255
  </xsl:template><xsl:template match="*[local-name()='dl']">
2256
+ <xsl:variable name="isAdded" select="@added"/>
2257
+ <xsl:variable name="isDeleted" select="@deleted"/>
2208
2258
  <fo:block-container>
2209
2259
 
2210
2260
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2221,6 +2271,12 @@
2221
2271
  </xsl:attribute>
2222
2272
 
2223
2273
  </xsl:if>
2274
+
2275
+ <xsl:call-template name="setTrackChangesStyles">
2276
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2277
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2278
+ </xsl:call-template>
2279
+
2224
2280
  <fo:block-container>
2225
2281
 
2226
2282
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2328,11 +2384,11 @@
2328
2384
  </xsl:choose>
2329
2385
  </xsl:variable>
2330
2386
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2331
- <xsl:element name="{$ns}:table">
2387
+ <!-- <xsl:element name="{$ns}:table"> -->
2332
2388
  <tbody>
2333
2389
  <xsl:apply-templates mode="dl"/>
2334
2390
  </tbody>
2335
- </xsl:element>
2391
+ <!-- </xsl:element> -->
2336
2392
  </xsl:variable>
2337
2393
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2338
2394
  <xsl:variable name="colwidths">
@@ -2600,9 +2656,71 @@
2600
2656
  <xsl:apply-templates/>
2601
2657
  </fo:inline>
2602
2658
  </xsl:template><xsl:template match="*[local-name()='add']">
2603
- <fo:inline xsl:use-attribute-sets="add-style">
2604
- <xsl:apply-templates/>
2605
- </fo:inline>
2659
+ <xsl:choose>
2660
+ <xsl:when test="@amendment">
2661
+ <fo:inline>
2662
+ <xsl:call-template name="insertTag">
2663
+ <xsl:with-param name="kind">A</xsl:with-param>
2664
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2665
+ </xsl:call-template>
2666
+ <xsl:apply-templates/>
2667
+ <xsl:call-template name="insertTag">
2668
+ <xsl:with-param name="type">closing</xsl:with-param>
2669
+ <xsl:with-param name="kind">A</xsl:with-param>
2670
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2671
+ </xsl:call-template>
2672
+ </fo:inline>
2673
+ </xsl:when>
2674
+ <xsl:when test="@corrigenda">
2675
+ <fo:inline>
2676
+ <xsl:call-template name="insertTag">
2677
+ <xsl:with-param name="kind">C</xsl:with-param>
2678
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2679
+ </xsl:call-template>
2680
+ <xsl:apply-templates/>
2681
+ <xsl:call-template name="insertTag">
2682
+ <xsl:with-param name="type">closing</xsl:with-param>
2683
+ <xsl:with-param name="kind">C</xsl:with-param>
2684
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2685
+ </xsl:call-template>
2686
+ </fo:inline>
2687
+ </xsl:when>
2688
+ <xsl:otherwise>
2689
+ <fo:inline xsl:use-attribute-sets="add-style">
2690
+ <xsl:apply-templates/>
2691
+ </fo:inline>
2692
+ </xsl:otherwise>
2693
+ </xsl:choose>
2694
+
2695
+ </xsl:template><xsl:template name="insertTag">
2696
+ <xsl:param name="type"/>
2697
+ <xsl:param name="kind"/>
2698
+ <xsl:param name="value"/>
2699
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2700
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2701
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2702
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2703
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2704
+ <xsl:attribute name="height">5mm</xsl:attribute>
2705
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2706
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2707
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2708
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2709
+ <g>
2710
+ <xsl:if test="$type = 'closing'">
2711
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2712
+ </xsl:if>
2713
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2714
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2715
+ </g>
2716
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2717
+ <xsl:if test="$type = 'closing'">
2718
+ <xsl:attribute name="x">25</xsl:attribute>
2719
+ </xsl:if>
2720
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2721
+ </text>
2722
+ </svg>
2723
+ </fo:instream-foreign-object>
2606
2724
  </xsl:template><xsl:template match="*[local-name()='del']">
2607
2725
  <fo:inline xsl:use-attribute-sets="del-style">
2608
2726
  <xsl:apply-templates/>
@@ -2945,13 +3063,23 @@
2945
3063
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2946
3064
  <xsl:value-of select="substring($str, 2)"/>
2947
3065
  </xsl:template><xsl:template match="mathml:math">
2948
- <fo:inline font-family="STIX Two Math"> <!-- -->
3066
+ <xsl:variable name="isAdded" select="@added"/>
3067
+ <xsl:variable name="isDeleted" select="@deleted"/>
3068
+
3069
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3070
+
3071
+
3072
+ <xsl:call-template name="setTrackChangesStyles">
3073
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3074
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3075
+ </xsl:call-template>
2949
3076
 
2950
3077
  <xsl:variable name="mathml">
2951
3078
  <xsl:apply-templates select="." mode="mathml"/>
2952
3079
  </xsl:variable>
2953
3080
  <fo:instream-foreign-object fox:alt-text="Math">
2954
3081
 
3082
+
2955
3083
  <!-- <xsl:copy-of select="."/> -->
2956
3084
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2957
3085
  </fo:instream-foreign-object>
@@ -3195,8 +3323,15 @@
3195
3323
  </fo:inline>
3196
3324
  </xsl:if>
3197
3325
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3326
+ <xsl:variable name="isAdded" select="@added"/>
3327
+ <xsl:variable name="isDeleted" select="@deleted"/>
3198
3328
  <fo:block-container id="{@id}">
3199
3329
 
3330
+ <xsl:call-template name="setTrackChangesStyles">
3331
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3332
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3333
+ </xsl:call-template>
3334
+
3200
3335
  <fo:block>
3201
3336
  <xsl:apply-templates/>
3202
3337
  </fo:block>
@@ -3216,6 +3351,8 @@
3216
3351
  <xsl:apply-templates/>
3217
3352
  </fo:block>
3218
3353
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3354
+ <xsl:variable name="isAdded" select="../@added"/>
3355
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3219
3356
  <xsl:choose>
3220
3357
  <xsl:when test="ancestor::*[local-name() = 'title']">
3221
3358
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3231,7 +3368,26 @@
3231
3368
  <xsl:variable name="src">
3232
3369
  <xsl:call-template name="image_src"/>
3233
3370
  </xsl:variable>
3234
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3371
+
3372
+ <xsl:choose>
3373
+ <xsl:when test="$isDeleted = 'true'">
3374
+ <!-- enclose in svg -->
3375
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3376
+ <xsl:attribute name="width">100%</xsl:attribute>
3377
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3378
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3379
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3380
+
3381
+
3382
+ <xsl:apply-templates select="." mode="cross_image"/>
3383
+
3384
+ </fo:instream-foreign-object>
3385
+ </xsl:when>
3386
+ <xsl:otherwise>
3387
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3388
+ </xsl:otherwise>
3389
+ </xsl:choose>
3390
+
3235
3391
  </fo:block>
3236
3392
  </xsl:otherwise>
3237
3393
  </xsl:choose>
@@ -3247,6 +3403,55 @@
3247
3403
  <xsl:value-of select="@src"/>
3248
3404
  </xsl:otherwise>
3249
3405
  </xsl:choose>
3406
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3407
+ <xsl:choose>
3408
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3409
+ <xsl:variable name="src">
3410
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3411
+ </xsl:variable>
3412
+ <xsl:variable name="width" select="document($src)/@width"/>
3413
+ <xsl:variable name="height" select="document($src)/@height"/>
3414
+ <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">
3415
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3416
+ </svg>
3417
+ </xsl:when>
3418
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3419
+ <xsl:variable name="src">
3420
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3421
+ </xsl:variable>
3422
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3423
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3424
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3425
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3426
+ <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">
3427
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3428
+ </svg>
3429
+ </xsl:when>
3430
+ <xsl:otherwise>
3431
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3432
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3433
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3434
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3435
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3436
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3437
+ <!-- width=<xsl:value-of select="$width"/> -->
3438
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3439
+ <!-- height=<xsl:value-of select="$height"/> -->
3440
+ <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">
3441
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3442
+ <xsl:call-template name="svg_cross">
3443
+ <xsl:with-param name="width" select="$width"/>
3444
+ <xsl:with-param name="height" select="$height"/>
3445
+ </xsl:call-template>
3446
+ </svg>
3447
+ </xsl:otherwise>
3448
+ </xsl:choose>
3449
+
3450
+ </xsl:template><xsl:template name="svg_cross">
3451
+ <xsl:param name="width"/>
3452
+ <xsl:param name="height"/>
3453
+ <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; "/>
3454
+ <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; "/>
3250
3455
  </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">
3251
3456
  <xsl:apply-templates mode="contents"/>
3252
3457
  <xsl:text> </xsl:text>
@@ -3789,6 +3994,7 @@
3789
3994
  <xsl:variable name="element">
3790
3995
  block
3791
3996
 
3997
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3792
3998
  </xsl:variable>
3793
3999
  <xsl:choose>
3794
4000
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3796,7 +4002,7 @@
3796
4002
  <xsl:apply-templates/>
3797
4003
  </fo:inline>
3798
4004
  </xsl:when>
3799
- <xsl:when test="normalize-space($element) = 'block'">
4005
+ <xsl:when test="contains(normalize-space($element), 'block')">
3800
4006
  <fo:block xsl:use-attribute-sets="example-name-style">
3801
4007
  <xsl:apply-templates/>
3802
4008
  </fo:block>
@@ -4009,7 +4215,8 @@
4009
4215
  </fo:inline>
4010
4216
  </xsl:when>
4011
4217
  <xsl:otherwise>
4012
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4218
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4219
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4013
4220
  </xsl:otherwise>
4014
4221
  </xsl:choose>
4015
4222
 
@@ -4710,4 +4917,44 @@
4710
4917
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4711
4918
  </xsl:choose>
4712
4919
 
4920
+ </xsl:template><xsl:template name="setTrackChangesStyles">
4921
+ <xsl:param name="isAdded"/>
4922
+ <xsl:param name="isDeleted"/>
4923
+ <xsl:choose>
4924
+ <xsl:when test="local-name() = 'math'">
4925
+ <xsl:if test="$isAdded = 'true'">
4926
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4927
+ </xsl:if>
4928
+ <xsl:if test="$isDeleted = 'true'">
4929
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
4930
+ </xsl:if>
4931
+ </xsl:when>
4932
+ <xsl:otherwise>
4933
+ <xsl:if test="$isAdded = 'true'">
4934
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
4935
+ <xsl:attribute name="padding">2mm</xsl:attribute>
4936
+ </xsl:if>
4937
+ <xsl:if test="$isDeleted = 'true'">
4938
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
4939
+ <xsl:if test="local-name() = 'table'">
4940
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
4941
+ </xsl:if>
4942
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
4943
+ <xsl:attribute name="padding">2mm</xsl:attribute>
4944
+ </xsl:if>
4945
+ </xsl:otherwise>
4946
+ </xsl:choose>
4947
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
4948
+ <xsl:if test="$lang = 'ar'">
4949
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
4950
+ </xsl:if>
4951
+ </xsl:template><xsl:template name="setAlignment">
4952
+ <xsl:param name="align" select="normalize-space(@align)"/>
4953
+ <xsl:choose>
4954
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
4955
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
4956
+ <xsl:when test="$align != ''">
4957
+ <xsl:value-of select="$align"/>
4958
+ </xsl:when>
4959
+ </xsl:choose>
4713
4960
  </xsl:template></xsl:stylesheet>