metanorma-bipm 1.1.5.1 → 1.1.6

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: 1427329a3b5430ce214aaffba2bd5bc18a37bae45639a8ffc41aa8e5e6666581
4
- data.tar.gz: 6e6b1dce78174ee403b82111ce3c9dbfceb5d2f839c8b9b04f0e34747a6fec42
3
+ metadata.gz: a8dff3644b6a7bc5b5b9c7ba7307fa7cf4398ac4c73eafdb421c7690d5896f71
4
+ data.tar.gz: 944cd9ec5b7dabffbbf1482fc096af46f288aac9f95391cb154b63348488e34a
5
5
  SHA512:
6
- metadata.gz: 295f0b7a2b6b633cf4062d82a7183ac6fc341cc89dc6db2581307a6a5fb0a17b56babffdbf33a7c220760f51667b92d904283f8199d5bec6faa2c6f72039a4bb
7
- data.tar.gz: a8b40bec3d815baa60f13923cb5d962c0cb702db0f9c4879b0a3c50ef2944da949a75fd881224372926f09af0c30be5a03f6572615c99d34c16b23c580cafa64
6
+ metadata.gz: 95b6ae6c56006f3d8f06501debcf646b7ee776fc6ad15ef472cfec21b66342d3f4b8c03377aa912d46e79917f32a46cd6390b1166a491a0470666d873f1607f6
7
+ data.tar.gz: e6b5bc3599137ff6141448f33378a2b5fef5711d7648f2fe5358efc9263f8947fbe24f7f4758d03ed10e1632da19520cc9ef0bcadf397e3a2b8e108196d488b2
@@ -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">
@@ -4569,7 +4569,9 @@
4569
4569
 
4570
4570
 
4571
4571
 
4572
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4572
+ </xsl:attribute-set><xsl:variable name="table-border_">
4573
+
4574
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4573
4575
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4574
4576
 
4575
4577
 
@@ -4861,6 +4863,8 @@
4861
4863
  <fo:block>&#xA0;</fo:block>
4862
4864
  </xsl:if> -->
4863
4865
 
4866
+
4867
+ <!-- Display table's name before table as standalone block -->
4864
4868
  <!-- $namespace = 'iso' or -->
4865
4869
 
4866
4870
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4948,6 +4952,12 @@
4948
4952
  </xsl:if>
4949
4953
 
4950
4954
 
4955
+
4956
+
4957
+
4958
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
4959
+
4960
+
4951
4961
  <xsl:variable name="table_width">
4952
4962
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4953
4963
 
@@ -4971,6 +4981,7 @@
4971
4981
 
4972
4982
 
4973
4983
 
4984
+
4974
4985
 
4975
4986
 
4976
4987
 
@@ -5408,6 +5419,8 @@
5408
5419
  </xsl:choose>
5409
5420
  </xsl:for-each>
5410
5421
 
5422
+
5423
+
5411
5424
  <xsl:choose>
5412
5425
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5413
5426
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5456,6 +5469,7 @@
5456
5469
 
5457
5470
 
5458
5471
 
5472
+
5459
5473
  <!-- for BSI (not PAS) display Notes before footnotes -->
5460
5474
 
5461
5475
 
@@ -5541,6 +5555,8 @@
5541
5555
 
5542
5556
 
5543
5557
 
5558
+
5559
+
5544
5560
  </xsl:if>
5545
5561
  <xsl:if test="$parent-name = 'tfoot'">
5546
5562
 
@@ -5562,6 +5578,8 @@
5562
5578
 
5563
5579
 
5564
5580
 
5581
+
5582
+
5565
5583
  <!-- <xsl:if test="$namespace = 'bipm'">
5566
5584
  <xsl:attribute name="height">8mm</xsl:attribute>
5567
5585
  </xsl:if> -->
@@ -7182,7 +7200,24 @@
7182
7200
  </fo:instream-foreign-object>
7183
7201
  </xsl:when>
7184
7202
  <xsl:otherwise>
7185
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7203
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7204
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7205
+
7206
+ <xsl:variable name="img_src">
7207
+ <xsl:choose>
7208
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7209
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7210
+ </xsl:choose>
7211
+ </xsl:variable>
7212
+
7213
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7214
+ <xsl:if test="number($scale) &lt; 100">
7215
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7216
+ </xsl:if>
7217
+
7218
+ </xsl:if>
7219
+
7220
+ </fo:external-graphic>
7186
7221
  </xsl:otherwise>
