metanorma-un 0.6.7 → 0.6.8

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: 59c6e79a616205f11022dba3a8985a1b00c345ca517ce0fc8103ac3895d94db8
4
- data.tar.gz: e57e915e2da43aad046607842a50910304f7abfec8c83fec4bbceb1cee16b092
3
+ metadata.gz: aebf3c6706cfb9ddeb3383122c3024ce95df446858775f8054c293a9906c02cc
4
+ data.tar.gz: 0d6826ce4771d8d6b5d235308026177ce41888a8dfc21349bd2b3a0aeb227a7e
5
5
  SHA512:
6
- metadata.gz: cb17eba7c97f53e5ffbfd8a61539dc39fcfdafd244e94f0fbc3e4cd31612e6b92e89f4c16aff9ee556998d4fe3044489e73cab55ebb672bb2d2ba88d98e01acd
7
- data.tar.gz: fa86c46d42de32648b54ebf6858d76309259d955d189acda2651dc5cf60c06d58dc8ea68bbcce297f8ee02e75d58077efaa65aaf7458c981b5a9fc660023514e
6
+ metadata.gz: 25c47d32f0deeddaad8160e391f5c421c6cfffc555cbaa0239682c75a3c798ea484e154ffe11d9a5696e32bbc16ab587eaec2b1bfc6ab27af470fae824481f35
7
+ data.tar.gz: d5ecc5209fee4731f50317763bff7d327bf794032ae3bef01fdddedc23ab40b6dc20a9ab281d4d86126103578a880ca8b25d8b6c6e869860e950eaa81a6f2295
@@ -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">
@@ -1379,7 +1379,9 @@
1379
1379
 
1380
1380
 
1381
1381
 
1382
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1382
+ </xsl:attribute-set><xsl:variable name="table-border_">
1383
+
1384
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1383
1385
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1384
1386
 
1385
1387
 
@@ -1679,6 +1681,8 @@
1679
1681
  <fo:block>&#xA0;</fo:block>
1680
1682
  </xsl:if> -->
1681
1683
 
1684
+
1685
+ <!-- Display table's name before table as standalone block -->
1682
1686
  <!-- $namespace = 'iso' or -->
1683
1687
 
1684
1688
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1757,6 +1761,12 @@
1757
1761
 
1758
1762
 
1759
1763
 
1764
+
1765
+
1766
+
1767
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1768
+
1769
+
1760
1770
  <xsl:variable name="table_width">
1761
1771
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1762
1772
 
@@ -1780,6 +1790,7 @@
1780
1790
 
1781
1791
 
1782
1792
 
1793
+
1783
1794
 
1784
1795
 
1785
1796
 
@@ -2202,6 +2213,8 @@
2202
2213
  </xsl:choose>
2203
2214
  </xsl:for-each>
2204
2215
 
2216
+
2217
+
2205
2218
  <xsl:choose>
2206
2219
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2207
2220
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2238,6 +2251,7 @@
2238
2251
 
2239
2252
 
2240
2253
 
2254
+
2241
2255
  <!-- for BSI (not PAS) display Notes before footnotes -->
2242
2256
 
2243
2257
 
@@ -2323,6 +2337,8 @@
2323
2337
 
2324
2338
 
2325
2339
 
2340
+
2341
+
2326
2342
  </xsl:if>
2327
2343
  <xsl:if test="$parent-name = 'tfoot'">
2328
2344
 
@@ -2341,6 +2357,8 @@
2341
2357
 
2342
2358
 
2343
2359
 
2360
+
2361
+
2344
2362
  <!-- <xsl:if test="$namespace = 'bipm'">
2345
2363
  <xsl:attribute name="height">8mm</xsl:attribute>
2346
2364
  </xsl:if> -->
@@ -3884,7 +3902,24 @@
3884
3902
  </fo:instream-foreign-object>
3885
3903
  </xsl:when>
3886
3904
  <xsl:otherwise>
3887
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3905
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3906
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3907
+
3908
+ <xsl:variable name="img_src">
3909
+ <xsl:choose>
3910
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3911
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3912
+ </xsl:choose>
3913
+ </xsl:variable>
3914
+
3915
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3916
+ <xsl:if test="number($scale) &lt; 100">
3917
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3918
+ </xsl:if>
3919
+
3920
+ </xsl:if>
3921
+
3922
+ </fo:external-graphic>
3888
3923
  </xsl:otherwise>
3889
3924
  </xsl:choose>
3890
3925
 
@@ -4055,11 +4090,13 @@
4055
4090
  <xsl:attribute name="width">100%</xsl:attribute>
4056
4091
  <xsl:attribute name="content-height">100%</xsl:attribute>
4057
4092
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4093
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4094
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4058
4095
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4059
4096
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4060
4097
  <!-- effective height / width = 1.48, 1.4 - with title -->
4061
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4062
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4098
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4099
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4063
4100
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4064
4101
  </xsl:if>
4065
4102
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4076,6 +4113,23 @@
4076
4113
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4077
4114
  <xsl:value-of select="."/>
4078
4115
  </xsl:attribute>
4116
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4117
+ <xsl:copy>
4118
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4119
+ <xsl:variable name="viewbox">
4120
+ <xsl:call-template name="split">
4121
+ <xsl:with-param name="pText" select="@viewBox"/>
4122
+ <xsl:with-param name="sep" select="' '"/>
4123
+ </xsl:call-template>
4124
+ </xsl:variable>
4125
+ <xsl:attribute name="width">
4126
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4127
+ </xsl:attribute>
4128
+ <xsl:attribute name="height">
4129
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4130
+ </xsl:attribute>
4131
+ <xsl:apply-templates mode="svg_update"/>
4132
+ </xsl:copy>
4079
4133
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4080
4134
  <xsl:variable name="svg_content" select="document(@src)"/>
4081
4135
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5766,20 +5820,40 @@
5766
5820
  </xsl:call-template>
5767
5821
  </xsl:if>
5768
5822
  </xsl:template><xsl:template name="getLocalizedString">
5769
- <xsl:param name="key"/>
5823
+ <xsl:param name="key"/>
5824
+ <xsl:param name="formatted">false</xsl:param>
5770
5825
 
5771
5826
  <xsl:variable name="curr_lang">
5772
5827
  <xsl:call-template name="getLang"/>
5773
5828
  </xsl:variable>
5774
5829
 
5775
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5830
+ <xsl:variable name="data_value">
5831
+ <xsl:choose>
5832
+ <xsl:when test="$formatted = 'true'">
5833
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5834
+ </xsl:when>
5835
+ <xsl:otherwise>
5836
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5837
+ </xsl:otherwise>
5838
+ </xsl:choose>
5839
+ </xsl:variable>
5776
5840
 
5777
5841
  <xsl:choose>
5778
- <xsl:when test="$data_value != ''">
5779
- <xsl:value-of select="$data_value"/>
5842
+ <xsl:when test="normalize-space($data_value) != ''">
5843
+ <xsl:choose>
5844
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5845
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5846
+ </xsl:choose>
5780
5847
  </xsl:when>
5781
5848
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5782
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5849
+ <xsl:choose>
5850
+ <xsl:when test="$formatted = 'true'">
5851
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5852
+ </xsl:when>
5853
+ <xsl:otherwise>
5854
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5855
+ </xsl:otherwise>
5856
+ </xsl:choose>
5783
5857
  </xsl:when>
5784
5858
  <xsl:otherwise>
5785
5859
  <xsl:variable name="key_">
@@ -5790,7 +5864,7 @@
5790
5864
  <xsl:value-of select="$key_"/>
5791
5865
  </xsl:otherwise>
5792
5866
  </xsl:choose>
5793
-
5867
+
5794
5868
  </xsl:template><xsl:template name="setTrackChangesStyles">
5795
5869
  <xsl:param name="isAdded"/>
5796
5870
  <xsl:param name="isDeleted"/>
@@ -1379,7 +1379,9 @@
1379
1379
 
1380
1380
 
1381
1381
 
1382
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1382
+ </xsl:attribute-set><xsl:variable name="table-border_">
1383
+
1384
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1383
1385
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1384
1386
 
1385
1387
 
@@ -1679,6 +1681,8 @@
1679
1681
  <fo:block>&#xA0;</fo:block>
1680
1682
  </xsl:if> -->
1681
1683
 
1684
+
1685
+ <!-- Display table's name before table as standalone block -->
1682
1686
  <!-- $namespace = 'iso' or -->
1683
1687
 
1684
1688
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1757,6 +1761,12 @@
1757
1761
 
1758
1762
 
1759
1763
 
1764
+
1765
+
1766
+
1767
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1768
+
1769
+
1760
1770
  <xsl:variable name="table_width">
1761
1771
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1762
1772
 
@@ -1780,6 +1790,7 @@
1780
1790
 
1781
1791
 
1782
1792
 
1793
+
1783
1794
 
1784
1795
 
1785
1796
 
@@ -2202,6 +2213,8 @@
2202
2213
  </xsl:choose>
2203
2214
  </xsl:for-each>
2204
2215
 
2216
+
2217
+
2205
2218
  <xsl:choose>
2206
2219
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2207
2220
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2238,6 +2251,7 @@
2238
2251
 
2239
2252
 
2240
2253
 
2254
+
2241
2255
  <!-- for BSI (not PAS) display Notes before footnotes -->
2242
2256
 
2243
2257
 
@@ -2323,6 +2337,8 @@
2323
2337
 
2324
2338
 
2325
2339
 
2340
+
2341
+
2326
2342
  </xsl:if>
2327
2343
  <xsl:if test="$parent-name = 'tfoot'">
2328
2344
 
@@ -2341,6 +2357,8 @@
2341
2357
 
2342
2358
 
2343
2359
 
2360
+
2361
+
2344
2362
  <!-- <xsl:if test="$namespace = 'bipm'">
2345
2363
  <xsl:attribute name="height">8mm</xsl:attribute>
2346
2364
  </xsl:if> -->
@@ -3884,7 +3902,24 @@
3884
3902
  </fo:instream-foreign-object>
3885
3903
  </xsl:when>
3886
3904
  <xsl:otherwise>
3887
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3905
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3906
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3907
+
3908
+ <xsl:variable name="img_src">
3909
+ <xsl:choose>
3910
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3911
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3912
+ </xsl:choose>
3913
+ </xsl:variable>
3914
+
3915
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3916
+ <xsl:if test="number($scale) &lt; 100">
3917
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3918
+ </xsl:if>
3919
+
3920
+ </xsl:if>
3921
+
3922
+ </fo:external-graphic>
3888
3923
  </xsl:otherwise>
3889
3924
  </xsl:choose>
3890
3925
 
@@ -4055,11 +4090,13 @@
4055
4090
  <xsl:attribute name="width">100%</xsl:attribute>
4056
4091
  <xsl:attribute name="content-height">100%</xsl:attribute>
4057
4092
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4093
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4094
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4058
4095
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4059
4096
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4060
4097
  <!-- effective height / width = 1.48, 1.4 - with title -->
4061
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4062
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4098
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4099
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4063
4100
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4064
4101
  </xsl:if>
4065
4102
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4076,6 +4113,23 @@
4076
4113
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4077
4114
  <xsl:value-of select="."/>
4078
4115
  </xsl:attribute>
4116
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4117
+ <xsl:copy>
4118
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4119
+ <xsl:variable name="viewbox">
4120
+ <xsl:call-template name="split">
4121
+ <xsl:with-param name="pText" select="@viewBox"/>
4122
+ <xsl:with-param name="sep" select="' '"/>
4123
+ </xsl:call-template>
4124
+ </xsl:variable>
4125
+ <xsl:attribute name="width">
4126
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4127
+ </xsl:attribute>
4128
+ <xsl:attribute name="height">
4129
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4130
+ </xsl:attribute>
4131
+ <xsl:apply-templates mode="svg_update"/>
4132
+ </xsl:copy>
4079
4133
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4080
4134
  <xsl:variable name="svg_content" select="document(@src)"/>
4081
4135
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5766,20 +5820,40 @@
5766
5820
  </xsl:call-template>
5767
5821
  </xsl:if>
5768
5822
  </xsl:template><xsl:template name="getLocalizedString">
5769
- <xsl:param name="key"/>
5823
+ <xsl:param name="key"/>
5824
+ <xsl:param name="formatted">false</xsl:param>
5770
5825
 
5771
5826
  <xsl:variable name="curr_lang">
5772
5827
  <xsl:call-template name="getLang"/>
5773
5828
  </xsl:variable>
5774
5829
 
5775
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5830
+ <xsl:variable name="data_value">
5831
+ <xsl:choose>
5832
+ <xsl:when test="$formatted = 'true'">
5833
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5834
+ </xsl:when>
5835
+ <xsl:otherwise>
5836
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5837
+ </xsl:otherwise>
5838
+ </xsl:choose>
5839
+ </xsl:variable>
5776
5840
 
5777
5841
  <xsl:choose>
5778
- <xsl:when test="$data_value != ''">
5779
- <xsl:value-of select="$data_value"/>
5842
+ <xsl:when test="normalize-space($data_value) != ''">
5843
+ <xsl:choose>
5844
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5845
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5846
+ </xsl:choose>
5780
5847
  </xsl:when>
5781
5848
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5782
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5849
+ <xsl:choose>
5850
+ <xsl:when test="$formatted = 'true'">
5851
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5852
+ </xsl:when>
5853
+ <xsl:otherwise>
5854
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5855
+ </xsl:otherwise>
5856
+ </xsl:choose>
5783
5857
  </xsl:when>
5784
5858
  <xsl:otherwise>
5785
5859
  <xsl:variable name="key_">
@@ -5790,7 +5864,7 @@
5790
5864
  <xsl:value-of select="$key_"/>
5791
5865
  </xsl:otherwise>
5792
5866
  </xsl:choose>
5793
-
5867
+
5794
5868
  </xsl:template><xsl:template name="setTrackChangesStyles">
5795
5869
  <xsl:param name="isAdded"/>
5796
5870
  <xsl:param name="isDeleted"/>
@@ -1335,7 +1335,9 @@
1335
1335
 
1336
1336
 
1337
1337
 
1338
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1338
+ </xsl:attribute-set><xsl:variable name="table-border_">
1339
+
1340
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1339
1341
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1340
1342
 
1341
1343
 
@@ -1636,6 +1638,8 @@
1636
1638
  <fo:block>&#xA0;</fo:block>
1637
1639
  </xsl:if> -->
1638
1640
 
1641
+
1642
+ <!-- Display table's name before table as standalone block -->
1639
1643
  <!-- $namespace = 'iso' or -->
1640
1644
 
1641
1645
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1716,6 +1720,12 @@
1716
1720
 
1717
1721
 
1718
1722
 
1723
+
1724
+
1725
+
1726
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1727
+
1728
+
1719
1729
  <xsl:variable name="table_width">
1720
1730
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1721
1731
 
@@ -1739,6 +1749,7 @@
1739
1749
 
1740
1750
 
1741
1751
 
1752
+
1742
1753
 
1743
1754
 
1744
1755
  <xsl:if test="ancestor::*[local-name()='sections']">
@@ -2164,6 +2175,8 @@
2164
2175
  </xsl:choose>
2165
2176
  </xsl:for-each>
2166
2177
 
2178
+
2179
+
2167
2180
  <xsl:choose>
2168
2181
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2169
2182
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2200,6 +2213,7 @@
2200
2213
 
2201
2214
 
2202
2215
 
2216
+
2203
2217
  <!-- for BSI (not PAS) display Notes before footnotes -->
2204
2218
 
2205
2219
 
@@ -2285,6 +2299,8 @@
2285
2299
 
2286
2300
 
2287
2301
 
2302
+
2303
+
2288
2304
  </xsl:if>
2289
2305
  <xsl:if test="$parent-name = 'tfoot'">
2290
2306
 
@@ -2299,6 +2315,8 @@
2299
2315
 
2300
2316
 
2301
2317
 
2318
+
2319
+
2302
2320
  <!-- <xsl:if test="$namespace = 'bipm'">
2303
2321
  <xsl:attribute name="height">8mm</xsl:attribute>
2304
2322
  </xsl:if> -->
@@ -3855,7 +3873,24 @@
3855
3873
  </fo:instream-foreign-object>
3856
3874
  </xsl:when>
3857
3875
  <xsl:otherwise>
3858
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3876
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3877
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3878
+
3879
+ <xsl:variable name="img_src">
3880
+ <xsl:choose>
3881
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3882
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3883
+ </xsl:choose>
3884
+ </xsl:variable>
3885
+
3886
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3887
+ <xsl:if test="number($scale) &lt; 100">
3888
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3889
+ </xsl:if>
3890
+
3891
+ </xsl:if>
3892
+
3893
+ </fo:external-graphic>
3859
3894
  </xsl:otherwise>
3860
3895
  </xsl:choose>
3861
3896
 
@@ -4026,11 +4061,13 @@
4026
4061
  <xsl:attribute name="width">100%</xsl:attribute>
4027
4062
  <xsl:attribute name="content-height">100%</xsl:attribute>
4028
4063
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4064
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4065
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4029
4066
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4030
4067
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4031
4068
  <!-- effective height / width = 1.48, 1.4 - with title -->
4032
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4033
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4069
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4070
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4034
4071
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4035
4072
  </xsl:if>
4036
4073
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4047,6 +4084,23 @@
4047
4084
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4048
4085
  <xsl:value-of select="."/>
4049
4086
  </xsl:attribute>
4087
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4088
+ <xsl:copy>
4089
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4090
+ <xsl:variable name="viewbox">
4091
+ <xsl:call-template name="split">
4092
+ <xsl:with-param name="pText" select="@viewBox"/>
4093
+ <xsl:with-param name="sep" select="' '"/>
4094
+ </xsl:call-template>
4095
+ </xsl:variable>
4096
+ <xsl:attribute name="width">
4097
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4098
+ </xsl:attribute>
4099
+ <xsl:attribute name="height">
4100
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4101
+ </xsl:attribute>
4102
+ <xsl:apply-templates mode="svg_update"/>
4103
+ </xsl:copy>
4050
4104
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4051
4105
  <xsl:variable name="svg_content" select="document(@src)"/>
4052
4106
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -5737,20 +5791,40 @@
5737
5791
  </xsl:call-template>
5738
5792
  </xsl:if>
5739
5793
  </xsl:template><xsl:template name="getLocalizedString">
5740
- <xsl:param name="key"/>
5794
+ <xsl:param name="key"/>
5795
+ <xsl:param name="formatted">false</xsl:param>
5741
5796
 
5742
5797
  <xsl:variable name="curr_lang">
5743
5798
  <xsl:call-template name="getLang"/>
5744
5799
  </xsl:variable>
5745
5800
 
5746
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5801
+ <xsl:variable name="data_value">
5802
+ <xsl:choose>
5803
+ <xsl:when test="$formatted = 'true'">
5804
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5805
+ </xsl:when>
5806
+ <xsl:otherwise>
5807
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5808
+ </xsl:otherwise>
5809
+ </xsl:choose>
5810
+ </xsl:variable>
5747
5811
 
5748
5812
  <xsl:choose>
5749
- <xsl:when test="$data_value != ''">
5750
- <xsl:value-of select="$data_value"/>
5813
+ <xsl:when test="normalize-space($data_value) != ''">
5814
+ <xsl:choose>
5815
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5816
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5817
+ </xsl:choose>
5751
5818
  </xsl:when>
5752
5819
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5753
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5820
+ <xsl:choose>
5821
+ <xsl:when test="$formatted = 'true'">
5822
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5823
+ </xsl:when>
5824
+ <xsl:otherwise>
5825
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5826
+ </xsl:otherwise>
5827
+ </xsl:choose>
5754
5828
  </xsl:when>
5755
5829
  <xsl:otherwise>
5756
5830
  <xsl:variable name="key_">
@@ -5761,7 +5835,7 @@
5761
5835
  <xsl:value-of select="$key_"/>
5762
5836
  </xsl:otherwise>
5763
5837
  </xsl:choose>
5764
-
5838
+
5765
5839
  </xsl:template><xsl:template name="setTrackChangesStyles">
5766
5840
  <xsl:param name="isAdded"/>
5767
5841
  <xsl:param name="isDeleted"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
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-un
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: iso-639