metanorma-mpfa 0.6.7 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c818430af1d1598cedf9fdb864222fe07444a590c359d35395851328acd8c493
4
- data.tar.gz: 16d387bc8dae24d430ae296c260ecc0be3bf9a2fa226aada3e486bdd5624bcd6
3
+ metadata.gz: f93a2dc55dcfdcedecb16ba4c71a46de3555fc77c0ce99a30f762ea826c0a642
4
+ data.tar.gz: fd66d7cfc6b0d779f2dded521ac745b034bcee6fe84af5ac9feb7e62a4176bdf
5
5
  SHA512:
6
- metadata.gz: b367fb98cab4120873e8083476f6c7058558c0941dbd4f259055793698d56bebbb068687d70261bd764a9bfb8bc9a98ae23914537feff88dbbe05021b4a8b51a
7
- data.tar.gz: 599e33cbd382cb25ccd516deb193c48d0afebd168bcc6ea8680d4c1e01283e65f779df5e78b495d7c6ccc2743a3a5afd3b900d1751f7abf60756854a9ba84056
6
+ metadata.gz: 763bc964fafade67de9f397917324667af138bddabfa97eb4f36608db37a1791af88529a9a05945167d6037750d9977638eb23280e682e4bca1860e5fe51d290
7
+ data.tar.gz: 2ab6b1f4e0f72c2bfe057b85ad62eff54bc0667f369ae3b5abd24cbf18d2c5ac2ac8d790772ab4be6414a7850a2a739274fabb3f9db42766185a40f92fe3a209
@@ -1011,8 +1011,14 @@
1011
1011
  <ref name="imagemap"/>
1012
1012
  <ref name="svgmap"/>
1013
1013
  <ref name="inputform"/>
1014
+ <ref name="toc"/>
1014
1015
  </choice>
1015
1016
  </define>
1017
+ <define name="toc">
1018
+ <element name="toc">
1019
+ <ref name="ul"/>
1020
+ </element>
1021
+ </define>
1016
1022
  <define name="inputform">
1017
1023
  <element name="form">
1018
1024
  <attribute name="id">
@@ -1254,6 +1260,12 @@
1254
1260
  <optional>
1255
1261
  <attribute name="type"/>
1256
1262
  </optional>
1263
+ <optional>
1264
+ <attribute name="identifier"/>
1265
+ </optional>
1266
+ <optional>
1267
+ <attribute name="prefix"/>
1268
+ </optional>
1257
1269
  <text/>
1258
1270
  </define>
1259
1271
  <define name="ics">
@@ -1062,7 +1062,9 @@
1062
1062
 
1063
1063
 
1064
1064
 
1065
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1065
+ </xsl:attribute-set><xsl:variable name="table-border_">
1066
+
1067
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1066
1068
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1067
1069
 
1068
1070
 
@@ -1357,6 +1359,8 @@
1357
1359
  <fo:block>&#xA0;</fo:block>
1358
1360
  </xsl:if> -->
1359
1361
 
1362
+
1363
+ <!-- Display table's name before table as standalone block -->
1360
1364
  <!-- $namespace = 'iso' or -->
1361
1365
 
1362
1366
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1436,6 +1440,12 @@
1436
1440
 
1437
1441
 
1438
1442
 
1443
+
1444
+
1445
+
1446
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1447
+
1448
+
1439
1449
  <xsl:variable name="table_width">
1440
1450
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1441
1451
  100%
@@ -1454,6 +1464,7 @@
1454
1464
 
1455
1465
 
1456
1466
 
1467
+
1457
1468
 
1458
1469
 
1459
1470
 
@@ -1880,6 +1891,8 @@
1880
1891
  </xsl:choose>
1881
1892
  </xsl:for-each>
1882
1893
 
1894
+
1895
+
1883
1896
  <xsl:choose>
1884
1897
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1885
1898
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1916,6 +1929,7 @@
1916
1929
 
1917
1930
 
1918
1931
 
1932
+
1919
1933
  <!-- for BSI (not PAS) display Notes before footnotes -->
1920
1934
 
1921
1935
 
@@ -2001,6 +2015,8 @@
2001
2015
 
2002
2016
 
2003
2017
 
2018
+
2019
+
2004
2020
  </xsl:if>
2005
2021
  <xsl:if test="$parent-name = 'tfoot'">