7187
7222
  </xsl:choose>
7188
7223
 
@@ -7353,11 +7388,13 @@
7353
7388
  <xsl:attribute name="width">100%</xsl:attribute>
7354
7389
  <xsl:attribute name="content-height">100%</xsl:attribute>
7355
7390
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7391
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7392
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7356
7393
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7357
7394
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7358
7395
  <!-- effective height / width = 1.48, 1.4 - with title -->
7359
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
7360
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
7396
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7397
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7361
7398
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7362
7399
  </xsl:if>
7363
7400
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -7374,6 +7411,23 @@
7374
7411
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7375
7412
  <xsl:value-of select="."/>
7376
7413
  </xsl:attribute>
7414
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7415
+ <xsl:copy>
7416
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7417
+ <xsl:variable name="viewbox">
7418
+ <xsl:call-template name="split">
7419
+ <xsl:with-param name="pText" select="@viewBox"/>
7420
+ <xsl:with-param name="sep" select="' '"/>
7421
+ </xsl:call-template>
7422
+ </xsl:variable>
7423
+ <xsl:attribute name="width">
7424
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7425
+ </xsl:attribute>
7426
+ <xsl:attribute name="height">
7427
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7428
+ </xsl:attribute>
7429
+ <xsl:apply-templates mode="svg_update"/>
7430
+ </xsl:copy>
7377
7431
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7378
7432
  <xsl:variable name="svg_content" select="document(@src)"/>
7379
7433
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9115,20 +9169,40 @@
9115
9169
  </xsl:call-template>
9116
9170
  </xsl:if>
9117
9171
  </xsl:template><xsl:template name="getLocalizedString">
9118
- <xsl:param name="key"/>
9172
+ <xsl:param name="key"/>
9173
+ <xsl:param name="formatted">false</xsl:param>
9119
9174
 
9120
9175
  <xsl:variable name="curr_lang">
9121
9176
  <xsl:call-template name="getLang"/>
9122
9177
  </xsl:variable>
9123
9178
 
9124
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9179
+ <xsl:variable name="data_value">
9180
+ <xsl:choose>
9181
+ <xsl:when test="$formatted = 'true'">
9182
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9183
+ </xsl:when>
9184
+ <xsl:otherwise>
9185
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9186
+ </xsl:otherwise>
9187
+ </xsl:choose>
9188
+ </xsl:variable>
9125
9189
 
9126
9190
  <xsl:choose>
9127
- <xsl:when test="$data_value != ''">
9128
- <xsl:value-of select="$data_value"/>
9191
+ <xsl:when test="normalize-space($data_value) != ''">
9192
+ <xsl:choose>
9193
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9194
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9195
+ </xsl:choose>
9129
9196
  </xsl:when>
9130
9197
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
9131
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9198
+ <xsl:choose>
9199
+ <xsl:when test="$formatted = 'true'">
9200
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9201
+ </xsl:when>
9202
+ <xsl:otherwise>
9203
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9204
+ </xsl:otherwise>
9205
+ </xsl:choose>
9132
9206
  </xsl:when>
9133
9207
  <xsl:otherwise>
9134
9208
  <xsl:variable name="key_">
@@ -9139,7 +9213,7 @@
9139
9213
  <xsl:value-of select="$key_"/>
9140
9214
  </xsl:otherwise>
9141
9215
  </xsl:choose>
9142
-
9216
+
9143
9217
  </xsl:template><xsl:template name="setTrackChangesStyles">
9144
9218
  <xsl:param name="isAdded"/>
9145
9219
  <xsl:param name="isDeleted"/>
@@ -4569,7 +4569,9 @@
4569
4569
 
4570
4570
 
4571
4571
 
4572
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4572
+ </xsl:attribute-set><xsl:variable name="table-border_">
4573
+
4574
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4573
4575
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4574
4576
 
4575
4577
 
@@ -4861,6 +4863,8 @@
4861
4863
  <fo:block>&#xA0;</fo:block>
4862
4864
  </xsl:if> -->
4863
4865
 
4866
+
4867
+ <!-- Display table's name before table as standalone block -->
4864
4868
  <!-- $namespace = 'iso' or -->
4865
4869
 
4866
4870
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4948,6 +4952,12 @@
4948
4952
  </xsl:if>
4949
4953
 
4950
4954
 
4955
+
4956
+
4957
+
4958
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
4959
+
4960
+
4951
4961
  <xsl:variable name="table_width">
4952
4962
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4953
4963
 
