metanorma-m3aawg 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc7991b7bd553af372574f9a78596cf638ef4a4919290be6bf0f98c2fa7155e6
4
- data.tar.gz: 2d289669a14fa8cb6c94375a4df3f887d69e90d4617ce50a8af8e474810aad0c
3
+ metadata.gz: 8713634a17c1e5da0b53d534fa82875c8cb83480880e35b41ed8073ac1bde2bd
4
+ data.tar.gz: 6ae993cb255898d47eb6a452e04d8fae76c1340479041f85b1bbc54d5cc184de
5
5
  SHA512:
6
- metadata.gz: dc480555dc1b1450c352deb9f1da12078a8fd5c69252fe52f786e6421fb434cc32dc7aa9b249855dc0741a58722b1f552b79f9411fc811d35ce5e144b0995b66
7
- data.tar.gz: 10b194a23da33487a692537c15cb2dbfeaac1cc89cf31ce9320f29c95e3ea991242ddfe5bc186606fcb1c448d8773141a94ea98100927a617276f7ee351b1f47
6
+ metadata.gz: 7731ee969ce546b73ed07e7b7c463c14d9f48c5ddd04c2da15111db53b7871f0176bde79424027e7c1c19e249207ea9e04a15cd108a0e6dfc2cf5a544ed8e8ca
7
+ data.tar.gz: 1bf752b19b4937dedd9eff68d4f30df8921da484c0e9fbdc7cb7bb14c0fb2a9bed8b9223d47a577704c708e8315641d2ad11f863149e1b390a4ccf2cfc047cf9
@@ -1046,6 +1046,7 @@
1046
1046
  </xsl:choose>
1047
1047
  </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">
1048
1048
 
1049
+
1049
1050
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1050
1051
 
1051
1052
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1374,13 +1375,25 @@
1374
1375
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1375
1376
 
1376
1377
 
1377
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1378
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1379
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1380
+ </xsl:variable><xsl:attribute-set name="add-style">
1378
1381
  <xsl:attribute name="color">red</xsl:attribute>
1379
1382
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1380
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1381
- <xsl:attribute name="color">red</xsl:attribute>
1383
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1384
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1385
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1386
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1387
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1388
+ <xsl:text>red</xsl:text>
1389
+ </xsl:variable><xsl:attribute-set name="del-style">
1390
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1382
1391
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1383
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1392
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1393
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1394
+
1395
+
1396
+ </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">
1384
1397
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1385
1398
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1386
1399
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1429,16 +1442,17 @@
1429
1442
  <xsl:call-template name="add-zero-spaces-java"/>
1430
1443
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1431
1444
 
1445
+ <xsl:variable name="table-preamble">
1446
+
1447
+
1448
+ </xsl:variable>
1449
+
1432
1450
  <xsl:variable name="table">
1433
1451
 
1434
1452
  <xsl:variable name="simple-table">
1435
1453
  <xsl:call-template name="getSimpleTable"/>
1436
1454
  </xsl:variable>
1437
1455
 
1438
-
1439
-
1440
-
1441
-
1442
1456
  <!-- <xsl:if test="$namespace = 'bipm'">
1443
1457
  <fo:block>&#xA0;</fo:block>
1444
1458
  </xsl:if> -->
@@ -1453,7 +1467,7 @@
1453
1467
 
1454
1468
 
1455
1469
 
1456
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1470
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1457
1471
 
1458
1472
  <!-- <xsl:variable name="cols-count">
1459
1473
  <xsl:choose>
@@ -1472,8 +1486,6 @@
1472
1486
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1473
1487
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1474
1488
 
1475
-
1476
-
1477
1489
  <xsl:variable name="colwidths">
1478
1490
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1479
1491
  <xsl:call-template name="calculate-column-widths">
@@ -1501,6 +1513,7 @@
1501
1513
  </xsl:choose>
1502
1514
  </xsl:variable>
1503
1515
 
1516
+
1504
1517
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1505
1518
 
1506
1519
 
@@ -1532,6 +1545,7 @@
1532
1545
 
1533
1546
 
1534
1547
 
1548
+
1535
1549
 
1536
1550
 
1537
1551
 
@@ -1621,7 +1635,8 @@
1621
1635
  </fo:block-container>
1622
1636
  </xsl:variable>
1623
1637
 
1624
-
1638
+ <xsl:variable name="isAdded" select="@added"/>
1639
+ <xsl:variable name="isDeleted" select="@deleted"/>
1625
1640
 
1626
1641
  <xsl:choose>
1627
1642
  <xsl:when test="@width">
@@ -1635,7 +1650,14 @@
1635
1650
  <fo:table-body>
1636
1651
  <fo:table-row>
1637
1652
  <fo:table-cell column-number="2">
1638
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1653
+ <xsl:copy-of select="$table-preamble"/>
1654
+ <fo:block>
1655
+ <xsl:call-template name="setTrackChangesStyles">
1656
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1657
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1658
+ </xsl:call-template>
1659
+ <xsl:copy-of select="$table"/>
1660
+ </fo:block>
1639
1661
  </fo:table-cell>
