metanorma-bipm 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4342,6 +4342,7 @@
4342
4342
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
4343
4343
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
4344
4344
 
4345
+
4345
4346
  </xsl:attribute-set><xsl:attribute-set name="link-style">
4346
4347
 
4347
4348
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -4637,13 +4638,25 @@
4637
4638
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
4638
4639
 
4639
4640
 
4640
- </xsl:attribute-set><xsl:attribute-set name="add-style">
4641
+ </xsl:attribute-set><xsl:variable name="color-added-text">
4642
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
4643
+ </xsl:variable><xsl:attribute-set name="add-style">
4641
4644
  <xsl:attribute name="color">red</xsl:attribute>
4642
4645
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4643
- </xsl:attribute-set><xsl:attribute-set name="del-style">
4644
- <xsl:attribute name="color">red</xsl:attribute>
4646
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
4647
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4648
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
4649
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
4650
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
4651
+ <xsl:text>red</xsl:text>
4652
+ </xsl:variable><xsl:attribute-set name="del-style">
4653
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
4645
4654
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
4646
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
4655
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
4656
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
4657
+
4658
+
4659
+ </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">
4647
4660
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
4648
4661
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
4649
4662
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -4688,16 +4701,17 @@
4688
4701
  <xsl:call-template name="add-zero-spaces-java"/>
4689
4702
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
4690
4703
 
4704
+ <xsl:variable name="table-preamble">
4705
+
4706
+
4707
+ </xsl:variable>
4708
+
4691
4709
  <xsl:variable name="table">
4692
4710
 
4693
4711
  <xsl:variable name="simple-table">
4694
4712
  <xsl:call-template name="getSimpleTable"/>
4695
4713
  </xsl:variable>
4696
4714
 
4697
-
4698
-
4699
-
4700
-
4701
4715
  <!-- <xsl:if test="$namespace = 'bipm'">
4702
4716
  <fo:block>&#xA0;</fo:block>
4703
4717
  </xsl:if> -->
@@ -4712,7 +4726,7 @@
4712
4726
 
4713
4727
 
4714
4728
 
4715
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
4729
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
4716
4730
 
4717
4731
  <!-- <xsl:variable name="cols-count">
4718
4732
  <xsl:choose>
@@ -4731,8 +4745,6 @@
4731
4745
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
4732
4746
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
4733
4747
 
4734
-
4735
-
4736
4748
  <xsl:variable name="colwidths">
4737
4749
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4738
4750
  <xsl:call-template name="calculate-column-widths">
@@ -4760,6 +4772,7 @@
4760
4772
  </xsl:choose>
4761
4773
  </xsl:variable>
4762
4774
 
4775
+
4763
4776
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
4764
4777
 
4765
4778
 
@@ -4808,6 +4821,7 @@
4808
4821
 
4809
4822
 
4810
4823
 
4824
+
4811
4825
 
4812
4826
 
4813
4827
 
@@ -4904,7 +4918,8 @@
4904
4918
  </fo:block-container>
4905
4919
  </xsl:variable>
4906
4920
 
4907
-
4921
+ <xsl:variable name="isAdded" select="@added"/>
4922
+ <xsl:variable name="isDeleted" select="@deleted"/>
4908
4923
 
4909
4924
  <xsl:choose>
4910
4925
  <xsl:when test="@width">
@@ -4913,12 +4928,42 @@
4913
4928
 
4914
4929
 
4915
4930
 
4916
- <xsl:copy-of select="$table"/>
4931
+ <xsl:choose>
4932
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
4933
+ <xsl:copy-of select="$table-preamble"/>
4934
+ <fo:block>
4935
+ <xsl:call-template name="setTrackChangesStyles">
4936
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4937
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4938
+ </xsl:call-template>
4939
+ <xsl:copy-of select="$table"/>
4940
+ </fo:block>
4941
+ </xsl:when>
4942
+ <xsl:otherwise>
4943
+ <xsl:copy-of select="$table-preamble"/>
4944
+ <xsl:copy-of select="$table"/>
4945
+ </xsl:otherwise>
4946
+ </xsl:choose>
4917
4947
 
4918
4948
 
4919
4949
  </xsl:when>
4920
4950
  <xsl:otherwise>
4921
- <xsl:copy-of select="$table"/>
4951
+ <xsl:choose>
4952
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
4953
+ <xsl:copy-of select="$table-preamble"/>
4954
+ <fo:block>
4955
+ <xsl:call-template name="setTrackChangesStyles">
4956
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4957
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4958
+ </xsl:call-template>
4959
+ <xsl:copy-of select="$table"/>
4960
+ </fo:block>
4961
+ </xsl:when>
4962
+ <xsl:otherwise>
4963
+ <xsl:copy-of select="$table-preamble"/>
4964
+ <xsl:copy-of select="$table"/>
4965
+ </xsl:otherwise>
4966
+ </xsl:choose>
4922
4967
  </xsl:otherwise>
4923
4968
  </xsl:choose>
4924
4969
 
@@ -4986,7 +5031,7 @@
4986
5031
  </xsl:for-each>
4987
5032
  </xsl:when>
4988
5033
  <xsl:otherwise>
4989
- <xsl:for-each select="xalan:nodeset($table)//tr">
5034
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
4990
5035
  <xsl:variable name="td_text">
4991
5036
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
4992
5037
 
@@ -5347,7 +5392,8 @@
5347
5392
  <xsl:attribute name="text-align">
5348
5393
  <xsl:choose>
5349
5394
  <xsl:when test="@align">
5350
- <xsl:value-of select="@align"/>
5395
+ <xsl:call-template name="setAlignment"/>
5396
+ <!-- <xsl:value-of select="@align"/> -->
5351
5397
  </xsl:when>
5352
5398
  <xsl:otherwise>center</xsl:otherwise>
5353
5399
  </xsl:choose>
@@ -5385,6 +5431,9 @@
5385
5431
  <xsl:attribute name="display-align">before</xsl:attribute>
5386
5432
  </xsl:if>
5387
5433
 
5434
+ <xsl:if test="$lang = 'ar'">
5435
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5436
+ </xsl:if>
5388
5437
  <xsl:if test="@colspan">
5389
5438
  <xsl:attribute name="number-columns-spanned">
5390
5439
  <xsl:value-of select="@colspan"/>
@@ -5416,11 +5465,15 @@
5416
5465
  <xsl:attribute name="text-align">
5417
5466
  <xsl:choose>
5418
5467
  <xsl:when test="@align">
5419
- <xsl:value-of select="@align"/>
5468
+ <xsl:call-template name="setAlignment"/>
5469
+ <!-- <xsl:value-of select="@align"/> -->
5420
5470
  </xsl:when>
5421
5471
  <xsl:otherwise>left</xsl:otherwise>
5422
5472
  </xsl:choose>
5423
5473
  </xsl:attribute>
5474
+ <xsl:if test="$lang = 'ar'">
5475
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5476
+ </xsl:if>
5424
5477
 
5425
5478
 
5426
5479
 
@@ -5444,6 +5497,9 @@
5444
5497
  <xsl:attribute name="display-align">before</xsl:attribute>
5445
5498
  </xsl:if>
5446
5499
 
5500
+ <xsl:if test=".//*[local-name() = 'table']">
5501
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5502
+ </xsl:if>
5447
5503
  <xsl:if test="@colspan">
5448
5504
  <xsl:attribute name="number-columns-spanned">
5449
5505
  <xsl:value-of select="@colspan"/>
@@ -5602,13 +5658,13 @@
5602
5658
  </xsl:choose>
5603
5659
  </xsl:variable>
5604
5660
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
5605
- <xsl:element name="{$ns}:table">
5661
+ <!-- <xsl:element name="{$ns}:table"> -->
5606
5662
  <xsl:for-each select="*[local-name() = 'dl'][1]">
5607
5663
  <tbody>
5608
5664
  <xsl:apply-templates mode="dl"/>
5609
5665
  </tbody>
5610
5666
  </xsl:for-each>
5611
- </xsl:element>
5667
+ <!-- </xsl:element> -->
5612
5668
  </xsl:variable>
5613
5669
 
5614
5670
  <xsl:call-template name="calculate-column-widths">
@@ -5707,6 +5763,8 @@
5707
5763
  <xsl:apply-templates/>
5708
5764
  </fo:inline>