@@ -4971,6 +4981,7 @@
4971
4981
 
4972
4982
 
4973
4983
 
4984
+
4974
4985
 
4975
4986
 
4976
4987
 
@@ -5408,6 +5419,8 @@
5408
5419
  </xsl:choose>
5409
5420
  </xsl:for-each>
5410
5421
 
5422
+
5423
+
5411
5424
  <xsl:choose>
5412
5425
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5413
5426
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5456,6 +5469,7 @@
5456
5469
 
5457
5470
 
5458
5471
 
5472
+
5459
5473
  <!-- for BSI (not PAS) display Notes before footnotes -->
5460
5474
 
5461
5475
 
@@ -5541,6 +5555,8 @@
5541
5555
 
5542
5556
 
5543
5557
 
5558
+
5559
+
5544
5560
  </xsl:if>
5545
5561
  <xsl:if test="$parent-name = 'tfoot'">
5546
5562
 
@@ -5562,6 +5578,8 @@
5562
5578
 
5563
5579
 
5564
5580
 
5581
+
5582
+
5565
5583
  <!-- <xsl:if test="$namespace = 'bipm'">
5566
5584
  <xsl:attribute name="height">8mm</xsl:attribute>
5567
5585
  </xsl:if> -->
@@ -7182,7 +7200,24 @@
7182
7200
  </fo:instream-foreign-object>
7183
7201
  </xsl:when>
7184
7202
  <xsl:otherwise>
7185
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7203
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7204
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7205
+
7206
+ <xsl:variable name="img_src">
7207
+ <xsl:choose>
7208
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7209
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7210
+ </xsl:choose>
7211
+ </xsl:variable>
7212
+
7213
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7214
+ <xsl:if test="number($scale) &lt; 100">
7215
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7216
+ </xsl:if>
7217
+
7218
+ </xsl:if>
7219
+
7220
+ </fo:external-graphic>
7186
7221
  </xsl:otherwise>
7187
7222
  </xsl:choose>
7188
7223
 
@@ -7353,11 +7388,13 @@
7353
7388
  <xsl:attribute name="width">100%</xsl:attribute>
7354
7389
  <xsl:attribute name="content-height">100%</xsl:attribute>
7355
7390
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7391
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7392
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7356
7393
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7357
7394
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7358
7395
  <!-- effective height / width = 1.48, 1.4 - with title -->
7359
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
7360
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
7396
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7397
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7361
7398
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7362
7399
  </xsl:if>
7363
7400
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -7374,6 +7411,23 @@
7374
7411
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7375
7412
  <xsl:value-of select="."/>
7376
7413
  </xsl:attribute>
7414
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7415
+ <xsl:copy>
7416
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7417
+ <xsl:variable name="viewbox">
7418
+ <xsl:call-template name="split">
7419
+ <xsl:with-param name="pText" select="@viewBox"/>
7420
+ <xsl:with-param name="sep" select="' '"/>
7421
+ </xsl:call-template>
7422
+ </xsl:variable>
7423
+ <xsl:attribute name="width">
7424
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7425
+ </xsl:attribute>
7426
+ <xsl:attribute name="height">
7427
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7428
+ </xsl:attribute>
7429
+ <xsl:apply-templates mode="svg_update"/>
7430
+ </xsl:copy>
7377
7431
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7378
7432
  <xsl:variable name="svg_content" select="document(@src)"/>
7379
7433
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9115,20 +9169,40 @@
9115
9169
  </xsl:call-template>
9116
9170
  </xsl:if>
9117
9171
  </xsl:template><xsl:template name="getLocalizedString">
9118
- <xsl:param name="key"/>
9172
+ <xsl:param name="key"/>
9173
+ <xsl:param name="formatted">false</xsl:param>
9119
9174
 
9120
9175
  <xsl:variable name="curr_lang">
9121
9176
  <xsl:call-template name="getLang"/>
9122
9177
  </xsl:variable>
9123
9178
 
9124
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9179
+ <xsl:variable name="data_value">
9180
+ <xsl:choose>
9181
+ <xsl:when test="$formatted = 'true'">
9182
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9183
+ </xsl:when>
9184
+ <xsl:otherwise>
9185
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9186
+ </xsl:otherwise>
9187
+ </xsl:choose>
9188
+ </xsl:variable>
9125
9189
 
9126
9190
  <xsl:choose>