2006
2022
 
@@ -2015,6 +2031,8 @@
2015
2031
 
2016
2032
 
2017
2033
 
2034
+
2035
+
2018
2036
  <!-- <xsl:if test="$namespace = 'bipm'">
2019
2037
  <xsl:attribute name="height">8mm</xsl:attribute>
2020
2038
  </xsl:if> -->
@@ -3518,7 +3536,24 @@
3518
3536
  </fo:instream-foreign-object>
3519
3537
  </xsl:when>
3520
3538
  <xsl:otherwise>
3521
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3539
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3540
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3541
+
3542
+ <xsl:variable name="img_src">
3543
+ <xsl:choose>
3544
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3545
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </xsl:variable>
3548
+
3549
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3550
+ <xsl:if test="number($scale) &lt; 100">
3551
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3552
+ </xsl:if>
3553
+
3554
+ </xsl:if>
3555
+
3556
+ </fo:external-graphic>
3522
3557
  </xsl:otherwise>
3523
3558
  </xsl:choose>
3524
3559
 
@@ -3689,11 +3724,13 @@
3689
3724
  <xsl:attribute name="width">100%</xsl:attribute>
3690
3725
  <xsl:attribute name="content-height">100%</xsl:attribute>
3691
3726
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3727
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3728
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3692
3729
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3693
3730
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3694
3731
  <!-- effective height / width = 1.48, 1.4 - with title -->
3695
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3696
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3732
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3733
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3697
3734
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3698
3735
  </xsl:if>
3699
3736
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3710,6 +3747,23 @@
3710
3747
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3711
3748
  <xsl:value-of select="."/>
3712
3749
  </xsl:attribute>
3750
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3751
+ <xsl:copy>
3752
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3753
+ <xsl:variable name="viewbox">
3754
+ <xsl:call-template name="split">
3755
+ <xsl:with-param name="pText" select="@viewBox"/>
3756
+ <xsl:with-param name="sep" select="' '"/>
3757
+ </xsl:call-template>
3758
+ </xsl:variable>
3759
+ <xsl:attribute name="width">
3760
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3761
+ </xsl:attribute>
3762
+ <xsl:attribute name="height">
3763
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3764
+ </xsl:attribute>
3765
+ <xsl:apply-templates mode="svg_update"/>
3766
+ </xsl:copy>
3713
3767
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3714
3768
  <xsl:variable name="svg_content" select="document(@src)"/>
3715
3769
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5385,20 +5439,40 @@
5385
5439
  </xsl:call-template>
5386
5440
  </xsl:if>
5387
5441
  </xsl:template><xsl:template name="getLocalizedString">
5388
- <xsl:param name="key"/>
5442
+ <xsl:param name="key"/>
5443
+ <xsl:param name="formatted">false</xsl:param>
5389
5444
 
5390
5445
  <xsl:variable name="curr_lang">
5391
5446
  <xsl:call-template name="getLang"/>
5392
5447
  </xsl:variable>
5393
5448
 
5394
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5449
+ <xsl:variable name="data_value">
5450
+ <xsl:choose>
5451
+ <xsl:when test="$formatted = 'true'">
5452
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5453
+ </xsl:when>
5454
+ <xsl:otherwise>
5455
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5456
+ </xsl:otherwise>
5457
+ </xsl:choose>
5458
+ </xsl:variable>
5395
5459
 
5396
5460
  <xsl:choose>
5397
- <xsl:when test="$data_value != ''">
5398
- <xsl:value-of select="$data_value"/>
5461
+ <xsl:when test="normalize-space($data_value) != ''">
5462
+ <xsl:choose>
5463
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5464
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5465
+ </xsl:choose>
5399
5466
  </xsl:when>
5400
5467
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5401
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5468
+ <xsl:choose>
5469
+ <xsl:when test="$formatted = 'true'">
5470
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5471
+ </xsl:when>
5472
+ <xsl:otherwise>
5473
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5474
+ </xsl:otherwise>
5475
+ </xsl:choose>
5402
5476
  </xsl:when>
5403
5477
  <xsl:otherwise>
5404
5478
  <xsl:variable name="key_">
@@ -5409,7 +5483,7 @@
5409
5483
  <xsl:value-of select="$key_"/>
5410
5484
  </xsl:otherwise>