5709
5765
  </xsl:template><xsl:template match="*[local-name()='dl']">
5766
+ <xsl:variable name="isAdded" select="@added"/>
5767
+ <xsl:variable name="isDeleted" select="@deleted"/>
5710
5768
  <fo:block-container>
5711
5769
 
5712
5770
 
@@ -5726,6 +5784,12 @@
5726
5784
  </xsl:attribute>
5727
5785
 
5728
5786
  </xsl:if>
5787
+
5788
+ <xsl:call-template name="setTrackChangesStyles">
5789
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5790
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5791
+ </xsl:call-template>
5792
+
5729
5793
  <fo:block-container>
5730
5794
 
5731
5795
 
@@ -5834,11 +5898,11 @@
5834
5898
  </xsl:choose>
5835
5899
  </xsl:variable>
5836
5900
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
5837
- <xsl:element name="{$ns}:table">
5901
+ <!-- <xsl:element name="{$ns}:table"> -->
5838
5902
  <tbody>
5839
5903
  <xsl:apply-templates mode="dl"/>
5840
5904
  </tbody>
5841
- </xsl:element>
5905
+ <!-- </xsl:element> -->
5842
5906
  </xsl:variable>
5843
5907
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
5844
5908
  <xsl:variable name="colwidths">
@@ -6109,9 +6173,71 @@
6109
6173
  <xsl:apply-templates/>
6110
6174
  </fo:inline>
6111
6175
  </xsl:template><xsl:template match="*[local-name()='add']">
6112
- <fo:inline xsl:use-attribute-sets="add-style">
6113
- <xsl:apply-templates/>
6114
- </fo:inline>
6176
+ <xsl:choose>
6177
+ <xsl:when test="@amendment">
6178
+ <fo:inline>
6179
+ <xsl:call-template name="insertTag">
6180
+ <xsl:with-param name="kind">A</xsl:with-param>
6181
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
6182
+ </xsl:call-template>
6183
+ <xsl:apply-templates/>
6184
+ <xsl:call-template name="insertTag">
6185
+ <xsl:with-param name="type">closing</xsl:with-param>
6186
+ <xsl:with-param name="kind">A</xsl:with-param>
6187
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
6188
+ </xsl:call-template>
6189
+ </fo:inline>
6190
+ </xsl:when>
6191
+ <xsl:when test="@corrigenda">
6192
+ <fo:inline>
6193
+ <xsl:call-template name="insertTag">
6194
+ <xsl:with-param name="kind">C</xsl:with-param>
6195
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
6196
+ </xsl:call-template>
6197
+ <xsl:apply-templates/>
6198
+ <xsl:call-template name="insertTag">
6199
+ <xsl:with-param name="type">closing</xsl:with-param>
6200
+ <xsl:with-param name="kind">C</xsl:with-param>
6201
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
6202
+ </xsl:call-template>
6203
+ </fo:inline>
6204
+ </xsl:when>
6205
+ <xsl:otherwise>
6206
+ <fo:inline xsl:use-attribute-sets="add-style">
6207
+ <xsl:apply-templates/>
6208
+ </fo:inline>
6209
+ </xsl:otherwise>
6210
+ </xsl:choose>
6211
+
6212
+ </xsl:template><xsl:template name="insertTag">
6213
+ <xsl:param name="type"/>
6214
+ <xsl:param name="kind"/>
6215
+ <xsl:param name="value"/>
6216
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
6217
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
6218
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
6219
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
6220
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
6221
+ <xsl:attribute name="height">5mm</xsl:attribute>
6222
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6223
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6224
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6225
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
6226
+ <g>
6227
+ <xsl:if test="$type = 'closing'">
6228
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
6229
+ </xsl:if>
6230
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
6231
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
6232
+ </g>
6233
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
6234
+ <xsl:if test="$type = 'closing'">
6235
+ <xsl:attribute name="x">25</xsl:attribute>
6236
+ </xsl:if>
6237
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
6238
+ </text>
6239
+ </svg>
6240
+ </fo:instream-foreign-object>
6115
6241
  </xsl:template><xsl:template match="*[local-name()='del']">
6116
6242
  <fo:inline xsl:use-attribute-sets="del-style">
6117
6243
  <xsl:apply-templates/>
@@ -6454,12 +6580,21 @@
6454
6580
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
6455
6581
  <xsl:value-of select="substring($str, 2)"/>
6456
6582
  </xsl:template><xsl:template match="mathml:math">
6457
- <fo:inline font-family="STIX Two Math"> <!-- -->
6583
+ <xsl:variable name="isAdded" select="@added"/>
6584
+ <xsl:variable name="isDeleted" select="@deleted"/>
6585
+
6586
+ <fo:inline xsl:use-attribute-sets="mathml-style">
6458
6587
 
6459
6588
  <xsl:if test="ancestor::*[local-name()='table']">
6460
6589
  <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
6461
6590
  </xsl:if>
6462
6591
 
6592
+
6593
+ <xsl:call-template name="setTrackChangesStyles">
6594
+ <xsl:with-param name="isAdded" select="$isAdded"/>
6595
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
6596
+ </xsl:call-template>
6597
+
6463
6598
  <xsl:variable name="mathml">
6464
6599
  <xsl:apply-templates select="." mode="mathml"/>
6465
6600
  </xsl:variable>
@@ -6472,6 +6607,7 @@
6472
6607
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6473
6608
  </xsl:if>
6474
6609
 
6610
+
6475
6611
  <!-- <xsl:copy-of select="."/> -->
6476
6612
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6477
6613
  </fo:instream-foreign-object>
@@ -6726,12 +6862,19 @@
6726
6862
  </fo:inline>
6727
6863
  </xsl:if>
6728
6864
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
6865
+ <xsl:variable name="isAdded" select="@added"/>
6866
+ <xsl:variable name="isDeleted" select="@deleted"/>
6729
6867
  <fo:block-container id="{@id}">
6730
6868
 
6731
6869
  <xsl:if test="*[local-name() = 'name']">
6732
6870
  <xsl:attribute name="space-after">12pt</xsl:attribute>
6733
6871
  </xsl:if>
6734
6872
 
6873
+ <xsl:call-template name="setTrackChangesStyles">
6874
+ <xsl:with-param name="isAdded" select="$isAdded"/>
6875
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
6876
+ </xsl:call-template>
6877
+
6735
6878
  <fo:block>
6736
6879
  <xsl:apply-templates/>
6737
6880
  </fo:block>
@@ -6751,6 +6894,8 @@
6751
6894
  <xsl:apply-templates/>
6752
6895
  </fo:block>
6753
6896
  </xsl:template><xsl:template match="*[local-name() = 'image']">
6897
+ <xsl:variable name="isAdded" select="../@added"/>
6898
+ <xsl:variable name="isDeleted" select="../@deleted"/>
6754
6899
  <xsl:choose>
6755
6900
  <xsl:when test="ancestor::*[local-name() = 'title']">
6756
6901
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -6766,7 +6911,26 @@
6766
6911
  <xsl:variable name="src">
6767
6912
  <xsl:call-template name="image_src"/>
6768
6913
  </xsl:variable>
6769
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
6914
+
6915
+ <xsl:choose>
6916
+ <xsl:when test="$isDeleted = 'true'">
6917
+ <!-- enclose in svg -->
6918
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
6919
+ <xsl:attribute name="width">100%</xsl:attribute>
6920
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6921
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6922
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6923
+
6924
+
6925
+ <xsl:apply-templates select="." mode="cross_image"/>
6926
+
6927
+ </fo:instream-foreign-object>
6928
+ </xsl:when>
6929
+ <xsl:otherwise>
6930
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
6931
+ </xsl:otherwise>
6932
+ </xsl:choose>
6933
+
6770
6934
  </fo:block>
6771
6935
  </xsl:otherwise>
6772
6936
  </xsl:choose>
@@ -6782,6 +6946,55 @@
6782
6946
  <xsl:value-of select="@src"/>
6783
6947
  </xsl:otherwise>
6784
6948
  </xsl:choose>
6949
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
6950
+ <xsl:choose>
6951
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
6952
+ <xsl:variable name="src">
6953
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6954
+ </xsl:variable>
6955
+ <xsl:variable name="width" select="document($src)/@width"/>
6956
+ <xsl:variable name="height" select="document($src)/@height"/>
6957
+ <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">
6958
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
6959
+ </svg>
6960
+ </xsl:when>
6961
+ <xsl:when test="not(starts-with(@src, 'data:'))">
6962
+ <xsl:variable name="src">
6963
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6964
+ </xsl:variable>
6965
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6966
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
6967
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
6968
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
6969
+ <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">
6970
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
6971
+ </svg>
6972
+ </xsl:when>
6973
+ <xsl:otherwise>
6974
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
6975
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
6976
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
6977
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
6978
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
6979
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
6980
+ <!-- width=<xsl:value-of select="$width"/> -->
6981
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
6982
+ <!-- height=<xsl:value-of select="$height"/> -->
6983
+ <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">
6984
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
6985
+ <xsl:call-template name="svg_cross">
6986
+ <xsl:with-param name="width" select="$width"/>
6987
+ <xsl:with-param name="height" select="$height"/>
6988
+ </xsl:call-template>
6989
+ </svg>
6990
+ </xsl:otherwise>
6991
+ </xsl:choose>
6992
+
6993
+ </xsl:template><xsl:template name="svg_cross">
6994
+ <xsl:param name="width"/>
6995
+ <xsl:param name="height"/>
6996
+ <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; "/>
6997
+ <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; "/>
6785
6998
  </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">
6786
6999
  <xsl:apply-templates mode="contents"/>
6787
7000
  <xsl:text> </xsl:text>
@@ -7338,6 +7551,7 @@
7338
7551
  <xsl:variable name="element">
7339
7552
  block
7340
7553
 
7554
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
7341
7555
  </xsl:variable>
7342
7556
  <xsl:choose>
7343
7557
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -7345,7 +7559,7 @@
7345
7559
  <xsl:apply-templates/>
7346
7560
  </fo:inline>
7347
7561
  </xsl:when>
7348
- <xsl:when test="normalize-space($element) = 'block'">
7562
+ <xsl:when test="contains(normalize-space($element), 'block')">
7349
7563
  <fo:block xsl:use-attribute-sets="example-name-style">
7350
7564
  <xsl:apply-templates/>
7351
7565
  </fo:block>
@@ -7567,7 +7781,8 @@
7567
7781
  </fo:inline>
7568
7782
  </xsl:when>
7569
7783
  <xsl:otherwise>
7570
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
7784
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
7785
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
7571
7786
  </xsl:otherwise>
7572
7787
  </xsl:choose>
7573
7788
 
@@ -8307,4 +8522,44 @@
8307
8522
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
8308
8523
  </xsl:choose>
8309
8524
 
8525
+ </xsl:template><xsl:template name="setTrackChangesStyles">
8526
+ <xsl:param name="isAdded"/>
8527
+ <xsl:param name="isDeleted"/>
8528
+ <xsl:choose>
8529
+ <xsl:when test="local-name() = 'math'">
8530
+ <xsl:if test="$isAdded = 'true'">
8531
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
8532
+ </xsl:if>
8533
+ <xsl:if test="$isDeleted = 'true'">
8534
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
8535
+ </xsl:if>
8536
+ </xsl:when>
8537
+ <xsl:otherwise>
8538
+ <xsl:if test="$isAdded = 'true'">
8539
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
8540
+ <xsl:attribute name="padding">2mm</xsl:attribute>
8541
+ </xsl:if>
8542
+ <xsl:if test="$isDeleted = 'true'">
8543
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
8544
+ <xsl:if test="local-name() = 'table'">
8545
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
8546
+ </xsl:if>
8547
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
8548
+ <xsl:attribute name="padding">2mm</xsl:attribute>
8549
+ </xsl:if>
8550
+ </xsl:otherwise>
8551
+ </xsl:choose>
8552
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
8553
+ <xsl:if test="$lang = 'ar'">
8554
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
8555
+ </xsl:if>
8556
+ </xsl:template><xsl:template name="setAlignment">
8557
+ <xsl:param name="align" select="normalize-space(@align)"/>
8558
+ <xsl:choose>
8559
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
8560
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
8561
+ <xsl:when test="$align != ''">
8562
+ <xsl:value-of select="$align"/>
8563
+ </xsl:when>
8564
+ </xsl:choose>
8310
8565
  </xsl:template></xsl:stylesheet>