9127
- <xsl:when test="$data_value != ''">
9128
- <xsl:value-of select="$data_value"/>
9191
+ <xsl:when test="normalize-space($data_value) != ''">
9192
+ <xsl:choose>
9193
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9194
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9195
+ </xsl:choose>
9129
9196
  </xsl:when>
9130
9197
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
9131
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9198
+ <xsl:choose>
9199
+ <xsl:when test="$formatted = 'true'">
9200
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9201
+ </xsl:when>
9202
+ <xsl:otherwise>
9203
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9204
+ </xsl:otherwise>
9205
+ </xsl:choose>
9132
9206
  </xsl:when>
9133
9207
  <xsl:otherwise>
9134
9208
  <xsl:variable name="key_">
@@ -9139,7 +9213,7 @@
9139
9213
  <xsl:value-of select="$key_"/>
9140
9214
  </xsl:otherwise>
9141
9215
  </xsl:choose>
9142
-
9216
+
9143
9217
  </xsl:template><xsl:template name="setTrackChangesStyles">
9144
9218
  <xsl:param name="isAdded"/>
9145
9219
  <xsl:param name="isDeleted"/>
@@ -4569,7 +4569,9 @@
4569
4569
 
4570
4570
 
4571
4571
 
4572
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4572
+ </xsl:attribute-set><xsl:variable name="table-border_">
4573
+
4574
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4573
4575
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4574
4576
 
4575
4577
 
@@ -4861,6 +4863,8 @@
4861
4863
  <fo:block>&#xA0;</fo:block>
4862
4864
  </xsl:if> -->
4863
4865
 
4866
+
4867
+ <!-- Display table's name before table as standalone block -->
4864
4868
  <!-- $namespace = 'iso' or -->
4865
4869
 
4866
4870
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4948,6 +4952,12 @@
4948
4952
  </xsl:if>
4949
4953
 
4950
4954
 
4955
+
4956
+
4957
+
4958
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
4959
+
4960
+
4951
4961
  <xsl:variable name="table_width">
4952
4962
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4953
4963
 
@@ -4971,6 +4981,7 @@
4971
4981
 
4972
4982
 
4973
4983
 
4984
+
4974
4985
 
4975
4986
 
4976
4987
 
@@ -5408,6 +5419,8 @@
5408
5419
  </xsl:choose>
5409
5420
  </xsl:for-each>
5410
5421
 
5422
+
5423
+
5411
5424
  <xsl:choose>
5412
5425
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5413
5426
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5456,6 +5469,7 @@
5456
5469
 
5457
5470
 
5458
5471
 
5472
+
5459
5473
  <!-- for BSI (not PAS) display Notes before footnotes -->
5460
5474
 
5461
5475
 
@@ -5541,6 +5555,8 @@
5541
5555
 
5542
5556
 
5543
5557
 
5558
+
5559
+
5544
5560
  </xsl:if>
5545
5561
  <xsl:if test="$parent-name = 'tfoot'">
5546
5562
 
@@ -5562,6 +5578,8 @@
5562
5578
 
5563
5579
 
5564
5580
 
5581
+
5582
+
5565
5583
  <!-- <xsl:if test="$namespace = 'bipm'">
5566
5584
  <xsl:attribute name="height">8mm</xsl:attribute>
5567
5585
  </xsl:if> -->
@@ -7182,7 +7200,24 @@
7182
7200
  </fo:instream-foreign-object>
7183
7201
  </xsl:when>
7184
7202
  <xsl:otherwise>
7185
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7203
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7204
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7205
+
7206
+ <xsl:variable name="img_src">
7207
+ <xsl:choose>
7208
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7209
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7210
+ </xsl:choose>
7211
+ </xsl:variable>
7212
+
7213
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7214
+ <xsl:if test="number($scale) &lt; 100">
7215
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7216
+ </xsl:if>
7217
+
7218
+ </xsl:if>
7219
+
7220
+ </fo:external-graphic>
7186
7221
  </xsl:otherwise>
7187
7222
  </xsl:choose>
7188
7223
 
@@ -7353,11 +7388,13 @@
7353
7388
  <xsl:attribute name="width">100%</xsl:attribute>
7354
7389
  <xsl:attribute name="content-height">100%</xsl:attribute>
7355
7390
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7391
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7392
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7356
7393
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7357
7394
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7358
7395
  <!-- effective height / width = 1.48, 1.4 - with title -->
7359
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
7360
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
7396
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7397
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7361
7398
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7362
7399
  </xsl:if>
7363
7400
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -7374,6 +7411,23 @@
7374
7411
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7375
7412
  <xsl:value-of select="."/>
7376
7413
  </xsl:attribute>
7414
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7415
+ <xsl:copy>
7416
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7417
+ <xsl:variable name="viewbox">
7418
+ <xsl:call-template name="split">
7419
+ <xsl:with-param name="pText" select="@viewBox"/>
7420
+ <xsl:with-param name="sep" select="' '"/>
7421
+ </xsl:call-template>
7422
+ </xsl:variable>
7423
+ <xsl:attribute name="width">
7424
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7425
+ </xsl:attribute>
7426
+ <xsl:attribute name="height">
7427
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7428
+ </xsl:attribute>
7429
+ <xsl:apply-templates mode="svg_update"/>
7430
+ </xsl:copy>
7377
7431
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7378
7432
  <xsl:variable name="svg_content" select="document(@src)"/>
7379
7433
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9115,20 +9169,40 @@
9115
9169
  </xsl:call-template>
9116
9170
  </xsl:if>
9117
9171
  </xsl:template><xsl:template name="getLocalizedString">
9118
- <xsl:param name="key"/>
9172
+ <xsl:param name="key"/>
9173
+ <xsl:param name="formatted">false</xsl:param>
9119
9174
 
9120
9175
  <xsl:variable name="curr_lang">
9121
9176
  <xsl:call-template name="getLang"/>
9122
9177
  </xsl:variable>
9123
9178
 
9124
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9179
+ <xsl:variable name="data_value">
9180
+ <xsl:choose>
9181
+ <xsl:when test="$formatted = 'true'">
9182
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9183
+ </xsl:when>
9184
+ <xsl:otherwise>
9185
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9186
+ </xsl:otherwise>
9187
+ </xsl:choose>
9188
+ </xsl:variable>
9125
9189
 
9126
9190
  <xsl:choose>
9127
- <xsl:when test="$data_value != ''">
9128
- <xsl:value-of select="$data_value"/>
9191
+ <xsl:when test="normalize-space($data_value) != ''">
9192
+ <xsl:choose>
9193
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9194
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9195
+ </xsl:choose>
9129
9196
  </xsl:when>
9130
9197
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
9131
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9198
+ <xsl:choose>
9199
+ <xsl:when test="$formatted = 'true'">
9200
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9201
+ </xsl:when>
9202
+ <xsl:otherwise>
9203
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9204
+ </xsl:otherwise>
9205
+ </xsl:choose>
9132
9206
  </xsl:when>
9133
9207
  <xsl:otherwise>
9134
9208
  <xsl:variable name="key_">
@@ -9139,7 +9213,7 @@
9139
9213
  <xsl:value-of select="$key_"/>
9140
9214
  </xsl:otherwise>
9141
9215
  </xsl:choose>
9142
-
9216
+
9143
9217
  </xsl:template><xsl:template name="setTrackChangesStyles">
9144
9218
  <xsl:param name="isAdded"/>
9145
9219
  <xsl:param name="isDeleted"/>
@@ -4569,7 +4569,9 @@
4569
4569
 
4570
4570
 
4571
4571
 
4572
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4572
+ </xsl:attribute-set><xsl:variable name="table-border_">
4573
+
4574
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4573
4575
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4574
4576
 
4575
4577
 
@@ -4861,6 +4863,8 @@
4861
4863
  <fo:block>&#xA0;</fo:block>
4862
4864
  </xsl:if> -->
4863
4865
 
4866
+
4867
+ <!-- Display table's name before table as standalone block -->
4864
4868
  <!-- $namespace = 'iso' or -->
4865
4869
 
4866
4870
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4948,6 +4952,12 @@
4948
4952
  </xsl:if>
4949
4953
 
4950
4954
 
4955
+
4956
+
4957
+
4958
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
4959
+
4960
+
4951
4961
  <xsl:variable name="table_width">
4952
4962
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4953
4963
 
@@ -4971,6 +4981,7 @@
4971
4981
 
4972
4982
 
4973
4983
 
4984
+
4974
4985
 
4975
4986
 
4976
4987
 
@@ -5408,6 +5419,8 @@
5408
5419
  </xsl:choose>
5409
5420
  </xsl:for-each>
5410
5421
 
5422
+
5423
+
5411
5424
  <xsl:choose>
5412
5425
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5413
5426
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5456,6 +5469,7 @@
5456
5469
 
5457
5470
 
5458
5471
 
5472
+
5459
5473
  <!-- for BSI (not PAS) display Notes before footnotes -->
5460
5474
 
5461
5475
 
@@ -5541,6 +5555,8 @@
5541
5555
 
5542
5556
 
5543
5557
 
5558
+
5559
+
5544
5560
  </xsl:if>
5545
5561
  <xsl:if test="$parent-name = 'tfoot'">
5546
5562
 
@@ -5562,6 +5578,8 @@
5562
5578
 
5563
5579
 
5564
5580
 
5581
+
5582
+
5565
5583
  <!-- <xsl:if test="$namespace = 'bipm'">
5566
5584
  <xsl:attribute name="height">8mm</xsl:attribute>
5567
5585
  </xsl:if> -->
@@ -7182,7 +7200,24 @@
7182
7200
  </fo:instream-foreign-object>
7183
7201
  </xsl:when>
7184
7202
  <xsl:otherwise>
7185
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7203
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7204
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7205
+
7206
+ <xsl:variable name="img_src">
7207
+ <xsl:choose>
7208
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7209
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7210
+ </xsl:choose>
7211
+ </xsl:variable>
7212
+
7213
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7214
+ <xsl:if test="number($scale) &lt; 100">
7215
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7216
+ </xsl:if>
7217
+
7218
+ </xsl:if>
7219
+
7220
+ </fo:external-graphic>
7186
7221
  </xsl:otherwise>
7187
7222
  </xsl:choose>
7188
7223
 
@@ -7353,11 +7388,13 @@
7353
7388
  <xsl:attribute name="width">100%</xsl:attribute>
7354
7389
  <xsl:attribute name="content-height">100%</xsl:attribute>
7355
7390
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7391
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7392
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7356
7393
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7357
7394
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7358
7395
  <!-- effective height / width = 1.48, 1.4 - with title -->
7359
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
7360
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
7396
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7397
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7361
7398
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7362
7399
  </xsl:if>
7363
7400
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -7374,6 +7411,23 @@
7374
7411
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7375
7412
  <xsl:value-of select="."/>
7376
7413
  </xsl:attribute>
7414
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7415
+ <xsl:copy>
7416
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7417
+ <xsl:variable name="viewbox">
7418
+ <xsl:call-template name="split">
7419
+ <xsl:with-param name="pText" select="@viewBox"/>
7420
+ <xsl:with-param name="sep" select="' '"/>
7421
+ </xsl:call-template>
7422
+ </xsl:variable>
7423
+ <xsl:attribute name="width">
7424
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7425
+ </xsl:attribute>
7426
+ <xsl:attribute name="height">
7427
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7428
+ </xsl:attribute>
7429
+ <xsl:apply-templates mode="svg_update"/>
7430
+ </xsl:copy>
7377
7431
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7378
7432
  <xsl:variable name="svg_content" select="document(@src)"/>
7379
7433
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9115,20 +9169,40 @@
9115
9169
  </xsl:call-template>
9116
9170
  </xsl:if>
9117
9171
  </xsl:template><xsl:template name="getLocalizedString">
9118
- <xsl:param name="key"/>
9172
+ <xsl:param name="key"/>
9173
+ <xsl:param name="formatted">false</xsl:param>
9119
9174
 
9120
9175
  <xsl:variable name="curr_lang">
9121
9176
  <xsl:call-template name="getLang"/>
9122
9177
  </xsl:variable>
9123
9178
 
9124
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9179
+ <xsl:variable name="data_value">
9180
+ <xsl:choose>
9181
+ <xsl:when test="$formatted = 'true'">
9182
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9183
+ </xsl:when>
9184
+ <xsl:otherwise>
9185
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9186
+ </xsl:otherwise>
9187
+ </xsl:choose>
9188
+ </xsl:variable>
9125
9189
 
9126
9190
  <xsl:choose>
9127
- <xsl:when test="$data_value != ''">
9128
- <xsl:value-of select="$data_value"/>
9191
+ <xsl:when test="normalize-space($data_value) != ''">
9192
+ <xsl:choose>
9193
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9194
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9195
+ </xsl:choose>
9129
9196
  </xsl:when>
9130
9197
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
9131
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9198
+ <xsl:choose>
9199
+ <xsl:when test="$formatted = 'true'">
9200
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9201
+ </xsl:when>
9202
+ <xsl:otherwise>
9203
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9204
+ </xsl:otherwise>
9205
+ </xsl:choose>
9132
9206
  </xsl:when>
9133
9207
  <xsl:otherwise>
9134
9208
  <xsl:variable name="key_">
@@ -9139,7 +9213,7 @@
9139
9213
  <xsl:value-of select="$key_"/>
9140
9214
  </xsl:otherwise>
9141
9215
  </xsl:choose>
9142
-
9216
+
9143
9217
  </xsl:template><xsl:template name="setTrackChangesStyles">
9144
9218
  <xsl:param name="isAdded"/>
9145
9219
  <xsl:param name="isDeleted"/>
@@ -2292,7 +2292,9 @@
2292
2292
 
2293
2293
 
2294
2294
 
2295
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2295
+ </xsl:attribute-set><xsl:variable name="table-border_">
2296
+
2297
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
2296
2298
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2297
2299
 
2298
2300
 
@@ -2622,6 +2624,8 @@
2622
2624
  <fo:block>&#xA0;</fo:block>
2623
2625
  </xsl:if> -->
2624
2626
 
2627
+
2628
+ <!-- Display table's name before table as standalone block -->
2625
2629
  <!-- $namespace = 'iso' or -->
2626
2630
 
2627
2631
 
@@ -2700,6 +2704,12 @@
2700
2704
 
2701
2705
 
2702
2706
 
2707
+
2708
+
2709
+
2710
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2711
+
2712
+
2703
2713
  <xsl:variable name="table_width">
2704
2714
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2705
2715
  100%
@@ -2723,6 +2733,7 @@
2723
2733
 
2724
2734
 
2725
2735
 
2736
+
2726
2737
  <attribute name="margin-left">0mm</attribute>
2727
2738
  <attribute name="margin-right">0mm</attribute>
2728
2739
 
@@ -3164,6 +3175,8 @@
3164
3175
  </xsl:choose>
3165
3176
  </xsl:for-each>
3166
3177
 
3178
+
3179
+
3167
3180
  <xsl:choose>
3168
3181
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3169
3182
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -3202,6 +3215,7 @@
3202
3215
 
3203
3216
 
3204
3217
 
3218
+
3205
3219
  <!-- for BSI (not PAS) display Notes before footnotes -->
3206
3220
 
3207
3221
 
@@ -3278,12 +3292,17 @@
3278
3292
 
3279
3293
  <fo:table-body>
3280
3294
 
3281
- <xsl:variable name="title_continued">
3295
+ <xsl:variable name="title_continued_">
3282
3296
  <xsl:call-template name="getTitle">
3283
3297
  <xsl:with-param name="name" select="'title-continued'"/>
3284
3298
  </xsl:call-template>
3285
3299
  </xsl:variable>
3286
3300
 
3301
+ <xsl:variable name="title_continued">
3302
+ <xsl:value-of select="$title_continued_"/>
3303
+
3304
+ </xsl:variable>
3305
+
3287
3306
  <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3288
3307
  <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3289
3308
 
@@ -3339,6 +3358,8 @@
3339
3358
 
3340
3359
 
3341
3360
 
3361
+
3362
+
3342
3363
  </xsl:if>
3343
3364
  <xsl:if test="$parent-name = 'tfoot'">
3344
3365
 
@@ -3357,6 +3378,8 @@
3357
3378
 
3358
3379
 
3359
3380
 
3381
+
3382
+
3360
3383
  <!-- <xsl:if test="$namespace = 'bipm'">
3361
3384
  <xsl:attribute name="height">8mm</xsl:attribute>
3362
3385
  </xsl:if> -->
@@ -4901,7 +4924,24 @@
4901
4924
  </fo:instream-foreign-object>
4902
4925
  </xsl:when>
4903
4926
  <xsl:otherwise>
4904
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4927
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
4928
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
4929
+
4930
+ <xsl:variable name="img_src">
4931
+ <xsl:choose>
4932
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
4933
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
4934
+ </xsl:choose>
4935
+ </xsl:variable>
4936
+
4937
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
4938
+ <xsl:if test="number($scale) &lt; 100">
4939
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
4940
+ </xsl:if>
4941
+
4942
+ </xsl:if>
4943
+
4944
+ </fo:external-graphic>
4905
4945
  </xsl:otherwise>
4906
4946
  </xsl:choose>
4907
4947
 
@@ -5072,11 +5112,13 @@
5072
5112
  <xsl:attribute name="width">100%</xsl:attribute>
5073
5113
  <xsl:attribute name="content-height">100%</xsl:attribute>
5074
5114
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5115
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
5116
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
5075
5117
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5076
5118
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5077
5119
  <!-- effective height / width = 1.48, 1.4 - with title -->
5078
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
5079
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
5120
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
5121
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
5080
5122
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5081
5123
  </xsl:if>
5082
5124
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -5093,6 +5135,23 @@
5093
5135
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5094
5136
  <xsl:value-of select="."/>
5095
5137
  </xsl:attribute>
5138
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5139
+ <xsl:copy>
5140
+ <xsl:apply-templates select="@*" mode="svg_update"/>
5141
+ <xsl:variable name="viewbox">
5142
+ <xsl:call-template name="split">
5143
+ <xsl:with-param name="pText" select="@viewBox"/>
5144
+ <xsl:with-param name="sep" select="' '"/>
5145
+ </xsl:call-template>
5146
+ </xsl:variable>
5147
+ <xsl:attribute name="width">
5148
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5149
+ </xsl:attribute>
5150
+ <xsl:attribute name="height">
5151
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5152
+ </xsl:attribute>
5153
+ <xsl:apply-templates mode="svg_update"/>
5154
+ </xsl:copy>
5096
5155
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5097
5156
  <xsl:variable name="svg_content" select="document(@src)"/>
5098
5157
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6800,20 +6859,40 @@
6800
6859
  </xsl:call-template>
6801
6860
  </xsl:if>
6802
6861
  </xsl:template><xsl:template name="getLocalizedString">
6803
- <xsl:param name="key"/>
6862
+ <xsl:param name="key"/>
6863
+ <xsl:param name="formatted">false</xsl:param>
6804
6864
 
6805
6865
  <xsl:variable name="curr_lang">
6806
6866
  <xsl:call-template name="getLang"/>
6807
6867
  </xsl:variable>
6808
6868
 
6809
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6869
+ <xsl:variable name="data_value">
6870
+ <xsl:choose>
6871
+ <xsl:when test="$formatted = 'true'">
6872
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6873
+ </xsl:when>
6874
+ <xsl:otherwise>
6875
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6876
+ </xsl:otherwise>
6877
+ </xsl:choose>
6878
+ </xsl:variable>
6810
6879
 
6811
6880
  <xsl:choose>
6812
- <xsl:when test="$data_value != ''">
6813
- <xsl:value-of select="$data_value"/>
6881
+ <xsl:when test="normalize-space($data_value) != ''">
6882
+ <xsl:choose>
6883
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
6884
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
6885
+ </xsl:choose>
6814
6886
  </xsl:when>
6815
6887
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6816
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6888
+ <xsl:choose>
6889
+ <xsl:when test="$formatted = 'true'">
6890
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6891
+ </xsl:when>
6892
+ <xsl:otherwise>
6893
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6894
+ </xsl:otherwise>
6895
+ </xsl:choose>
6817
6896
  </xsl:when>
6818
6897
  <xsl:otherwise>
6819
6898
  <xsl:variable name="key_">
@@ -6824,7 +6903,7 @@
6824
6903
  <xsl:value-of select="$key_"/>
6825
6904
  </xsl:otherwise>
6826
6905
  </xsl:choose>
6827
-
6906
+
6828
6907
  </xsl:template><xsl:template name="setTrackChangesStyles">
6829
6908
  <xsl:param name="isAdded"/>
6830
6909
  <xsl:param name="isDeleted"/>
@@ -121,10 +121,9 @@ module IsoDoc
121
121
  d = xml.at(ns("//bibdata/relation[@type = 'supersedes'][#{idx}]"\
122
122
  "/bibitem")) or return ["", ""]
123
123
 
124
- date = d&.at(ns("./date"))&.text
125
124
  draft = d&.at(ns("./version/draft"))&.text and draft = "Draft #{draft}"
126
125
  edn = d&.at(ns("./edition"))&.text and edn = "Version #{edn}"
127
- [[draft, edn].join(" "), date]
126
+ [[draft, edn].join(" "), d&.at(ns("./date"))&.text]
128
127
  end
129
128
 
130
129
  def list_authors(xml)
@@ -168,7 +167,7 @@ module IsoDoc
168
167
  end
169
168
 
170
169
  def twitter_cldr_localiser_symbols
171
- { group: "&#x202F;", fraction_group: "&#x202F;",
170
+ { group: "&#xA0;", fraction_group: "&#xA0;",
172
171
  fraction_group_digits: 3 }
173
172
  end
174
173
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "1.1.5.1".freeze
3
+ VERSION = "1.1.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5.1
4
+ version: 1.1.6
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: metanorma-generic