5411
5485
  </xsl:choose>
5412
-
5486
+
5413
5487
  </xsl:template><xsl:template name="setTrackChangesStyles">
5414
5488
  <xsl:param name="isAdded"/>
5415
5489
  <xsl:param name="isDeleted"/>
@@ -1062,7 +1062,9 @@
1062
1062
 
1063
1063
 
1064
1064
 
1065
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1065
+ </xsl:attribute-set><xsl:variable name="table-border_">
1066
+
1067
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1066
1068
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1067
1069
 
1068
1070
 
@@ -1357,6 +1359,8 @@
1357
1359
  <fo:block>&#xA0;</fo:block>
1358
1360
  </xsl:if> -->
1359
1361
 
1362
+
1363
+ <!-- Display table's name before table as standalone block -->
1360
1364
  <!-- $namespace = 'iso' or -->
1361
1365
 
1362
1366
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1436,6 +1440,12 @@
1436
1440
 
1437
1441
 
1438
1442
 
1443
+
1444
+
1445
+
1446
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1447
+
1448
+
1439
1449
  <xsl:variable name="table_width">
1440
1450
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1441
1451
  100%
@@ -1454,6 +1464,7 @@
1454
1464
 
1455
1465
 
1456
1466
 
1467
+
1457
1468
 
1458
1469
 
1459
1470
 
@@ -1880,6 +1891,8 @@
1880
1891
  </xsl:choose>
1881
1892
  </xsl:for-each>
1882
1893
 
1894
+
1895
+
1883
1896
  <xsl:choose>
1884
1897
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1885
1898
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1916,6 +1929,7 @@
1916
1929
 
1917
1930
 
1918
1931
 
1932
+
1919
1933
  <!-- for BSI (not PAS) display Notes before footnotes -->
1920
1934
 
1921
1935
 
@@ -2001,6 +2015,8 @@
2001
2015
 
2002
2016
 
2003
2017
 
2018
+
2019
+
2004
2020
  </xsl:if>
2005
2021
  <xsl:if test="$parent-name = 'tfoot'">
2006
2022
 
@@ -2015,6 +2031,8 @@
2015
2031
 
2016
2032
 
2017
2033
 
2034
+
2035
+
2018
2036
  <!-- <xsl:if test="$namespace = 'bipm'">
2019
2037
  <xsl:attribute name="height">8mm</xsl:attribute>
2020
2038
  </xsl:if> -->
@@ -3518,7 +3536,24 @@
3518
3536
  </fo:instream-foreign-object>
3519
3537
  </xsl:when>
3520
3538
  <xsl:otherwise>
3521
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3539
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3540
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3541
+
3542
+ <xsl:variable name="img_src">
3543
+ <xsl:choose>
3544
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3545
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </xsl:variable>
3548
+
3549
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3550
+ <xsl:if test="number($scale) &lt; 100">
3551
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3552
+ </xsl:if>
3553
+
3554
+ </xsl:if>
3555
+
3556
+ </fo:external-graphic>
3522
3557
  </xsl:otherwise>
3523
3558
  </xsl:choose>
3524
3559
 
@@ -3689,11 +3724,13 @@
3689
3724
  <xsl:attribute name="width">100%</xsl:attribute>
3690
3725
  <xsl:attribute name="content-height">100%</xsl:attribute>
3691
3726
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3727
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3728
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3692
3729
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3693
3730
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3694
3731
  <!-- effective height / width = 1.48, 1.4 - with title -->
3695
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3696
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3732
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3733
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3697
3734
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3698
3735
  </xsl:if>
3699
3736
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3710,6 +3747,23 @@
3710
3747
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3711
3748
  <xsl:value-of select="."/>
3712
3749
  </xsl:attribute>
3750
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3751
+ <xsl:copy>
3752
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3753
+ <xsl:variable name="viewbox">
3754
+ <xsl:call-template name="split">
3755
+ <xsl:with-param name="pText" select="@viewBox"/>
3756
+ <xsl:with-param name="sep" select="' '"/>
3757
+ </xsl:call-template>
3758
+ </xsl:variable>
3759
+ <xsl:attribute name="width">
3760
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3761
+ </xsl:attribute>
3762
+ <xsl:attribute name="height">
3763
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3764
+ </xsl:attribute>
3765
+ <xsl:apply-templates mode="svg_update"/>
3766
+ </xsl:copy>
3713
3767
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3714
3768
  <xsl:variable name="svg_content" select="document(@src)"/>
3715
3769
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5385,20 +5439,40 @@
5385
5439
  </xsl:call-template>
5386
5440
  </xsl:if>
5387
5441
  </xsl:template><xsl:template name="getLocalizedString">
5388
- <xsl:param name="key"/>
5442
+ <xsl:param name="key"/>
5443
+ <xsl:param name="formatted">false</xsl:param>
5389
5444
 
5390
5445
  <xsl:variable name="curr_lang">
5391
5446
  <xsl:call-template name="getLang"/>
5392
5447
  </xsl:variable>
5393
5448
 
5394
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5449
+ <xsl:variable name="data_value">
5450
+ <xsl:choose>
5451
+ <xsl:when test="$formatted = 'true'">
5452
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5453
+ </xsl:when>
5454
+ <xsl:otherwise>
5455
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5456
+ </xsl:otherwise>
5457
+ </xsl:choose>
5458
+ </xsl:variable>
5395
5459
 
5396
5460
  <xsl:choose>
5397
- <xsl:when test="$data_value != ''">
5398
- <xsl:value-of select="$data_value"/>
5461
+ <xsl:when test="normalize-space($data_value) != ''">
5462
+ <xsl:choose>
5463
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5464
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5465
+ </xsl:choose>
5399
5466
  </xsl:when>
5400
5467
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5401
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5468
+ <xsl:choose>
5469
+ <xsl:when test="$formatted = 'true'">
5470
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5471
+ </xsl:when>
5472
+ <xsl:otherwise>
5473
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5474
+ </xsl:otherwise>
5475
+ </xsl:choose>
5402
5476
  </xsl:when>
5403
5477
  <xsl:otherwise>
5404
5478
  <xsl:variable name="key_">
@@ -5409,7 +5483,7 @@
5409
5483
  <xsl:value-of select="$key_"/>
5410
5484
  </xsl:otherwise>
5411
5485
  </xsl:choose>
5412
-
5486
+
5413
5487
  </xsl:template><xsl:template name="setTrackChangesStyles">
5414
5488
  <xsl:param name="isAdded"/>
5415
5489
  <xsl:param name="isDeleted"/>
@@ -1062,7 +1062,9 @@
1062
1062
 
1063
1063
 
1064
1064
 
1065
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1065
+ </xsl:attribute-set><xsl:variable name="table-border_">
1066
+
1067
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1066
1068
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1067
1069
 
1068
1070
 
@@ -1357,6 +1359,8 @@
1357
1359
  <fo:block>&#xA0;</fo:block>
1358
1360
  </xsl:if> -->
1359
1361
 
1362
+
1363
+ <!-- Display table's name before table as standalone block -->
1360
1364
  <!-- $namespace = 'iso' or -->
1361
1365
 
1362
1366
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1436,6 +1440,12 @@
1436
1440
 
1437
1441
 
1438
1442
 
1443
+
1444
+
1445
+
1446
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1447
+
1448
+
1439
1449
  <xsl:variable name="table_width">
1440
1450
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1441
1451
  100%
@@ -1454,6 +1464,7 @@
1454
1464
 
1455
1465
 
1456
1466
 
1467
+
1457
1468
 
1458
1469
 
1459
1470
 
@@ -1880,6 +1891,8 @@
1880
1891
  </xsl:choose>
1881
1892
  </xsl:for-each>
1882
1893
 
1894
+
1895
+
1883
1896
  <xsl:choose>
1884
1897
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1885
1898
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1916,6 +1929,7 @@
1916
1929
 
1917
1930
 
1918
1931
 
1932
+
1919
1933
  <!-- for BSI (not PAS) display Notes before footnotes -->
1920
1934
 
1921
1935
 
@@ -2001,6 +2015,8 @@
2001
2015
 
2002
2016
 
2003
2017
 
2018
+
2019
+
2004
2020
  </xsl:if>
2005
2021
  <xsl:if test="$parent-name = 'tfoot'">
2006
2022
 
@@ -2015,6 +2031,8 @@
2015
2031
 
2016
2032
 
2017
2033
 
2034
+
2035
+
2018
2036
  <!-- <xsl:if test="$namespace = 'bipm'">
2019
2037
  <xsl:attribute name="height">8mm</xsl:attribute>
2020
2038
  </xsl:if> -->
@@ -3518,7 +3536,24 @@
3518
3536
  </fo:instream-foreign-object>
3519
3537
  </xsl:when>
3520
3538
  <xsl:otherwise>
3521
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3539
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3540
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3541
+
3542
+ <xsl:variable name="img_src">
3543
+ <xsl:choose>
3544
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3545
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </xsl:variable>
3548
+
3549
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3550
+ <xsl:if test="number($scale) &lt; 100">
3551
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3552
+ </xsl:if>
3553
+
3554
+ </xsl:if>
3555
+
3556
+ </fo:external-graphic>
3522
3557
  </xsl:otherwise>
3523
3558
  </xsl:choose>
3524
3559
 
@@ -3689,11 +3724,13 @@
3689
3724
  <xsl:attribute name="width">100%</xsl:attribute>
3690
3725
  <xsl:attribute name="content-height">100%</xsl:attribute>
3691
3726
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3727
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3728
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3692
3729
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3693
3730
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3694
3731
  <!-- effective height / width = 1.48, 1.4 - with title -->
3695
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3696
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3732
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3733
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3697
3734
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3698
3735
  </xsl:if>
3699
3736
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3710,6 +3747,23 @@
3710
3747
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3711
3748
  <xsl:value-of select="."/>
3712
3749
  </xsl:attribute>
3750
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3751
+ <xsl:copy>
3752
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3753
+ <xsl:variable name="viewbox">
3754
+ <xsl:call-template name="split">
3755
+ <xsl:with-param name="pText" select="@viewBox"/>
3756
+ <xsl:with-param name="sep" select="' '"/>
3757
+ </xsl:call-template>
3758
+ </xsl:variable>
3759
+ <xsl:attribute name="width">
3760
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3761
+ </xsl:attribute>
3762
+ <xsl:attribute name="height">
3763
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3764
+ </xsl:attribute>
3765
+ <xsl:apply-templates mode="svg_update"/>
3766
+ </xsl:copy>
3713
3767
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3714
3768
  <xsl:variable name="svg_content" select="document(@src)"/>
3715
3769
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5385,20 +5439,40 @@
5385
5439
  </xsl:call-template>
5386
5440
  </xsl:if>
5387
5441
  </xsl:template><xsl:template name="getLocalizedString">
5388
- <xsl:param name="key"/>
5442
+ <xsl:param name="key"/>
5443
+ <xsl:param name="formatted">false</xsl:param>
5389
5444
 
5390
5445
  <xsl:variable name="curr_lang">
5391
5446
  <xsl:call-template name="getLang"/>
5392
5447
  </xsl:variable>
5393
5448
 
5394
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5449
+ <xsl:variable name="data_value">
5450
+ <xsl:choose>
5451
+ <xsl:when test="$formatted = 'true'">
5452
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5453
+ </xsl:when>
5454
+ <xsl:otherwise>
5455
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5456
+ </xsl:otherwise>
5457
+ </xsl:choose>
5458
+ </xsl:variable>
5395
5459
 
5396
5460
  <xsl:choose>
5397
- <xsl:when test="$data_value != ''">
5398
- <xsl:value-of select="$data_value"/>
5461
+ <xsl:when test="normalize-space($data_value) != ''">
5462
+ <xsl:choose>
5463
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5464
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5465
+ </xsl:choose>
5399
5466
  </xsl:when>
5400
5467
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5401
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5468
+ <xsl:choose>
5469
+ <xsl:when test="$formatted = 'true'">
5470
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5471
+ </xsl:when>
5472
+ <xsl:otherwise>
5473
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5474
+ </xsl:otherwise>
5475
+ </xsl:choose>
5402
5476
  </xsl:when>
5403
5477
  <xsl:otherwise>
5404
5478
  <xsl:variable name="key_">
@@ -5409,7 +5483,7 @@
5409
5483
  <xsl:value-of select="$key_"/>
5410
5484
  </xsl:otherwise>
5411
5485
  </xsl:choose>
5412
-
5486
+
5413
5487
  </xsl:template><xsl:template name="setTrackChangesStyles">
5414
5488
  <xsl:param name="isAdded"/>
5415
5489
  <xsl:param name="isDeleted"/>
@@ -1062,7 +1062,9 @@
1062
1062
 
1063
1063
 
1064
1064
 
1065
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1065
+ </xsl:attribute-set><xsl:variable name="table-border_">
1066
+
1067
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1066
1068
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1067
1069
 
1068
1070
 
@@ -1357,6 +1359,8 @@
1357
1359
  <fo:block>&#xA0;</fo:block>
1358
1360
  </xsl:if> -->
1359
1361
 
1362
+
1363
+ <!-- Display table's name before table as standalone block -->
1360
1364
  <!-- $namespace = 'iso' or -->
1361
1365
 
1362
1366
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1436,6 +1440,12 @@
1436
1440
 
1437
1441
 
1438
1442
 
1443
+
1444
+
1445
+
1446
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1447
+
1448
+
1439
1449
  <xsl:variable name="table_width">
1440
1450
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1441
1451
  100%
@@ -1454,6 +1464,7 @@
1454
1464
 
1455
1465
 
1456
1466
 
1467
+
1457
1468
 
1458
1469
 
1459
1470
 
@@ -1880,6 +1891,8 @@
1880
1891
  </xsl:choose>
1881
1892
  </xsl:for-each>
1882
1893
 
1894
+
1895
+
1883
1896
  <xsl:choose>
1884
1897
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1885
1898
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1916,6 +1929,7 @@
1916
1929
 
1917
1930
 
1918
1931
 
1932
+
1919
1933
  <!-- for BSI (not PAS) display Notes before footnotes -->
1920
1934
 
1921
1935
 
@@ -2001,6 +2015,8 @@
2001
2015
 
2002
2016
 
2003
2017
 
2018
+
2019
+
2004
2020
  </xsl:if>
2005
2021
  <xsl:if test="$parent-name = 'tfoot'">
2006
2022
 
@@ -2015,6 +2031,8 @@
2015
2031
 
2016
2032
 
2017
2033
 
2034
+
2035
+
2018
2036
  <!-- <xsl:if test="$namespace = 'bipm'">
2019
2037
  <xsl:attribute name="height">8mm</xsl:attribute>
2020
2038
  </xsl:if> -->
@@ -3518,7 +3536,24 @@
3518
3536
  </fo:instream-foreign-object>
3519
3537
  </xsl:when>
3520
3538
  <xsl:otherwise>
3521
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3539
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3540
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3541
+
3542
+ <xsl:variable name="img_src">
3543
+ <xsl:choose>
3544
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3545
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </xsl:variable>
3548
+
3549
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3550
+ <xsl:if test="number($scale) &lt; 100">
3551
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3552
+ </xsl:if>
3553
+
3554
+ </xsl:if>
3555
+
3556
+ </fo:external-graphic>
3522
3557
  </xsl:otherwise>
3523
3558
  </xsl:choose>
3524
3559
 
@@ -3689,11 +3724,13 @@
3689
3724
  <xsl:attribute name="width">100%</xsl:attribute>
3690
3725
  <xsl:attribute name="content-height">100%</xsl:attribute>
3691
3726
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3727
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3728
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3692
3729
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3693
3730
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3694
3731
  <!-- effective height / width = 1.48, 1.4 - with title -->
3695
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3696
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3732
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3733
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3697
3734
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3698
3735
  </xsl:if>
3699
3736
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3710,6 +3747,23 @@
3710
3747
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3711
3748
  <xsl:value-of select="."/>
3712
3749
  </xsl:attribute>
3750
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3751
+ <xsl:copy>
3752
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3753
+ <xsl:variable name="viewbox">
3754
+ <xsl:call-template name="split">
3755
+ <xsl:with-param name="pText" select="@viewBox"/>
3756
+ <xsl:with-param name="sep" select="' '"/>
3757
+ </xsl:call-template>
3758
+ </xsl:variable>
3759
+ <xsl:attribute name="width">
3760
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3761
+ </xsl:attribute>
3762
+ <xsl:attribute name="height">
3763
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3764
+ </xsl:attribute>
3765
+ <xsl:apply-templates mode="svg_update"/>
3766
+ </xsl:copy>
3713
3767
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3714
3768
  <xsl:variable name="svg_content" select="document(@src)"/>
3715
3769
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5385,20 +5439,40 @@
5385
5439
  </xsl:call-template>
5386
5440
  </xsl:if>
5387
5441
  </xsl:template><xsl:template name="getLocalizedString">
5388
- <xsl:param name="key"/>
5442
+ <xsl:param name="key"/>
5443
+ <xsl:param name="formatted">false</xsl:param>
5389
5444
 
5390
5445
  <xsl:variable name="curr_lang">
5391
5446
  <xsl:call-template name="getLang"/>
5392
5447
  </xsl:variable>
5393
5448
 
5394
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5449
+ <xsl:variable name="data_value">
5450
+ <xsl:choose>
5451
+ <xsl:when test="$formatted = 'true'">
5452
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5453
+ </xsl:when>
5454
+ <xsl:otherwise>
5455
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5456
+ </xsl:otherwise>
5457
+ </xsl:choose>
5458
+ </xsl:variable>
5395
5459
 
5396
5460
  <xsl:choose>
5397
- <xsl:when test="$data_value != ''">
5398
- <xsl:value-of select="$data_value"/>
5461
+ <xsl:when test="normalize-space($data_value) != ''">
5462
+ <xsl:choose>
5463
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5464
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5465
+ </xsl:choose>
5399
5466
  </xsl:when>
5400
5467
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5401
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5468
+ <xsl:choose>
5469
+ <xsl:when test="$formatted = 'true'">
5470
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5471
+ </xsl:when>
5472
+ <xsl:otherwise>
5473
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5474
+ </xsl:otherwise>
5475
+ </xsl:choose>
5402
5476
  </xsl:when>
5403
5477
  <xsl:otherwise>
5404
5478
  <xsl:variable name="key_">
@@ -5409,7 +5483,7 @@
5409
5483
  <xsl:value-of select="$key_"/>
5410
5484
  </xsl:otherwise>
5411
5485
  </xsl:choose>
5412
-
5486
+
5413
5487
  </xsl:template><xsl:template name="setTrackChangesStyles">
5414
5488
  <xsl:param name="isAdded"/>
5415
5489
  <xsl:param name="isDeleted"/>
@@ -1062,7 +1062,9 @@
1062
1062
 
1063
1063
 
1064
1064
 
1065
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1065
+ </xsl:attribute-set><xsl:variable name="table-border_">
1066
+
1067
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1066
1068
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1067
1069
 
1068
1070
 
@@ -1357,6 +1359,8 @@
1357
1359
  <fo:block>&#xA0;</fo:block>
1358
1360
  </xsl:if> -->
1359
1361
 
1362
+
1363
+ <!-- Display table's name before table as standalone block -->
1360
1364
  <!-- $namespace = 'iso' or -->
1361
1365
 
1362
1366
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1436,6 +1440,12 @@
1436
1440
 
1437
1441
 
1438
1442
 
1443
+
1444
+
1445
+
1446
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1447
+
1448
+
1439
1449
  <xsl:variable name="table_width">
1440
1450
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1441
1451
  100%
@@ -1454,6 +1464,7 @@
1454
1464
 
1455
1465
 
1456
1466
 
1467
+
1457
1468
 
1458
1469
 
1459
1470
 
@@ -1880,6 +1891,8 @@
1880
1891
  </xsl:choose>
1881
1892
  </xsl:for-each>
1882
1893
 
1894
+
1895
+
1883
1896
  <xsl:choose>
1884
1897
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1885
1898
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -1916,6 +1929,7 @@
1916
1929
 
1917
1930
 
1918
1931
 
1932
+
1919
1933
  <!-- for BSI (not PAS) display Notes before footnotes -->
1920
1934
 
1921
1935
 
@@ -2001,6 +2015,8 @@
2001
2015
 
2002
2016
 
2003
2017
 
2018
+
2019
+
2004
2020
  </xsl:if>
2005
2021
  <xsl:if test="$parent-name = 'tfoot'">
2006
2022
 
@@ -2015,6 +2031,8 @@
2015
2031
 
2016
2032
 
2017
2033
 
2034
+
2035
+
2018
2036
  <!-- <xsl:if test="$namespace = 'bipm'">
2019
2037
  <xsl:attribute name="height">8mm</xsl:attribute>
2020
2038
  </xsl:if> -->
@@ -3518,7 +3536,24 @@
3518
3536
  </fo:instream-foreign-object>
3519
3537
  </xsl:when>
3520
3538
  <xsl:otherwise>
3521
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3539
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3540
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3541
+
3542
+ <xsl:variable name="img_src">
3543
+ <xsl:choose>
3544
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3545
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </xsl:variable>
3548
+
3549
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3550
+ <xsl:if test="number($scale) &lt; 100">
3551
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3552
+ </xsl:if>
3553
+
3554
+ </xsl:if>
3555
+
3556
+ </fo:external-graphic>
3522
3557
  </xsl:otherwise>
3523
3558
  </xsl:choose>
3524
3559
 
@@ -3689,11 +3724,13 @@
3689
3724
  <xsl:attribute name="width">100%</xsl:attribute>
3690
3725
  <xsl:attribute name="content-height">100%</xsl:attribute>
3691
3726
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3727
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3728
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3692
3729
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3693
3730
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3694
3731
  <!-- effective height / width = 1.48, 1.4 - with title -->
3695
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3696
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3732
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3733
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3697
3734
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3698
3735
  </xsl:if>
3699
3736
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3710,6 +3747,23 @@
3710
3747
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3711
3748
  <xsl:value-of select="."/>
3712
3749
  </xsl:attribute>
3750
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3751
+ <xsl:copy>
3752
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3753
+ <xsl:variable name="viewbox">
3754
+ <xsl:call-template name="split">
3755
+ <xsl:with-param name="pText" select="@viewBox"/>
3756
+ <xsl:with-param name="sep" select="' '"/>
3757
+ </xsl:call-template>
3758
+ </xsl:variable>
3759
+ <xsl:attribute name="width">
3760
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3761
+ </xsl:attribute>
3762
+ <xsl:attribute name="height">
3763
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3764
+ </xsl:attribute>
3765
+ <xsl:apply-templates mode="svg_update"/>
3766
+ </xsl:copy>
3713
3767
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3714
3768
  <xsl:variable name="svg_content" select="document(@src)"/>
3715
3769
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5385,20 +5439,40 @@
5385
5439
  </xsl:call-template>
5386
5440
  </xsl:if>
5387
5441
  </xsl:template><xsl:template name="getLocalizedString">
5388
- <xsl:param name="key"/>
5442
+ <xsl:param name="key"/>
5443
+ <xsl:param name="formatted">false</xsl:param>
5389
5444
 
5390
5445
  <xsl:variable name="curr_lang">
5391
5446
  <xsl:call-template name="getLang"/>
5392
5447
  </xsl:variable>
5393
5448
 
5394
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5449
+ <xsl:variable name="data_value">
5450
+ <xsl:choose>
5451
+ <xsl:when test="$formatted = 'true'">
5452
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5453
+ </xsl:when>
5454
+ <xsl:otherwise>
5455
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5456
+ </xsl:otherwise>
5457
+ </xsl:choose>
5458
+ </xsl:variable>
5395
5459
 
5396
5460
  <xsl:choose>
5397
- <xsl:when test="$data_value != ''">
5398
- <xsl:value-of select="$data_value"/>
5461
+ <xsl:when test="normalize-space($data_value) != ''">
5462
+ <xsl:choose>
5463
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5464
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5465
+ </xsl:choose>
5399
5466
  </xsl:when>
5400
5467
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5401
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5468
+ <xsl:choose>
5469
+ <xsl:when test="$formatted = 'true'">
5470
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5471
+ </xsl:when>
5472
+ <xsl:otherwise>
5473
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5474
+ </xsl:otherwise>
5475
+ </xsl:choose>
5402
5476
  </xsl:when>
5403
5477
  <xsl:otherwise>
5404
5478
  <xsl:variable name="key_">
@@ -5409,7 +5483,7 @@
5409
5483
  <xsl:value-of select="$key_"/>
5410
5484
  </xsl:otherwise>
5411
5485
  </xsl:choose>
5412
-
5486
+
5413
5487
  </xsl:template><xsl:template name="setTrackChangesStyles">
5414
5488
  <xsl:param name="isAdded"/>
5415
5489
  <xsl:param name="isDeleted"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module MPFA
3
- VERSION = "0.6.7".freeze
3
+ VERSION = "0.6.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-mpfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
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-07-19 00:00:00.000000000 Z
11
+ date: 2021-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities