metanorma-iho 0.3.0 → 0.3.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: 81b584b6fa781275652a98ee3029be04d052719fc33eaa7462b51775ee6fc08d
4
- data.tar.gz: ac2f2a77f10fd8b4ac1064805beaea4887647d3415ef4b9f88786a5e00fe4d7f
3
+ metadata.gz: e60da0241e8c2c76d9b37fc57cc1dead84618e2a969501677d2e16cd2a3c49f2
4
+ data.tar.gz: 1a7caeff95721dbb95cd04454e3137053d93ea1f9024ac0e7c3064225ea256e1
5
5
  SHA512:
6
- metadata.gz: fad6047649865379a781e21425b19a7751a286d31ea491196161d4d498cc1bc6c5b7eedd50e9c44fb73aae47cb5408a2120f76069c6ef35e3df64e0039efb14b
7
- data.tar.gz: 485504744f7aff4dcb26ee6da3f95086b671c60e92c2ceac1cd878a6333be248e9168bfdb556c558583b002b04365178cdd67750bc1e0b49a33f5404786a9c57
6
+ metadata.gz: 3e67d94e11dd5603b689d28937c87474f76f17ec63eeb5bc271c194fe70d324ca0582f315bd6b57644c69077c6972e7e19d3782690153138f2475a7c7710fd04
7
+ data.tar.gz: 46cdf3a2d2682d533c7b6e6417e140fa96b4d68c4adbc7a7ccea1bd96ae3ebe505c4c8d57f0790058946fe566d516b25ca64c17e478a5bf4778652aca411cda6
@@ -1110,6 +1110,7 @@
1110
1110
  </xsl:choose>
1111
1111
  </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">
1112
1112
 
1113
+
1113
1114
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1114
1115
 
1115
1116
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1450,13 +1451,25 @@
1450
1451
 
1451
1452
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1452
1453
 
1453
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1454
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1455
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1456
+ </xsl:variable><xsl:attribute-set name="add-style">
1454
1457
  <xsl:attribute name="color">red</xsl:attribute>
1455
1458
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1456
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1457
- <xsl:attribute name="color">red</xsl:attribute>
1459
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1460
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1461
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1462
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1463
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1464
+ <xsl:text>red</xsl:text>
1465
+ </xsl:variable><xsl:attribute-set name="del-style">
1466
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1458
1467
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1459
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1468
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1469
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1470
+
1471
+
1472
+ </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">
1460
1473
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1461
1474
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1462
1475
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1501,16 +1514,17 @@
1501
1514
  <xsl:call-template name="add-zero-spaces-java"/>
1502
1515
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1503
1516
 
1517
+ <xsl:variable name="table-preamble">
1518
+
1519
+
1520
+ </xsl:variable>
1521
+
1504
1522
  <xsl:variable name="table">
1505
1523
 
1506
1524
  <xsl:variable name="simple-table">
1507
1525
  <xsl:call-template name="getSimpleTable"/>
1508
1526
  </xsl:variable>
1509
1527
 
1510
-
1511
-
1512
-
1513
-
1514
1528
  <!-- <xsl:if test="$namespace = 'bipm'">
1515
1529
  <fo:block>&#xA0;</fo:block>
1516
1530
  </xsl:if> -->
@@ -1525,7 +1539,7 @@
1525
1539
 
1526
1540
 
1527
1541
 
1528
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1542
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1529
1543
 
1530
1544
  <!-- <xsl:variable name="cols-count">
1531
1545
  <xsl:choose>
@@ -1544,8 +1558,6 @@
1544
1558
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1545
1559
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1546
1560
 
1547
-
1548
-
1549
1561
  <xsl:variable name="colwidths">
1550
1562
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1551
1563
  <xsl:call-template name="calculate-column-widths">
@@ -1573,6 +1585,7 @@
1573
1585
  </xsl:choose>
1574
1586
  </xsl:variable>
1575
1587
 
1588
+
1576
1589
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1577
1590
 
1578
1591
 
@@ -1608,6 +1621,7 @@
1608
1621
 
1609
1622
 
1610
1623
 
1624
+
1611
1625
 
1612
1626
 
1613
1627
 
@@ -1700,7 +1714,8 @@
1700
1714
  </fo:block-container>
1701
1715
  </xsl:variable>
1702
1716
 
1703
-
1717
+ <xsl:variable name="isAdded" select="@added"/>
1718
+ <xsl:variable name="isDeleted" select="@deleted"/>
1704
1719
 
1705
1720
  <xsl:choose>
1706
1721
  <xsl:when test="@width">
@@ -1714,7 +1729,14 @@
1714
1729
  <fo:table-body>
1715
1730
  <fo:table-row>
1716
1731
  <fo:table-cell column-number="2">
1717
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1732
+ <xsl:copy-of select="$table-preamble"/>
1733
+ <fo:block>
1734
+ <xsl:call-template name="setTrackChangesStyles">
1735
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1736
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1737
+ </xsl:call-template>
1738
+ <xsl:copy-of select="$table"/>
1739
+ </fo:block>
1718
1740
  </fo:table-cell>
1719
1741
  </fo:table-row>
1720
1742
  </fo:table-body>
@@ -1725,7 +1747,22 @@
1725
1747
 
1726
1748
  </xsl:when>
1727
1749
  <xsl:otherwise>
1728
- <xsl:copy-of select="$table"/>
1750
+ <xsl:choose>
1751
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1752
+ <xsl:copy-of select="$table-preamble"/>
1753
+ <fo:block>
1754
+ <xsl:call-template name="setTrackChangesStyles">
1755
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1756
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1757
+ </xsl:call-template>
1758
+ <xsl:copy-of select="$table"/>
1759
+ </fo:block>
1760
+ </xsl:when>
1761
+ <xsl:otherwise>
1762
+ <xsl:copy-of select="$table-preamble"/>
1763
+ <xsl:copy-of select="$table"/>
1764
+ </xsl:otherwise>
1765
+ </xsl:choose>
1729
1766
  </xsl:otherwise>
1730
1767
  </xsl:choose>
1731
1768
 
@@ -1786,7 +1823,7 @@
1786
1823
  </xsl:for-each>
1787
1824
  </xsl:when>
1788
1825
  <xsl:otherwise>
1789
- <xsl:for-each select="xalan:nodeset($table)//tr">
1826
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1790
1827
  <xsl:variable name="td_text">
1791
1828
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1792
1829
 
@@ -2126,7 +2163,8 @@
2126
2163
  <xsl:attribute name="text-align">
2127
2164
  <xsl:choose>
2128
2165
  <xsl:when test="@align">
2129
- <xsl:value-of select="@align"/>
2166
+ <xsl:call-template name="setAlignment"/>
2167
+ <!-- <xsl:value-of select="@align"/> -->
2130
2168
  </xsl:when>
2131
2169
  <xsl:otherwise>center</xsl:otherwise>
2132
2170
  </xsl:choose>
@@ -2142,6 +2180,9 @@
2142
2180
 
2143
2181
 
2144
2182
 
2183
+ <xsl:if test="$lang = 'ar'">
2184
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2185
+ </xsl:if>
2145
2186
  <xsl:if test="@colspan">
2146
2187
  <xsl:attribute name="number-columns-spanned">
2147
2188
  <xsl:value-of select="@colspan"/>
@@ -2173,11 +2214,15 @@
2173
2214
  <xsl:attribute name="text-align">
2174
2215
  <xsl:choose>
2175
2216
  <xsl:when test="@align">
2176
- <xsl:value-of select="@align"/>
2217
+ <xsl:call-template name="setAlignment"/>
2218
+ <!-- <xsl:value-of select="@align"/> -->
2177
2219
  </xsl:when>
2178
2220
  <xsl:otherwise>left</xsl:otherwise>
2179
2221
  </xsl:choose>
2180
2222
  </xsl:attribute>
2223
+ <xsl:if test="$lang = 'ar'">
2224
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2225
+ </xsl:if>
2181
2226
  <!-- and ancestor::*[local-name() = 'thead'] -->
2182
2227
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2183
2228
 
@@ -2191,6 +2236,9 @@
2191
2236
 
2192
2237
 
2193
2238
 
2239
+ <xsl:if test=".//*[local-name() = 'table']">
2240
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2241
+ </xsl:if>
2194
2242
  <xsl:if test="@colspan">
2195
2243
  <xsl:attribute name="number-columns-spanned">
2196
2244
  <xsl:value-of select="@colspan"/>
@@ -2323,13 +2371,13 @@
2323
2371
  </xsl:choose>
2324
2372
  </xsl:variable>
2325
2373
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2326
- <xsl:element name="{$ns}:table">
2374
+ <!-- <xsl:element name="{$ns}:table"> -->
2327
2375
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2328
2376
  <tbody>
2329
2377
  <xsl:apply-templates mode="dl"/>
2330
2378
  </tbody>
2331
2379
  </xsl:for-each>
2332
- </xsl:element>
2380
+ <!-- </xsl:element> -->
2333
2381
  </xsl:variable>
2334
2382
 
2335
2383
  <xsl:call-template name="calculate-column-widths">
@@ -2420,6 +2468,8 @@
2420
2468
  <xsl:apply-templates/>
2421
2469
  </fo:inline>
2422
2470
  </xsl:template><xsl:template match="*[local-name()='dl']">
2471
+ <xsl:variable name="isAdded" select="@added"/>
2472
+ <xsl:variable name="isDeleted" select="@deleted"/>
2423
2473
  <fo:block-container>
2424
2474
 
2425
2475
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2436,6 +2486,12 @@
2436
2486
  </xsl:attribute>
2437
2487
 
2438
2488
  </xsl:if>
2489
+
2490
+ <xsl:call-template name="setTrackChangesStyles">
2491
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2492
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2493
+ </xsl:call-template>
2494
+
2439
2495
  <fo:block-container>
2440
2496
 
2441
2497
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2547,11 +2603,11 @@
2547
2603
  </xsl:choose>
2548
2604
  </xsl:variable>
2549
2605
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2550
- <xsl:element name="{$ns}:table">
2606
+ <!-- <xsl:element name="{$ns}:table"> -->
2551
2607
  <tbody>
2552
2608
  <xsl:apply-templates mode="dl"/>
2553
2609
  </tbody>
2554
- </xsl:element>
2610
+ <!-- </xsl:element> -->
2555
2611
  </xsl:variable>
2556
2612
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2557
2613
  <xsl:variable name="colwidths">
@@ -2822,9 +2878,71 @@
2822
2878
  <xsl:apply-templates/>
2823
2879
  </fo:inline>
2824
2880
  </xsl:template><xsl:template match="*[local-name()='add']">
2825
- <fo:inline xsl:use-attribute-sets="add-style">
2826
- <xsl:apply-templates/>
2827
- </fo:inline>
2881
+ <xsl:choose>
2882
+ <xsl:when test="@amendment">
2883
+ <fo:inline>
2884
+ <xsl:call-template name="insertTag">
2885
+ <xsl:with-param name="kind">A</xsl:with-param>
2886
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2887
+ </xsl:call-template>
2888
+ <xsl:apply-templates/>
2889
+ <xsl:call-template name="insertTag">
2890
+ <xsl:with-param name="type">closing</xsl:with-param>
2891
+ <xsl:with-param name="kind">A</xsl:with-param>
2892
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2893
+ </xsl:call-template>
2894
+ </fo:inline>
2895
+ </xsl:when>
2896
+ <xsl:when test="@corrigenda">
2897
+ <fo:inline>
2898
+ <xsl:call-template name="insertTag">
2899
+ <xsl:with-param name="kind">C</xsl:with-param>
2900
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2901
+ </xsl:call-template>
2902
+ <xsl:apply-templates/>
2903
+ <xsl:call-template name="insertTag">
2904
+ <xsl:with-param name="type">closing</xsl:with-param>
2905
+ <xsl:with-param name="kind">C</xsl:with-param>
2906
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2907
+ </xsl:call-template>
2908
+ </fo:inline>
2909
+ </xsl:when>
2910
+ <xsl:otherwise>
2911
+ <fo:inline xsl:use-attribute-sets="add-style">
2912
+ <xsl:apply-templates/>
2913
+ </fo:inline>
2914
+ </xsl:otherwise>
2915
+ </xsl:choose>
2916
+
2917
+ </xsl:template><xsl:template name="insertTag">
2918
+ <xsl:param name="type"/>
2919
+ <xsl:param name="kind"/>
2920
+ <xsl:param name="value"/>
2921
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2922
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2923
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2924
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2925
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2926
+ <xsl:attribute name="height">5mm</xsl:attribute>
2927
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2928
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2929
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2930
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2931
+ <g>
2932
+ <xsl:if test="$type = 'closing'">
2933
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2934
+ </xsl:if>
2935
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2936
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2937
+ </g>
2938
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2939
+ <xsl:if test="$type = 'closing'">
2940
+ <xsl:attribute name="x">25</xsl:attribute>
2941
+ </xsl:if>
2942
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2943
+ </text>
2944
+ </svg>
2945
+ </fo:instream-foreign-object>
2828
2946
  </xsl:template><xsl:template match="*[local-name()='del']">
2829
2947
  <fo:inline xsl:use-attribute-sets="del-style">
2830
2948
  <xsl:apply-templates/>
@@ -3167,13 +3285,23 @@
3167
3285
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3168
3286
  <xsl:value-of select="substring($str, 2)"/>
3169
3287
  </xsl:template><xsl:template match="mathml:math">
3170
- <fo:inline font-family="STIX Two Math"> <!-- -->
3288
+ <xsl:variable name="isAdded" select="@added"/>
3289
+ <xsl:variable name="isDeleted" select="@deleted"/>
3290
+
3291
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3292
+
3293
+
3294
+ <xsl:call-template name="setTrackChangesStyles">
3295
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3296
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3297
+ </xsl:call-template>
3171
3298
 
3172
3299
  <xsl:variable name="mathml">
3173
3300
  <xsl:apply-templates select="." mode="mathml"/>
3174
3301
  </xsl:variable>
3175
3302
  <fo:instream-foreign-object fox:alt-text="Math">
3176
3303
 
3304
+
3177
3305
  <!-- <xsl:copy-of select="."/> -->
3178
3306
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3179
3307
  </fo:instream-foreign-object>
@@ -3421,8 +3549,15 @@
3421
3549
  </fo:inline>
3422
3550
  </xsl:if>
3423
3551
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3552
+ <xsl:variable name="isAdded" select="@added"/>
3553
+ <xsl:variable name="isDeleted" select="@deleted"/>
3424
3554
  <fo:block-container id="{@id}">
3425
3555
 
3556
+ <xsl:call-template name="setTrackChangesStyles">
3557
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3558
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3559
+ </xsl:call-template>
3560
+
3426
3561
  <fo:block>
3427
3562
  <xsl:apply-templates/>
3428
3563
  </fo:block>
@@ -3442,6 +3577,8 @@
3442
3577
  <xsl:apply-templates/>
3443
3578
  </fo:block>
3444
3579
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3580
+ <xsl:variable name="isAdded" select="../@added"/>
3581
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3445
3582
  <xsl:choose>
3446
3583
  <xsl:when test="ancestor::*[local-name() = 'title']">
3447
3584
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3457,7 +3594,26 @@
3457
3594
  <xsl:variable name="src">
3458
3595
  <xsl:call-template name="image_src"/>
3459
3596
  </xsl:variable>
3460
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3597
+
3598
+ <xsl:choose>
3599
+ <xsl:when test="$isDeleted = 'true'">
3600
+ <!-- enclose in svg -->
3601
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3602
+ <xsl:attribute name="width">100%</xsl:attribute>
3603
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3604
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3605
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3606
+
3607
+
3608
+ <xsl:apply-templates select="." mode="cross_image"/>
3609
+
3610
+ </fo:instream-foreign-object>
3611
+ </xsl:when>
3612
+ <xsl:otherwise>
3613
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3614
+ </xsl:otherwise>
3615
+ </xsl:choose>
3616
+
3461
3617
  </fo:block>
3462
3618
  </xsl:otherwise>
3463
3619
  </xsl:choose>
@@ -3473,6 +3629,55 @@
3473
3629
  <xsl:value-of select="@src"/>
3474
3630
  </xsl:otherwise>
3475
3631
  </xsl:choose>
3632
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3633
+ <xsl:choose>
3634
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3635
+ <xsl:variable name="src">
3636
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3637
+ </xsl:variable>
3638
+ <xsl:variable name="width" select="document($src)/@width"/>
3639
+ <xsl:variable name="height" select="document($src)/@height"/>
3640
+ <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">
3641
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3642
+ </svg>
3643
+ </xsl:when>
3644
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3645
+ <xsl:variable name="src">
3646
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3647
+ </xsl:variable>
3648
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3649
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3650
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3651
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3652
+ <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">
3653
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3654
+ </svg>
3655
+ </xsl:when>
3656
+ <xsl:otherwise>
3657
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3658
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3659
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3660
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3661
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3662
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3663
+ <!-- width=<xsl:value-of select="$width"/> -->
3664
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3665
+ <!-- height=<xsl:value-of select="$height"/> -->
3666
+ <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">
3667
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3668
+ <xsl:call-template name="svg_cross">
3669
+ <xsl:with-param name="width" select="$width"/>
3670
+ <xsl:with-param name="height" select="$height"/>
3671
+ </xsl:call-template>
3672
+ </svg>
3673
+ </xsl:otherwise>
3674
+ </xsl:choose>
3675
+
3676
+ </xsl:template><xsl:template name="svg_cross">
3677
+ <xsl:param name="width"/>
3678
+ <xsl:param name="height"/>
3679
+ <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; "/>
3680
+ <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; "/>
3476
3681
  </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">
3477
3682
  <xsl:apply-templates mode="contents"/>
3478
3683
  <xsl:text> </xsl:text>
@@ -4015,6 +4220,7 @@
4015
4220
  <xsl:variable name="element">
4016
4221
  block
4017
4222
 
4223
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4018
4224
  </xsl:variable>
4019
4225
  <xsl:choose>
4020
4226
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4022,7 +4228,7 @@
4022
4228
  <xsl:apply-templates/>
4023
4229
  </fo:inline>
4024
4230
  </xsl:when>
4025
- <xsl:when test="normalize-space($element) = 'block'">
4231
+ <xsl:when test="contains(normalize-space($element), 'block')">
4026
4232
  <fo:block xsl:use-attribute-sets="example-name-style">
4027
4233
  <xsl:apply-templates/>
4028
4234
  </fo:block>
@@ -4245,7 +4451,8 @@
4245
4451
  </fo:inline>
4246
4452
  </xsl:when>
4247
4453
  <xsl:otherwise>
4248
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4454
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4455
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4249
4456
  </xsl:otherwise>
4250
4457
  </xsl:choose>
4251
4458
 
@@ -5052,4 +5259,44 @@
5052
5259
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5053
5260
  </xsl:choose>
5054
5261
 
5262
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5263
+ <xsl:param name="isAdded"/>
5264
+ <xsl:param name="isDeleted"/>
5265
+ <xsl:choose>
5266
+ <xsl:when test="local-name() = 'math'">
5267
+ <xsl:if test="$isAdded = 'true'">
5268
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5269
+ </xsl:if>
5270
+ <xsl:if test="$isDeleted = 'true'">
5271
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5272
+ </xsl:if>
5273
+ </xsl:when>
5274
+ <xsl:otherwise>
5275
+ <xsl:if test="$isAdded = 'true'">
5276
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5277
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5278
+ </xsl:if>
5279
+ <xsl:if test="$isDeleted = 'true'">
5280
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5281
+ <xsl:if test="local-name() = 'table'">
5282
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5283
+ </xsl:if>
5284
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5285
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5286
+ </xsl:if>
5287
+ </xsl:otherwise>
5288
+ </xsl:choose>
5289
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5290
+ <xsl:if test="$lang = 'ar'">
5291
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5292
+ </xsl:if>
5293
+ </xsl:template><xsl:template name="setAlignment">
5294
+ <xsl:param name="align" select="normalize-space(@align)"/>
5295
+ <xsl:choose>
5296
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5297
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5298
+ <xsl:when test="$align != ''">
5299
+ <xsl:value-of select="$align"/>
5300
+ </xsl:when>
5301
+ </xsl:choose>
5055
5302
  </xsl:template></xsl:stylesheet>
@@ -1110,6 +1110,7 @@
1110
1110
  </xsl:choose>
1111
1111
  </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">
1112
1112
 
1113
+
1113
1114
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1114
1115
 
1115
1116
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1450,13 +1451,25 @@
1450
1451
 
1451
1452
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1452
1453
 
1453
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1454
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1455
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1456
+ </xsl:variable><xsl:attribute-set name="add-style">
1454
1457
  <xsl:attribute name="color">red</xsl:attribute>
1455
1458
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1456
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1457
- <xsl:attribute name="color">red</xsl:attribute>
1459
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1460
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1461
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1462
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1463
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1464
+ <xsl:text>red</xsl:text>
1465
+ </xsl:variable><xsl:attribute-set name="del-style">
1466
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1458
1467
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1459
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1468
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1469
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1470
+
1471
+
1472
+ </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">
1460
1473
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1461
1474
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1462
1475
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1501,16 +1514,17 @@
1501
1514
  <xsl:call-template name="add-zero-spaces-java"/>
1502
1515
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1503
1516
 
1517
+ <xsl:variable name="table-preamble">
1518
+
1519
+
1520
+ </xsl:variable>
1521
+
1504
1522
  <xsl:variable name="table">
1505
1523
 
1506
1524
  <xsl:variable name="simple-table">
1507
1525
  <xsl:call-template name="getSimpleTable"/>
1508
1526
  </xsl:variable>
1509
1527
 
1510
-
1511
-
1512
-
1513
-
1514
1528
  <!-- <xsl:if test="$namespace = 'bipm'">
1515
1529
  <fo:block>&#xA0;</fo:block>
1516
1530
  </xsl:if> -->
@@ -1525,7 +1539,7 @@
1525
1539
 
1526
1540
 
1527
1541
 
1528
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1542
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1529
1543
 
1530
1544
  <!-- <xsl:variable name="cols-count">
1531
1545
  <xsl:choose>
@@ -1544,8 +1558,6 @@
1544
1558
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1545
1559
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1546
1560
 
1547
-
1548
-
1549
1561
  <xsl:variable name="colwidths">
1550
1562
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1551
1563
  <xsl:call-template name="calculate-column-widths">
@@ -1573,6 +1585,7 @@
1573
1585
  </xsl:choose>
1574
1586
  </xsl:variable>
1575
1587
 
1588
+
1576
1589
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1577
1590
 
1578
1591
 
@@ -1608,6 +1621,7 @@
1608
1621
 
1609
1622
 
1610
1623
 
1624
+
1611
1625
 
1612
1626
 
1613
1627
 
@@ -1700,7 +1714,8 @@
1700
1714
  </fo:block-container>
1701
1715
  </xsl:variable>
1702
1716
 
1703
-
1717
+ <xsl:variable name="isAdded" select="@added"/>
1718
+ <xsl:variable name="isDeleted" select="@deleted"/>
1704
1719
 
1705
1720
  <xsl:choose>
1706
1721
  <xsl:when test="@width">
@@ -1714,7 +1729,14 @@
1714
1729
  <fo:table-body>
1715
1730
  <fo:table-row>
1716
1731
  <fo:table-cell column-number="2">
1717
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1732
+ <xsl:copy-of select="$table-preamble"/>
1733
+ <fo:block>
1734
+ <xsl:call-template name="setTrackChangesStyles">
1735
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1736
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1737
+ </xsl:call-template>
1738
+ <xsl:copy-of select="$table"/>
1739
+ </fo:block>
1718
1740
  </fo:table-cell>
1719
1741
  </fo:table-row>
1720
1742
  </fo:table-body>
@@ -1725,7 +1747,22 @@
1725
1747
 
1726
1748
  </xsl:when>
1727
1749
  <xsl:otherwise>
1728
- <xsl:copy-of select="$table"/>
1750
+ <xsl:choose>
1751
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1752
+ <xsl:copy-of select="$table-preamble"/>
1753
+ <fo:block>
1754
+ <xsl:call-template name="setTrackChangesStyles">
1755
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1756
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1757
+ </xsl:call-template>
1758
+ <xsl:copy-of select="$table"/>
1759
+ </fo:block>
1760
+ </xsl:when>
1761
+ <xsl:otherwise>
1762
+ <xsl:copy-of select="$table-preamble"/>
1763
+ <xsl:copy-of select="$table"/>
1764
+ </xsl:otherwise>
1765
+ </xsl:choose>
1729
1766
  </xsl:otherwise>
1730
1767
  </xsl:choose>
1731
1768
 
@@ -1786,7 +1823,7 @@
1786
1823
  </xsl:for-each>
1787
1824
  </xsl:when>
1788
1825
  <xsl:otherwise>
1789
- <xsl:for-each select="xalan:nodeset($table)//tr">
1826
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1790
1827
  <xsl:variable name="td_text">
1791
1828
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1792
1829
 
@@ -2126,7 +2163,8 @@
2126
2163
  <xsl:attribute name="text-align">
2127
2164
  <xsl:choose>
2128
2165
  <xsl:when test="@align">
2129
- <xsl:value-of select="@align"/>
2166
+ <xsl:call-template name="setAlignment"/>
2167
+ <!-- <xsl:value-of select="@align"/> -->
2130
2168
  </xsl:when>
2131
2169
  <xsl:otherwise>center</xsl:otherwise>
2132
2170
  </xsl:choose>
@@ -2142,6 +2180,9 @@
2142
2180
 
2143
2181
 
2144
2182
 
2183
+ <xsl:if test="$lang = 'ar'">
2184
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2185
+ </xsl:if>
2145
2186
  <xsl:if test="@colspan">
2146
2187
  <xsl:attribute name="number-columns-spanned">
2147
2188
  <xsl:value-of select="@colspan"/>
@@ -2173,11 +2214,15 @@
2173
2214
  <xsl:attribute name="text-align">
2174
2215
  <xsl:choose>
2175
2216
  <xsl:when test="@align">
2176
- <xsl:value-of select="@align"/>
2217
+ <xsl:call-template name="setAlignment"/>
2218
+ <!-- <xsl:value-of select="@align"/> -->
2177
2219
  </xsl:when>
2178
2220
  <xsl:otherwise>left</xsl:otherwise>
2179
2221
  </xsl:choose>
2180
2222
  </xsl:attribute>
2223
+ <xsl:if test="$lang = 'ar'">
2224
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2225
+ </xsl:if>
2181
2226
  <!-- and ancestor::*[local-name() = 'thead'] -->
2182
2227
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2183
2228
 
@@ -2191,6 +2236,9 @@
2191
2236
 
2192
2237
 
2193
2238
 
2239
+ <xsl:if test=".//*[local-name() = 'table']">
2240
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2241
+ </xsl:if>
2194
2242
  <xsl:if test="@colspan">
2195
2243
  <xsl:attribute name="number-columns-spanned">
2196
2244
  <xsl:value-of select="@colspan"/>
@@ -2323,13 +2371,13 @@
2323
2371
  </xsl:choose>
2324
2372
  </xsl:variable>
2325
2373
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2326
- <xsl:element name="{$ns}:table">
2374
+ <!-- <xsl:element name="{$ns}:table"> -->
2327
2375
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2328
2376
  <tbody>
2329
2377
  <xsl:apply-templates mode="dl"/>
2330
2378
  </tbody>
2331
2379
  </xsl:for-each>
2332
- </xsl:element>
2380
+ <!-- </xsl:element> -->
2333
2381
  </xsl:variable>
2334
2382
 
2335
2383
  <xsl:call-template name="calculate-column-widths">
@@ -2420,6 +2468,8 @@
2420
2468
  <xsl:apply-templates/>
2421
2469
  </fo:inline>
2422
2470
  </xsl:template><xsl:template match="*[local-name()='dl']">
2471
+ <xsl:variable name="isAdded" select="@added"/>
2472
+ <xsl:variable name="isDeleted" select="@deleted"/>
2423
2473
  <fo:block-container>
2424
2474
 
2425
2475
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2436,6 +2486,12 @@
2436
2486
  </xsl:attribute>
2437
2487
 
2438
2488
  </xsl:if>
2489
+
2490
+ <xsl:call-template name="setTrackChangesStyles">
2491
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2492
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2493
+ </xsl:call-template>
2494
+
2439
2495
  <fo:block-container>
2440
2496
 
2441
2497
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2547,11 +2603,11 @@
2547
2603
  </xsl:choose>
2548
2604
  </xsl:variable>
2549
2605
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2550
- <xsl:element name="{$ns}:table">
2606
+ <!-- <xsl:element name="{$ns}:table"> -->
2551
2607
  <tbody>
2552
2608
  <xsl:apply-templates mode="dl"/>
2553
2609
  </tbody>
2554
- </xsl:element>
2610
+ <!-- </xsl:element> -->
2555
2611
  </xsl:variable>
2556
2612
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2557
2613
  <xsl:variable name="colwidths">
@@ -2822,9 +2878,71 @@
2822
2878
  <xsl:apply-templates/>
2823
2879
  </fo:inline>
2824
2880
  </xsl:template><xsl:template match="*[local-name()='add']">
2825
- <fo:inline xsl:use-attribute-sets="add-style">
2826
- <xsl:apply-templates/>
2827
- </fo:inline>
2881
+ <xsl:choose>
2882
+ <xsl:when test="@amendment">
2883
+ <fo:inline>
2884
+ <xsl:call-template name="insertTag">
2885
+ <xsl:with-param name="kind">A</xsl:with-param>
2886
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2887
+ </xsl:call-template>
2888
+ <xsl:apply-templates/>
2889
+ <xsl:call-template name="insertTag">
2890
+ <xsl:with-param name="type">closing</xsl:with-param>
2891
+ <xsl:with-param name="kind">A</xsl:with-param>
2892
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2893
+ </xsl:call-template>
2894
+ </fo:inline>
2895
+ </xsl:when>
2896
+ <xsl:when test="@corrigenda">
2897
+ <fo:inline>
2898
+ <xsl:call-template name="insertTag">
2899
+ <xsl:with-param name="kind">C</xsl:with-param>
2900
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2901
+ </xsl:call-template>
2902
+ <xsl:apply-templates/>
2903
+ <xsl:call-template name="insertTag">
2904
+ <xsl:with-param name="type">closing</xsl:with-param>
2905
+ <xsl:with-param name="kind">C</xsl:with-param>
2906
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2907
+ </xsl:call-template>
2908
+ </fo:inline>
2909
+ </xsl:when>
2910
+ <xsl:otherwise>
2911
+ <fo:inline xsl:use-attribute-sets="add-style">
2912
+ <xsl:apply-templates/>
2913
+ </fo:inline>
2914
+ </xsl:otherwise>
2915
+ </xsl:choose>
2916
+
2917
+ </xsl:template><xsl:template name="insertTag">
2918
+ <xsl:param name="type"/>
2919
+ <xsl:param name="kind"/>
2920
+ <xsl:param name="value"/>
2921
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2922
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2923
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2924
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2925
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2926
+ <xsl:attribute name="height">5mm</xsl:attribute>
2927
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2928
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2929
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2930
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2931
+ <g>
2932
+ <xsl:if test="$type = 'closing'">
2933
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2934
+ </xsl:if>
2935
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2936
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2937
+ </g>
2938
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2939
+ <xsl:if test="$type = 'closing'">
2940
+ <xsl:attribute name="x">25</xsl:attribute>
2941
+ </xsl:if>
2942
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2943
+ </text>
2944
+ </svg>
2945
+ </fo:instream-foreign-object>
2828
2946
  </xsl:template><xsl:template match="*[local-name()='del']">
2829
2947
  <fo:inline xsl:use-attribute-sets="del-style">
2830
2948
  <xsl:apply-templates/>
@@ -3167,13 +3285,23 @@
3167
3285
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3168
3286
  <xsl:value-of select="substring($str, 2)"/>
3169
3287
  </xsl:template><xsl:template match="mathml:math">
3170
- <fo:inline font-family="STIX Two Math"> <!-- -->
3288
+ <xsl:variable name="isAdded" select="@added"/>
3289
+ <xsl:variable name="isDeleted" select="@deleted"/>
3290
+
3291
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3292
+
3293
+
3294
+ <xsl:call-template name="setTrackChangesStyles">
3295
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3296
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3297
+ </xsl:call-template>
3171
3298
 
3172
3299
  <xsl:variable name="mathml">
3173
3300
  <xsl:apply-templates select="." mode="mathml"/>
3174
3301
  </xsl:variable>
3175
3302
  <fo:instream-foreign-object fox:alt-text="Math">
3176
3303
 
3304
+
3177
3305
  <!-- <xsl:copy-of select="."/> -->
3178
3306
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3179
3307
  </fo:instream-foreign-object>
@@ -3421,8 +3549,15 @@
3421
3549
  </fo:inline>
3422
3550
  </xsl:if>
3423
3551
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3552
+ <xsl:variable name="isAdded" select="@added"/>
3553
+ <xsl:variable name="isDeleted" select="@deleted"/>
3424
3554
  <fo:block-container id="{@id}">
3425
3555
 
3556
+ <xsl:call-template name="setTrackChangesStyles">
3557
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3558
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3559
+ </xsl:call-template>
3560
+
3426
3561
  <fo:block>
3427
3562
  <xsl:apply-templates/>
3428
3563
  </fo:block>
@@ -3442,6 +3577,8 @@
3442
3577
  <xsl:apply-templates/>
3443
3578
  </fo:block>
3444
3579
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3580
+ <xsl:variable name="isAdded" select="../@added"/>
3581
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3445
3582
  <xsl:choose>
3446
3583
  <xsl:when test="ancestor::*[local-name() = 'title']">
3447
3584
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3457,7 +3594,26 @@
3457
3594
  <xsl:variable name="src">
3458
3595
  <xsl:call-template name="image_src"/>
3459
3596
  </xsl:variable>
3460
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3597
+
3598
+ <xsl:choose>
3599
+ <xsl:when test="$isDeleted = 'true'">
3600
+ <!-- enclose in svg -->
3601
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3602
+ <xsl:attribute name="width">100%</xsl:attribute>
3603
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3604
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3605
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3606
+
3607
+
3608
+ <xsl:apply-templates select="." mode="cross_image"/>
3609
+
3610
+ </fo:instream-foreign-object>
3611
+ </xsl:when>
3612
+ <xsl:otherwise>
3613
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3614
+ </xsl:otherwise>
3615
+ </xsl:choose>
3616
+
3461
3617
  </fo:block>
3462
3618
  </xsl:otherwise>
3463
3619
  </xsl:choose>
@@ -3473,6 +3629,55 @@
3473
3629
  <xsl:value-of select="@src"/>
3474
3630
  </xsl:otherwise>
3475
3631
  </xsl:choose>
3632
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3633
+ <xsl:choose>
3634
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3635
+ <xsl:variable name="src">
3636
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3637
+ </xsl:variable>
3638
+ <xsl:variable name="width" select="document($src)/@width"/>
3639
+ <xsl:variable name="height" select="document($src)/@height"/>
3640
+ <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">
3641
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3642
+ </svg>
3643
+ </xsl:when>
3644
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3645
+ <xsl:variable name="src">
3646
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3647
+ </xsl:variable>
3648
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3649
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3650
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3651
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3652
+ <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">
3653
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3654
+ </svg>
3655
+ </xsl:when>
3656
+ <xsl:otherwise>
3657
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3658
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3659
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3660
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3661
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3662
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3663
+ <!-- width=<xsl:value-of select="$width"/> -->
3664
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3665
+ <!-- height=<xsl:value-of select="$height"/> -->
3666
+ <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">
3667
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3668
+ <xsl:call-template name="svg_cross">
3669
+ <xsl:with-param name="width" select="$width"/>
3670
+ <xsl:with-param name="height" select="$height"/>
3671
+ </xsl:call-template>
3672
+ </svg>
3673
+ </xsl:otherwise>
3674
+ </xsl:choose>
3675
+
3676
+ </xsl:template><xsl:template name="svg_cross">
3677
+ <xsl:param name="width"/>
3678
+ <xsl:param name="height"/>
3679
+ <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; "/>
3680
+ <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; "/>
3476
3681
  </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">
3477
3682
  <xsl:apply-templates mode="contents"/>
3478
3683
  <xsl:text> </xsl:text>
@@ -4015,6 +4220,7 @@
4015
4220
  <xsl:variable name="element">
4016
4221
  block
4017
4222
 
4223
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4018
4224
  </xsl:variable>
4019
4225
  <xsl:choose>
4020
4226
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4022,7 +4228,7 @@
4022
4228
  <xsl:apply-templates/>
4023
4229
  </fo:inline>
4024
4230
  </xsl:when>
4025
- <xsl:when test="normalize-space($element) = 'block'">
4231
+ <xsl:when test="contains(normalize-space($element), 'block')">
4026
4232
  <fo:block xsl:use-attribute-sets="example-name-style">
4027
4233
  <xsl:apply-templates/>
4028
4234
  </fo:block>
@@ -4245,7 +4451,8 @@
4245
4451
  </fo:inline>
4246
4452
  </xsl:when>
4247
4453
  <xsl:otherwise>
4248
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4454
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4455
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4249
4456
  </xsl:otherwise>
4250
4457
  </xsl:choose>
4251
4458
 
@@ -5052,4 +5259,44 @@
5052
5259
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5053
5260
  </xsl:choose>
5054
5261
 
5262
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5263
+ <xsl:param name="isAdded"/>
5264
+ <xsl:param name="isDeleted"/>
5265
+ <xsl:choose>
5266
+ <xsl:when test="local-name() = 'math'">
5267
+ <xsl:if test="$isAdded = 'true'">
5268
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5269
+ </xsl:if>
5270
+ <xsl:if test="$isDeleted = 'true'">
5271
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5272
+ </xsl:if>
5273
+ </xsl:when>
5274
+ <xsl:otherwise>
5275
+ <xsl:if test="$isAdded = 'true'">
5276
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5277
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5278
+ </xsl:if>
5279
+ <xsl:if test="$isDeleted = 'true'">
5280
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5281
+ <xsl:if test="local-name() = 'table'">
5282
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5283
+ </xsl:if>
5284
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5285
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5286
+ </xsl:if>
5287
+ </xsl:otherwise>
5288
+ </xsl:choose>
5289
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5290
+ <xsl:if test="$lang = 'ar'">
5291
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5292
+ </xsl:if>
5293
+ </xsl:template><xsl:template name="setAlignment">
5294
+ <xsl:param name="align" select="normalize-space(@align)"/>
5295
+ <xsl:choose>
5296
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5297
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5298
+ <xsl:when test="$align != ''">
5299
+ <xsl:value-of select="$align"/>
5300
+ </xsl:when>
5301
+ </xsl:choose>
5055
5302
  </xsl:template></xsl:stylesheet>
@@ -40,11 +40,10 @@ module IsoDoc
40
40
  i.increment(c)
41
41
  annex_names(c, i.print)
42
42
  end
43
- i = Counter.new("@")
43
+ i = Counter.new("@", skip_i: true)
44
44
  docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).
45
45
  each do |c|
46
46
  i.increment(c)
47
- i.increment(c) if i.print == "I"
48
47
  annex_names(c, i.print)
49
48
  end
50
49
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.3.0".freeze
3
+ VERSION = "0.3.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.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