1640
1662
  </fo:table-row>
1641
1663
  </fo:table-body>
@@ -1646,7 +1668,22 @@
1646
1668
 
1647
1669
  </xsl:when>
1648
1670
  <xsl:otherwise>
1649
- <xsl:copy-of select="$table"/>
1671
+ <xsl:choose>
1672
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1673
+ <xsl:copy-of select="$table-preamble"/>
1674
+ <fo:block>
1675
+ <xsl:call-template name="setTrackChangesStyles">
1676
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1677
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1678
+ </xsl:call-template>
1679
+ <xsl:copy-of select="$table"/>
1680
+ </fo:block>
1681
+ </xsl:when>
1682
+ <xsl:otherwise>
1683
+ <xsl:copy-of select="$table-preamble"/>
1684
+ <xsl:copy-of select="$table"/>
1685
+ </xsl:otherwise>
1686
+ </xsl:choose>
1650
1687
  </xsl:otherwise>
1651
1688
  </xsl:choose>
1652
1689
 
@@ -1707,7 +1744,7 @@
1707
1744
  </xsl:for-each>
1708
1745
  </xsl:when>
1709
1746
  <xsl:otherwise>
1710
- <xsl:for-each select="xalan:nodeset($table)//tr">
1747
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1711
1748
  <xsl:variable name="td_text">
1712
1749
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1713
1750
 
@@ -2047,7 +2084,8 @@
2047
2084
  <xsl:attribute name="text-align">
2048
2085
  <xsl:choose>
2049
2086
  <xsl:when test="@align">
2050
- <xsl:value-of select="@align"/>
2087
+ <xsl:call-template name="setAlignment"/>
2088
+ <!-- <xsl:value-of select="@align"/> -->
2051
2089
  </xsl:when>
2052
2090
  <xsl:otherwise>center</xsl:otherwise>
2053
2091
  </xsl:choose>
@@ -2063,6 +2101,9 @@
2063
2101
 
2064
2102
 
2065
2103
 
2104
+ <xsl:if test="$lang = 'ar'">
2105
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2106
+ </xsl:if>
2066
2107
  <xsl:if test="@colspan">
2067
2108
  <xsl:attribute name="number-columns-spanned">
2068
2109
  <xsl:value-of select="@colspan"/>
@@ -2094,11 +2135,15 @@
2094
2135
  <xsl:attribute name="text-align">
2095
2136
  <xsl:choose>
2096
2137
  <xsl:when test="@align">
2097
- <xsl:value-of select="@align"/>
2138
+ <xsl:call-template name="setAlignment"/>
2139
+ <!-- <xsl:value-of select="@align"/> -->
2098
2140
  </xsl:when>
2099
2141
  <xsl:otherwise>left</xsl:otherwise>
2100
2142
  </xsl:choose>
2101
2143
  </xsl:attribute>
2144
+ <xsl:if test="$lang = 'ar'">
2145
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2146
+ </xsl:if>
2102
2147
 
2103
2148
 
2104
2149
 
@@ -2110,6 +2155,9 @@
2110
2155
 
2111
2156
 
2112
2157
 
2158
+ <xsl:if test=".//*[local-name() = 'table']">
2159
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2160
+ </xsl:if>
2113
2161
  <xsl:if test="@colspan">
2114
2162
  <xsl:attribute name="number-columns-spanned">
2115
2163
  <xsl:value-of select="@colspan"/>
@@ -2237,13 +2285,13 @@
2237
2285
  </xsl:choose>
2238
2286
  </xsl:variable>
2239
2287
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2240
- <xsl:element name="{$ns}:table">
2288
+ <!-- <xsl:element name="{$ns}:table"> -->
2241
2289
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2242
2290
  <tbody>
2243
2291
  <xsl:apply-templates mode="dl"/>
2244
2292
  </tbody>
2245
2293
  </xsl:for-each>
2246
- </xsl:element>
2294
+ <!-- </xsl:element> -->
2247
2295
  </xsl:variable>
2248
2296
 
2249
2297
  <xsl:call-template name="calculate-column-widths">
@@ -2334,6 +2382,8 @@
2334
2382
  <xsl:apply-templates/>
2335
2383
  </fo:inline>
2336
2384
  </xsl:template><xsl:template match="*[local-name()='dl']">
2385
+ <xsl:variable name="isAdded" select="@added"/>
2386
+ <xsl:variable name="isDeleted" select="@deleted"/>
2337
2387
  <fo:block-container>
2338
2388
 
2339
2389
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2350,6 +2400,12 @@
2350
2400
  </xsl:attribute>
2351
2401
 
2352
2402
  </xsl:if>
2403
+
2404
+ <xsl:call-template name="setTrackChangesStyles">
2405
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2406
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2407
+ </xsl:call-template>
2408
+
2353
2409
  <fo:block-container>
2354
2410
 
2355
2411
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2457,11 +2513,11 @@
2457
2513
  </xsl:choose>
2458
2514
  </xsl:variable>
2459
2515
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2460
- <xsl:element name="{$ns}:table">
2516
+ <!-- <xsl:element name="{$ns}:table"> -->
2461
2517
  <tbody>
2462
2518
  <xsl:apply-templates mode="dl"/>
2463
2519
  </tbody>
2464
- </xsl:element>
2520
+ <!-- </xsl:element> -->
2465
2521
  </xsl:variable>
2466
2522
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2467
2523
  <xsl:variable name="colwidths">
@@ -2734,9 +2790,71 @@
2734
2790
  <xsl:apply-templates/>
2735
2791
  </fo:inline>
2736
2792
  </xsl:template><xsl:template match="*[local-name()='add']">
2737
- <fo:inline xsl:use-attribute-sets="add-style">
2738
- <xsl:apply-templates/>
2739
- </fo:inline>
2793
+ <xsl:choose>
2794
+ <xsl:when test="@amendment">
2795
+ <fo:inline>
2796
+ <xsl:call-template name="insertTag">
2797
+ <xsl:with-param name="kind">A</xsl:with-param>
2798
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2799
+ </xsl:call-template>
2800
+ <xsl:apply-templates/>
2801
+ <xsl:call-template name="insertTag">
2802
+ <xsl:with-param name="type">closing</xsl:with-param>
2803
+ <xsl:with-param name="kind">A</xsl:with-param>
2804
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2805
+ </xsl:call-template>
2806
+ </fo:inline>
2807
+ </xsl:when>
2808
+ <xsl:when test="@corrigenda">
2809
+ <fo:inline>
2810
+ <xsl:call-template name="insertTag">
2811
+ <xsl:with-param name="kind">C</xsl:with-param>
2812
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2813
+ </xsl:call-template>
2814
+ <xsl:apply-templates/>
2815
+ <xsl:call-template name="insertTag">
2816
+ <xsl:with-param name="type">closing</xsl:with-param>
2817
+ <xsl:with-param name="kind">C</xsl:with-param>
2818
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2819
+ </xsl:call-template>
2820
+ </fo:inline>
2821
+ </xsl:when>
2822
+ <xsl:otherwise>
2823
+ <fo:inline xsl:use-attribute-sets="add-style">
2824
+ <xsl:apply-templates/>
2825
+ </fo:inline>
2826
+ </xsl:otherwise>
2827
+ </xsl:choose>
2828
+
2829
+ </xsl:template><xsl:template name="insertTag">
2830
+ <xsl:param name="type"/>
2831
+ <xsl:param name="kind"/>
2832
+ <xsl:param name="value"/>
2833
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2834
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2835
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2836
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2837
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2838
+ <xsl:attribute name="height">5mm</xsl:attribute>
2839
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2840
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2841
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2842
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2843
+ <g>
2844
+ <xsl:if test="$type = 'closing'">
2845
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2846
+ </xsl:if>
2847
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2848
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2849
+ </g>
2850
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2851
+ <xsl:if test="$type = 'closing'">
2852
+ <xsl:attribute name="x">25</xsl:attribute>
2853
+ </xsl:if>
2854
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2855
+ </text>
2856
+ </svg>
2857
+ </fo:instream-foreign-object>
2740
2858
  </xsl:template><xsl:template match="*[local-name()='del']">
2741
2859
  <fo:inline xsl:use-attribute-sets="del-style">
2742
2860
  <xsl:apply-templates/>
@@ -3079,13 +3197,23 @@
3079
3197
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3080
3198
  <xsl:value-of select="substring($str, 2)"/>
3081
3199
  </xsl:template><xsl:template match="mathml:math">
3082
- <fo:inline font-family="STIX Two Math"> <!-- -->
3200
+ <xsl:variable name="isAdded" select="@added"/>
3201
+ <xsl:variable name="isDeleted" select="@deleted"/>
3202
+
3203
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3204
+
3205
+
3206
+ <xsl:call-template name="setTrackChangesStyles">
3207
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3208
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3209
+ </xsl:call-template>
3083
3210
 
3084
3211
  <xsl:variable name="mathml">
3085
3212
  <xsl:apply-templates select="." mode="mathml"/>
3086
3213
  </xsl:variable>
3087
3214
  <fo:instream-foreign-object fox:alt-text="Math">
3088
3215
 
3216
+
3089
3217
  <!-- <xsl:copy-of select="."/> -->
3090
3218
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3091
3219
  </fo:instream-foreign-object>
@@ -3335,8 +3463,15 @@
3335
3463
  </fo:inline>
3336
3464
  </xsl:if>
3337
3465
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3466
+ <xsl:variable name="isAdded" select="@added"/>
3467
+ <xsl:variable name="isDeleted" select="@deleted"/>
3338
3468
  <fo:block-container id="{@id}">
3339
3469
 
3470
+ <xsl:call-template name="setTrackChangesStyles">
3471
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3472
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3473
+ </xsl:call-template>
3474
+
3340
3475
  <fo:block>
3341
3476
  <xsl:apply-templates/>
3342
3477
  </fo:block>
@@ -3356,6 +3491,8 @@
3356
3491
  <xsl:apply-templates/>
3357
3492
  </fo:block>
3358
3493
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3494
+ <xsl:variable name="isAdded" select="../@added"/>
3495
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3359
3496
  <xsl:choose>
3360
3497
  <xsl:when test="ancestor::*[local-name() = 'title']">
3361
3498
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3371,7 +3508,26 @@
3371
3508
  <xsl:variable name="src">
3372
3509
  <xsl:call-template name="image_src"/>
3373
3510
  </xsl:variable>
3374
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3511
+
3512
+ <xsl:choose>
3513
+ <xsl:when test="$isDeleted = 'true'">
3514
+ <!-- enclose in svg -->
3515
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3516
+ <xsl:attribute name="width">100%</xsl:attribute>
3517
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3518
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3519
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3520
+
3521
+
3522
+ <xsl:apply-templates select="." mode="cross_image"/>
3523
+
3524
+ </fo:instream-foreign-object>
3525
+ </xsl:when>
3526
+ <xsl:otherwise>
3527
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3528
+ </xsl:otherwise>
3529
+ </xsl:choose>
3530
+
3375
3531
  </fo:block>
3376
3532
  </xsl:otherwise>
3377
3533
  </xsl:choose>
@@ -3387,6 +3543,55 @@
3387
3543
  <xsl:value-of select="@src"/>
3388
3544
  </xsl:otherwise>
3389
3545
  </xsl:choose>
3546
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3547
+ <xsl:choose>
3548
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3549
+ <xsl:variable name="src">
3550
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3551
+ </xsl:variable>
3552
+ <xsl:variable name="width" select="document($src)/@width"/>
3553
+ <xsl:variable name="height" select="document($src)/@height"/>
3554
+ <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">
3555
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3556
+ </svg>
3557
+ </xsl:when>
3558
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3559
+ <xsl:variable name="src">
3560
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3561
+ </xsl:variable>
3562
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3563
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3564
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3565
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3566
+ <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">
3567
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3568
+ </svg>
3569
+ </xsl:when>
3570
+ <xsl:otherwise>
3571
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3572
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3573
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3574
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3575
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3576
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3577
+ <!-- width=<xsl:value-of select="$width"/> -->
3578
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3579
+ <!-- height=<xsl:value-of select="$height"/> -->
3580
+ <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">
3581
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3582
+ <xsl:call-template name="svg_cross">
3583
+ <xsl:with-param name="width" select="$width"/>
3584
+ <xsl:with-param name="height" select="$height"/>
3585
+ </xsl:call-template>
3586
+ </svg>
3587
+ </xsl:otherwise>
3588
+ </xsl:choose>
3589
+
3590
+ </xsl:template><xsl:template name="svg_cross">
3591
+ <xsl:param name="width"/>
3592
+ <xsl:param name="height"/>
3593
+ <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; "/>
3594
+ <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; "/>
3390
3595
  </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">
3391
3596
  <xsl:apply-templates mode="contents"/>
3392
3597
  <xsl:text> </xsl:text>
@@ -3929,6 +4134,7 @@
3929
4134
  <xsl:variable name="element">
3930
4135
 
3931
4136
  inline
4137
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3932
4138
  </xsl:variable>
3933
4139
  <xsl:choose>
3934
4140
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3936,7 +4142,7 @@
3936
4142
  <xsl:apply-templates/>
3937
4143
  </fo:inline>
3938
4144
  </xsl:when>
3939
- <xsl:when test="normalize-space($element) = 'block'">
4145
+ <xsl:when test="contains(normalize-space($element), 'block')">
3940
4146
  <fo:block xsl:use-attribute-sets="example-name-style">
3941
4147
  <xsl:apply-templates/>
3942
4148
  </fo:block>
@@ -4145,7 +4351,8 @@
4145
4351
  </fo:inline>
4146
4352
  </xsl:when>
4147
4353
  <xsl:otherwise>
4148
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4354
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4355
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4149
4356
  </xsl:otherwise>
4150
4357
  </xsl:choose>
4151
4358
 
@@ -4860,4 +5067,44 @@
4860
5067
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4861
5068
  </xsl:choose>
4862
5069
 
5070
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5071
+ <xsl:param name="isAdded"/>
5072
+ <xsl:param name="isDeleted"/>
5073
+ <xsl:choose>
5074
+ <xsl:when test="local-name() = 'math'">
5075
+ <xsl:if test="$isAdded = 'true'">
5076
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5077
+ </xsl:if>
5078
+ <xsl:if test="$isDeleted = 'true'">
5079
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5080
+ </xsl:if>
5081
+ </xsl:when>
5082
+ <xsl:otherwise>
5083
+ <xsl:if test="$isAdded = 'true'">
5084
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5085
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5086
+ </xsl:if>
5087
+ <xsl:if test="$isDeleted = 'true'">
5088
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5089
+ <xsl:if test="local-name() = 'table'">
5090
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5091
+ </xsl:if>
5092
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5093
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5094
+ </xsl:if>
5095
+ </xsl:otherwise>
5096
+ </xsl:choose>
5097
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5098
+ <xsl:if test="$lang = 'ar'">
5099
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5100
+ </xsl:if>
5101
+ </xsl:template><xsl:template name="setAlignment">
5102
+ <xsl:param name="align" select="normalize-space(@align)"/>
5103
+ <xsl:choose>
5104
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5105
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5106
+ <xsl:when test="$align != ''">
5107
+ <xsl:value-of select="$align"/>
5108
+ </xsl:when>
5109
+ </xsl:choose>
4863
5110
  </xsl:template></xsl:stylesheet>
@@ -1046,6 +1046,7 @@
1046
1046
  </xsl:choose>
1047
1047
  </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">
1048
1048
 
1049
+
1049
1050
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1050
1051
 
1051
1052
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1374,13 +1375,25 @@
1374
1375
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1375
1376
 
1376
1377
 
1377
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1378
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1379
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1380
+ </xsl:variable><xsl:attribute-set name="add-style">
1378
1381
  <xsl:attribute name="color">red</xsl:attribute>
1379
1382
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1380
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1381
- <xsl:attribute name="color">red</xsl:attribute>
1383
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1384
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1385
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1386
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1387
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1388
+ <xsl:text>red</xsl:text>
1389
+ </xsl:variable><xsl:attribute-set name="del-style">
1390
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1382
1391
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1383
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1392
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1393
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1394
+
1395
+
1396
+ </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">
1384
1397
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1385
1398
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1386
1399
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1429,16 +1442,17 @@
1429
1442
  <xsl:call-template name="add-zero-spaces-java"/>
1430
1443
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1431
1444
 
1445
+ <xsl:variable name="table-preamble">
1446
+
1447
+
1448
+ </xsl:variable>
1449
+
1432
1450
  <xsl:variable name="table">
1433
1451
 
1434
1452
  <xsl:variable name="simple-table">
1435
1453
  <xsl:call-template name="getSimpleTable"/>
1436
1454
  </xsl:variable>
1437
1455
 
1438
-
1439
-
1440
-
1441
-
1442
1456
  <!-- <xsl:if test="$namespace = 'bipm'">
1443
1457
  <fo:block>&#xA0;</fo:block>
1444
1458
  </xsl:if> -->
@@ -1453,7 +1467,7 @@
1453
1467
 
1454
1468
 
1455
1469
 
1456
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1470
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1457
1471
 
1458
1472
  <!-- <xsl:variable name="cols-count">
1459
1473
  <xsl:choose>
@@ -1472,8 +1486,6 @@
1472
1486
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1473
1487
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1474
1488
 
1475
-
1476
-
1477
1489
  <xsl:variable name="colwidths">
1478
1490
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1479
1491
  <xsl:call-template name="calculate-column-widths">
@@ -1501,6 +1513,7 @@
1501
1513
  </xsl:choose>
1502
1514
  </xsl:variable>
1503
1515
 
1516
+
1504
1517
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1505
1518
 
1506
1519
 
@@ -1532,6 +1545,7 @@
1532
1545
 
1533
1546
 
1534
1547
 
1548
+
1535
1549
 
1536
1550
 
1537
1551
 
@@ -1621,7 +1635,8 @@
1621
1635
  </fo:block-container>
1622
1636
  </xsl:variable>
1623
1637
 
1624
-
1638
+ <xsl:variable name="isAdded" select="@added"/>
1639
+ <xsl:variable name="isDeleted" select="@deleted"/>
1625
1640
 
1626
1641
  <xsl:choose>
1627
1642
  <xsl:when test="@width">
@@ -1635,7 +1650,14 @@
1635
1650
  <fo:table-body>
1636
1651
  <fo:table-row>
1637
1652
  <fo:table-cell column-number="2">
1638
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1653
+ <xsl:copy-of select="$table-preamble"/>
1654
+ <fo:block>
1655
+ <xsl:call-template name="setTrackChangesStyles">
1656
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1657
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1658
+ </xsl:call-template>
1659
+ <xsl:copy-of select="$table"/>
1660
+ </fo:block>
1639
1661
  </fo:table-cell>
1640
1662
  </fo:table-row>
1641
1663
  </fo:table-body>
@@ -1646,7 +1668,22 @@
1646
1668
 
1647
1669
  </xsl:when>
1648
1670
  <xsl:otherwise>
1649
- <xsl:copy-of select="$table"/>
1671
+ <xsl:choose>
1672
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1673
+ <xsl:copy-of select="$table-preamble"/>
1674
+ <fo:block>
1675
+ <xsl:call-template name="setTrackChangesStyles">
1676
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1677
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1678
+ </xsl:call-template>
1679
+ <xsl:copy-of select="$table"/>
1680
+ </fo:block>
1681
+ </xsl:when>
1682
+ <xsl:otherwise>
1683
+ <xsl:copy-of select="$table-preamble"/>
1684
+ <xsl:copy-of select="$table"/>
1685
+ </xsl:otherwise>
1686
+ </xsl:choose>
1650
1687
  </xsl:otherwise>
1651
1688
  </xsl:choose>
1652
1689
 
@@ -1707,7 +1744,7 @@
1707
1744
  </xsl:for-each>
1708
1745
  </xsl:when>
1709
1746
  <xsl:otherwise>
1710
- <xsl:for-each select="xalan:nodeset($table)//tr">
1747
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1711
1748
  <xsl:variable name="td_text">
1712
1749
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1713
1750
 
@@ -2047,7 +2084,8 @@
2047
2084
  <xsl:attribute name="text-align">
2048
2085
  <xsl:choose>
2049
2086
  <xsl:when test="@align">
2050
- <xsl:value-of select="@align"/>
2087
+ <xsl:call-template name="setAlignment"/>
2088
+ <!-- <xsl:value-of select="@align"/> -->
2051
2089
  </xsl:when>
2052
2090
  <xsl:otherwise>center</xsl:otherwise>
2053
2091
  </xsl:choose>
@@ -2063,6 +2101,9 @@
2063
2101
 
2064
2102
 
2065
2103
 
2104
+ <xsl:if test="$lang = 'ar'">
2105
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2106
+ </xsl:if>
2066
2107
  <xsl:if test="@colspan">
2067
2108
  <xsl:attribute name="number-columns-spanned">
2068
2109
  <xsl:value-of select="@colspan"/>
@@ -2094,11 +2135,15 @@
2094
2135
  <xsl:attribute name="text-align">
2095
2136
  <xsl:choose>
2096
2137
  <xsl:when test="@align">
2097
- <xsl:value-of select="@align"/>
2138
+ <xsl:call-template name="setAlignment"/>
2139
+ <!-- <xsl:value-of select="@align"/> -->
2098
2140
  </xsl:when>
2099
2141
  <xsl:otherwise>left</xsl:otherwise>
2100
2142
  </xsl:choose>
2101
2143
  </xsl:attribute>
2144
+ <xsl:if test="$lang = 'ar'">
2145
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2146
+ </xsl:if>
2102
2147
 
2103
2148
 
2104
2149
 
@@ -2110,6 +2155,9 @@
2110
2155
 
2111
2156
 
2112
2157
 
2158
+ <xsl:if test=".//*[local-name() = 'table']">
2159
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2160
+ </xsl:if>
2113
2161
  <xsl:if test="@colspan">
2114
2162
  <xsl:attribute name="number-columns-spanned">
2115
2163
  <xsl:value-of select="@colspan"/>
@@ -2237,13 +2285,13 @@
2237
2285
  </xsl:choose>
2238
2286
  </xsl:variable>
2239
2287
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2240
- <xsl:element name="{$ns}:table">
2288
+ <!-- <xsl:element name="{$ns}:table"> -->
2241
2289
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2242
2290
  <tbody>
2243
2291
  <xsl:apply-templates mode="dl"/>
2244
2292
  </tbody>
2245
2293
  </xsl:for-each>
2246
- </xsl:element>
2294
+ <!-- </xsl:element> -->
2247
2295
  </xsl:variable>
2248
2296
 
2249
2297
  <xsl:call-template name="calculate-column-widths">
@@ -2334,6 +2382,8 @@
2334
2382
  <xsl:apply-templates/>
2335
2383
  </fo:inline>
2336
2384
  </xsl:template><xsl:template match="*[local-name()='dl']">
2385
+ <xsl:variable name="isAdded" select="@added"/>
2386
+ <xsl:variable name="isDeleted" select="@deleted"/>
2337
2387
  <fo:block-container>
2338
2388
 
2339
2389
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2350,6 +2400,12 @@
2350
2400
  </xsl:attribute>
2351
2401
 
2352
2402
  </xsl:if>
2403
+
2404
+ <xsl:call-template name="setTrackChangesStyles">
2405
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2406
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2407
+ </xsl:call-template>
2408
+
2353
2409
  <fo:block-container>
2354
2410
 
2355
2411
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2457,11 +2513,11 @@
2457
2513
  </xsl:choose>
2458
2514
  </xsl:variable>
2459
2515
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2460
- <xsl:element name="{$ns}:table">
2516
+ <!-- <xsl:element name="{$ns}:table"> -->
2461
2517
  <tbody>
2462
2518
  <xsl:apply-templates mode="dl"/>
2463
2519
  </tbody>
2464
- </xsl:element>
2520
+ <!-- </xsl:element> -->
2465
2521
  </xsl:variable>
2466
2522
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2467
2523
  <xsl:variable name="colwidths">
@@ -2734,9 +2790,71 @@
2734
2790
  <xsl:apply-templates/>
2735
2791
  </fo:inline>
2736
2792
  </xsl:template><xsl:template match="*[local-name()='add']">
2737
- <fo:inline xsl:use-attribute-sets="add-style">
2738
- <xsl:apply-templates/>
2739
- </fo:inline>
2793
+ <xsl:choose>
2794
+ <xsl:when test="@amendment">
2795
+ <fo:inline>
2796
+ <xsl:call-template name="insertTag">
2797
+ <xsl:with-param name="kind">A</xsl:with-param>
2798
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2799
+ </xsl:call-template>
2800
+ <xsl:apply-templates/>
2801
+ <xsl:call-template name="insertTag">
2802
+ <xsl:with-param name="type">closing</xsl:with-param>
2803
+ <xsl:with-param name="kind">A</xsl:with-param>
2804
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2805
+ </xsl:call-template>
2806
+ </fo:inline>
2807
+ </xsl:when>
2808
+ <xsl:when test="@corrigenda">
2809
+ <fo:inline>
2810
+ <xsl:call-template name="insertTag">
2811
+ <xsl:with-param name="kind">C</xsl:with-param>
2812
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2813
+ </xsl:call-template>
2814
+ <xsl:apply-templates/>
2815
+ <xsl:call-template name="insertTag">
2816
+ <xsl:with-param name="type">closing</xsl:with-param>
2817
+ <xsl:with-param name="kind">C</xsl:with-param>
2818
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2819
+ </xsl:call-template>
2820
+ </fo:inline>
2821
+ </xsl:when>
2822
+ <xsl:otherwise>
2823
+ <fo:inline xsl:use-attribute-sets="add-style">
2824
+ <xsl:apply-templates/>
2825
+ </fo:inline>
2826
+ </xsl:otherwise>
2827
+ </xsl:choose>
2828
+
2829
+ </xsl:template><xsl:template name="insertTag">
2830
+ <xsl:param name="type"/>
2831
+ <xsl:param name="kind"/>
2832
+ <xsl:param name="value"/>
2833
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2834
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2835
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2836
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2837
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2838
+ <xsl:attribute name="height">5mm</xsl:attribute>
2839
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2840
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2841
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2842
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2843
+ <g>
2844
+ <xsl:if test="$type = 'closing'">
2845
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2846
+ </xsl:if>
2847
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2848
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2849
+ </g>
2850
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2851
+ <xsl:if test="$type = 'closing'">
2852
+ <xsl:attribute name="x">25</xsl:attribute>
2853
+ </xsl:if>
2854
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2855
+ </text>
2856
+ </svg>
2857
+ </fo:instream-foreign-object>
2740
2858
  </xsl:template><xsl:template match="*[local-name()='del']">
2741
2859
  <fo:inline xsl:use-attribute-sets="del-style">
2742
2860
  <xsl:apply-templates/>
@@ -3079,13 +3197,23 @@
3079
3197
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3080
3198
  <xsl:value-of select="substring($str, 2)"/>
3081
3199
  </xsl:template><xsl:template match="mathml:math">
3082
- <fo:inline font-family="STIX Two Math"> <!-- -->
3200
+ <xsl:variable name="isAdded" select="@added"/>
3201
+ <xsl:variable name="isDeleted" select="@deleted"/>
3202
+
3203
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3204
+
3205
+
3206
+ <xsl:call-template name="setTrackChangesStyles">
3207
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3208
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3209
+ </xsl:call-template>
3083
3210
 
3084
3211
  <xsl:variable name="mathml">
3085
3212
  <xsl:apply-templates select="." mode="mathml"/>
3086
3213
  </xsl:variable>
3087
3214
  <fo:instream-foreign-object fox:alt-text="Math">
3088
3215
 
3216
+
3089
3217
  <!-- <xsl:copy-of select="."/> -->
3090
3218
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3091
3219
  </fo:instream-foreign-object>
@@ -3335,8 +3463,15 @@
3335
3463
  </fo:inline>
3336
3464
  </xsl:if>
3337
3465
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3466
+ <xsl:variable name="isAdded" select="@added"/>
3467
+ <xsl:variable name="isDeleted" select="@deleted"/>
3338
3468
  <fo:block-container id="{@id}">
3339
3469
 
3470
+ <xsl:call-template name="setTrackChangesStyles">
3471
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3472
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3473
+ </xsl:call-template>
3474
+
3340
3475
  <fo:block>
3341
3476
  <xsl:apply-templates/>
3342
3477
  </fo:block>
@@ -3356,6 +3491,8 @@
3356
3491
  <xsl:apply-templates/>
3357
3492
  </fo:block>
3358
3493
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3494
+ <xsl:variable name="isAdded" select="../@added"/>
3495
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3359
3496
  <xsl:choose>
3360
3497
  <xsl:when test="ancestor::*[local-name() = 'title']">
3361
3498
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3371,7 +3508,26 @@
3371
3508
  <xsl:variable name="src">
3372
3509
  <xsl:call-template name="image_src"/>
3373
3510
  </xsl:variable>
3374
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3511
+
3512
+ <xsl:choose>
3513
+ <xsl:when test="$isDeleted = 'true'">
3514
+ <!-- enclose in svg -->
3515
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3516
+ <xsl:attribute name="width">100%</xsl:attribute>
3517
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3518
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3519
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3520
+
3521
+
3522
+ <xsl:apply-templates select="." mode="cross_image"/>
3523
+
3524
+ </fo:instream-foreign-object>
3525
+ </xsl:when>
3526
+ <xsl:otherwise>
3527
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3528
+ </xsl:otherwise>
3529
+ </xsl:choose>
3530
+
3375
3531
  </fo:block>
3376
3532
  </xsl:otherwise>
3377
3533
  </xsl:choose>
@@ -3387,6 +3543,55 @@
3387
3543
  <xsl:value-of select="@src"/>
3388
3544
  </xsl:otherwise>
3389
3545
  </xsl:choose>
3546
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3547
+ <xsl:choose>
3548
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3549
+ <xsl:variable name="src">
3550
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3551
+ </xsl:variable>
3552
+ <xsl:variable name="width" select="document($src)/@width"/>
3553
+ <xsl:variable name="height" select="document($src)/@height"/>
3554
+ <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">
3555
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3556
+ </svg>
3557
+ </xsl:when>
3558
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3559
+ <xsl:variable name="src">
3560
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3561
+ </xsl:variable>
3562
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3563
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3564
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3565
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3566
+ <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">
3567
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3568
+ </svg>
3569
+ </xsl:when>
3570
+ <xsl:otherwise>
3571
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3572
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3573
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3574
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3575
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3576
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3577
+ <!-- width=<xsl:value-of select="$width"/> -->
3578
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3579
+ <!-- height=<xsl:value-of select="$height"/> -->
3580
+ <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">
3581
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3582
+ <xsl:call-template name="svg_cross">
3583
+ <xsl:with-param name="width" select="$width"/>
3584
+ <xsl:with-param name="height" select="$height"/>
3585
+ </xsl:call-template>
3586
+ </svg>
3587
+ </xsl:otherwise>
3588
+ </xsl:choose>
3589
+
3590
+ </xsl:template><xsl:template name="svg_cross">
3591
+ <xsl:param name="width"/>
3592
+ <xsl:param name="height"/>
3593
+ <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; "/>
3594
+ <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; "/>
3390
3595
  </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">
3391
3596
  <xsl:apply-templates mode="contents"/>
3392
3597
  <xsl:text> </xsl:text>
@@ -3929,6 +4134,7 @@
3929
4134
  <xsl:variable name="element">
3930
4135
 
3931
4136
  inline
4137
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3932
4138
  </xsl:variable>
3933
4139
  <xsl:choose>
3934
4140
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3936,7 +4142,7 @@
3936
4142
  <xsl:apply-templates/>
3937
4143
  </fo:inline>
3938
4144
  </xsl:when>
3939
- <xsl:when test="normalize-space($element) = 'block'">
4145
+ <xsl:when test="contains(normalize-space($element), 'block')">
3940
4146
  <fo:block xsl:use-attribute-sets="example-name-style">
3941
4147
  <xsl:apply-templates/>
3942
4148
  </fo:block>
@@ -4145,7 +4351,8 @@
4145
4351
  </fo:inline>
4146
4352
  </xsl:when>
4147
4353
  <xsl:otherwise>
4148
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4354
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4355
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4149
4356
  </xsl:otherwise>
4150
4357
  </xsl:choose>
4151
4358
 
@@ -4860,4 +5067,44 @@
4860
5067
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4861
5068
  </xsl:choose>
4862
5069
 
5070
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5071
+ <xsl:param name="isAdded"/>
5072
+ <xsl:param name="isDeleted"/>
5073
+ <xsl:choose>
5074
+ <xsl:when test="local-name() = 'math'">
5075
+ <xsl:if test="$isAdded = 'true'">
5076
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5077
+ </xsl:if>
5078
+ <xsl:if test="$isDeleted = 'true'">
5079
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5080
+ </xsl:if>
5081
+ </xsl:when>
5082
+ <xsl:otherwise>
5083
+ <xsl:if test="$isAdded = 'true'">
5084
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5085
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5086
+ </xsl:if>
5087
+ <xsl:if test="$isDeleted = 'true'">
5088
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5089
+ <xsl:if test="local-name() = 'table'">
5090
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5091
+ </xsl:if>
5092
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5093
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5094
+ </xsl:if>
5095
+ </xsl:otherwise>
5096
+ </xsl:choose>
5097
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5098
+ <xsl:if test="$lang = 'ar'">
5099
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5100
+ </xsl:if>
5101
+ </xsl:template><xsl:template name="setAlignment">
5102
+ <xsl:param name="align" select="normalize-space(@align)"/>
5103
+ <xsl:choose>
5104
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5105
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5106
+ <xsl:when test="$align != ''">
5107
+ <xsl:value-of select="$align"/>
5108
+ </xsl:when>
5109
+ </xsl:choose>
4863
5110
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module M3AAWG
3
- VERSION = "1.7.0".freeze
3
+ VERSION = "1.7.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-m3aawg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities