metanorma-bipm 2.4.3 → 2.4.4

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: c92b447fed05f3f1010833af20204d74e0efa7581976afe50e21d23a1099485d
4
- data.tar.gz: 84930ea5876e5b440e19223c31d6155511f2834a65063f0117bee76715c86dbb
3
+ metadata.gz: 693a79fe3066d124cb0226ff82cf600b6b47a8986b44843083d2824a54063f7f
4
+ data.tar.gz: f9065687627ca7e3b72853c6c83f7c0dcc898aba12f14d9da2834834281acae8
5
5
  SHA512:
6
- metadata.gz: fed5df6db6cb68cf1f811fff0334fc4d482b1f3afd17d7e737224dd8d547a431c834ee5803305683aeedddd84215f954699d6a1da80f062d6b8b2910a8bff7e6
7
- data.tar.gz: 98fa8882dfcd832a9331267163c48c0a4df869935443229dfc35407679a932aaa8065f1a4cf3aff9a75217c4cedd67e668be620ce056e4a514a8b599bb6eef1b
6
+ metadata.gz: 4d2afdb9c0d1e7c6790095779a4a108c3f3074f9500d981a2db627ec165f6c344b7f125d594a8f78f56959710b2229e4dcb90e2fdc52c04af89b8768c84099b6
7
+ data.tar.gz: 4d14063b8db9d5b3ed3a9548c8e68623684a91a63dbbb790dcfa2e3f3aa945685ac85f823f356d19963077397ea28b7e6108481837475a382055f9602e6b0716
@@ -8232,7 +8232,8 @@
8232
8232
  </xsl:template>
8233
8233
 
8234
8234
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8235
- <xsl:variable name="text" select="normalize-space(.)"/>
8235
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8236
+ <xsl:variable name="text" select="."/>
8236
8237
  <fo:inline font-size="75%" role="SKIP">
8237
8238
  <xsl:if test="string-length($text) &gt; 0">
8238
8239
  <xsl:variable name="smallCapsText">
@@ -10420,16 +10421,44 @@
10420
10421
  </xsl:choose>
10421
10422
 
10422
10423
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10423
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10424
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10424
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10425
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10426
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10427
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10428
+
10429
+ <!-- Example: -->
10425
10430
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10426
10431
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10427
10432
  <!-- effective height / width = 1.48, 1.4 - with title -->
10428
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10433
+
10434
+ <xsl:variable name="scale_x">
10435
+ <xsl:choose>
10436
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10437
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10438
+ </xsl:when>
10439
+ <xsl:otherwise>1</xsl:otherwise>
10440
+ </xsl:choose>
10441
+ </xsl:variable>
10442
+ <xsl:variable name="scale_y">
10443
+ <xsl:choose>
10444
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10445
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10446
+ </xsl:when>
10447
+ <xsl:otherwise>1</xsl:otherwise>
10448
+ </xsl:choose>
10449
+ </xsl:variable>
10450
+
10451
+ <!-- for images with big height -->
10452
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10429
10453
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10430
10454
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10431
- </xsl:if>
10455
+ </xsl:if> -->
10432
10456
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10457
+
10458
+ <xsl:if test="$scale_y != 1">
10459
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10460
+ </xsl:if>
10461
+
10433
10462
  <xsl:copy-of select="$svg_content"/>
10434
10463
  </fo:instream-foreign-object>
10435
10464
  <!-- </fo:block> -->
@@ -10467,8 +10496,12 @@
10467
10496
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10468
10497
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10469
10498
 
10499
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10500
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10501
+
10470
10502
  <xsl:attribute name="width">
10471
10503
  <xsl:choose>
10504
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10472
10505
  <xsl:when test="$width != ''">
10473
10506
  <xsl:value-of select="round($width)"/>
10474
10507
  </xsl:when>
@@ -10477,6 +10510,7 @@
10477
10510
  </xsl:attribute>
10478
10511
  <xsl:attribute name="height">
10479
10512
  <xsl:choose>
10513
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10480
10514
  <xsl:when test="$height != ''">
10481
10515
  <xsl:value-of select="round($height)"/>
10482
10516
  </xsl:when>
@@ -10488,6 +10522,28 @@
10488
10522
  </xsl:copy>
10489
10523
  </xsl:template>
10490
10524
 
10525
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10526
+ <!-- image[@width]/svg -->
10527
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10528
+ <xsl:attribute name="width">
10529
+ <xsl:choose>
10530
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10531
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10532
+ </xsl:choose>
10533
+ </xsl:attribute>
10534
+ </xsl:template>
10535
+
10536
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10537
+ <!-- image[@height]/svg -->
10538
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10539
+ <xsl:attribute name="height">
10540
+ <xsl:choose>
10541
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10542
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10543
+ </xsl:choose>
10544
+ </xsl:attribute>
10545
+ </xsl:template>
10546
+
10491
10547
  <!-- regex for 'display: inline-block;' -->
10492
10548
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10493
10549
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12572,7 +12628,9 @@
12572
12628
  </xsl:template> <!-- sections_element_style -->
12573
12629
 
12574
12630
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12575
- <fo:block break-after="page"/>
12631
+
12632
+ <fo:block break-after="page"/>
12633
+
12576
12634
  <fo:block>
12577
12635
  <xsl:call-template name="setId"/>
12578
12636
  <xsl:apply-templates/>
@@ -12641,7 +12699,7 @@
12641
12699
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12642
12700
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12643
12701
  </xsl:when>
12644
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12702
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12645
12703
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12646
12704
  </xsl:when>
12647
12705
  </xsl:choose>
@@ -8232,7 +8232,8 @@
8232
8232
  </xsl:template>
8233
8233
 
8234
8234
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8235
- <xsl:variable name="text" select="normalize-space(.)"/>
8235
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8236
+ <xsl:variable name="text" select="."/>
8236
8237
  <fo:inline font-size="75%" role="SKIP">
8237
8238
  <xsl:if test="string-length($text) &gt; 0">
8238
8239
  <xsl:variable name="smallCapsText">
@@ -10420,16 +10421,44 @@
10420
10421
  </xsl:choose>
10421
10422
 
10422
10423
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10423
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10424
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10424
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10425
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10426
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10427
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10428
+
10429
+ <!-- Example: -->
10425
10430
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10426
10431
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10427
10432
  <!-- effective height / width = 1.48, 1.4 - with title -->
10428
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10433
+
10434
+ <xsl:variable name="scale_x">
10435
+ <xsl:choose>
10436
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10437
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10438
+ </xsl:when>
10439
+ <xsl:otherwise>1</xsl:otherwise>
10440
+ </xsl:choose>
10441
+ </xsl:variable>
10442
+ <xsl:variable name="scale_y">
10443
+ <xsl:choose>
10444
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10445
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10446
+ </xsl:when>
10447
+ <xsl:otherwise>1</xsl:otherwise>
10448
+ </xsl:choose>
10449
+ </xsl:variable>
10450
+
10451
+ <!-- for images with big height -->
10452
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10429
10453
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10430
10454
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10431
- </xsl:if>
10455
+ </xsl:if> -->
10432
10456
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10457
+
10458
+ <xsl:if test="$scale_y != 1">
10459
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10460
+ </xsl:if>
10461
+
10433
10462
  <xsl:copy-of select="$svg_content"/>
10434
10463
  </fo:instream-foreign-object>
10435
10464
  <!-- </fo:block> -->
@@ -10467,8 +10496,12 @@
10467
10496
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10468
10497
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10469
10498
 
10499
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10500
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10501
+
10470
10502
  <xsl:attribute name="width">
10471
10503
  <xsl:choose>
10504
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10472
10505
  <xsl:when test="$width != ''">
10473
10506
  <xsl:value-of select="round($width)"/>
10474
10507
  </xsl:when>
@@ -10477,6 +10510,7 @@
10477
10510
  </xsl:attribute>
10478
10511
  <xsl:attribute name="height">
10479
10512
  <xsl:choose>
10513
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10480
10514
  <xsl:when test="$height != ''">
10481
10515
  <xsl:value-of select="round($height)"/>
10482
10516
  </xsl:when>
@@ -10488,6 +10522,28 @@
10488
10522
  </xsl:copy>
10489
10523
  </xsl:template>
10490
10524
 
10525
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10526
+ <!-- image[@width]/svg -->
10527
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10528
+ <xsl:attribute name="width">
10529
+ <xsl:choose>
10530
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10531
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10532
+ </xsl:choose>
10533
+ </xsl:attribute>
10534
+ </xsl:template>
10535
+
10536
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10537
+ <!-- image[@height]/svg -->
10538
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10539
+ <xsl:attribute name="height">
10540
+ <xsl:choose>
10541
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10542
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10543
+ </xsl:choose>
10544
+ </xsl:attribute>
10545
+ </xsl:template>
10546
+
10491
10547
  <!-- regex for 'display: inline-block;' -->
10492
10548
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10493
10549
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12572,7 +12628,9 @@
12572
12628
  </xsl:template> <!-- sections_element_style -->
12573
12629
 
12574
12630
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12575
- <fo:block break-after="page"/>
12631
+
12632
+ <fo:block break-after="page"/>
12633
+
12576
12634
  <fo:block>
12577
12635
  <xsl:call-template name="setId"/>
12578
12636
  <xsl:apply-templates/>
@@ -12641,7 +12699,7 @@
12641
12699
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12642
12700
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12643
12701
  </xsl:when>
12644
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12702
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12645
12703
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12646
12704
  </xsl:when>
12647
12705
  </xsl:choose>
@@ -8232,7 +8232,8 @@
8232
8232
  </xsl:template>
8233
8233
 
8234
8234
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8235
- <xsl:variable name="text" select="normalize-space(.)"/>
8235
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8236
+ <xsl:variable name="text" select="."/>
8236
8237
  <fo:inline font-size="75%" role="SKIP">
8237
8238
  <xsl:if test="string-length($text) &gt; 0">
8238
8239
  <xsl:variable name="smallCapsText">
@@ -10420,16 +10421,44 @@
10420
10421
  </xsl:choose>
10421
10422
 
10422
10423
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10423
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10424
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10424
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10425
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10426
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10427
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10428
+
10429
+ <!-- Example: -->
10425
10430
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10426
10431
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10427
10432
  <!-- effective height / width = 1.48, 1.4 - with title -->
10428
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10433
+
10434
+ <xsl:variable name="scale_x">
10435
+ <xsl:choose>
10436
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10437
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10438
+ </xsl:when>
10439
+ <xsl:otherwise>1</xsl:otherwise>
10440
+ </xsl:choose>
10441
+ </xsl:variable>
10442
+ <xsl:variable name="scale_y">
10443
+ <xsl:choose>
10444
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10445
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10446
+ </xsl:when>
10447
+ <xsl:otherwise>1</xsl:otherwise>
10448
+ </xsl:choose>
10449
+ </xsl:variable>
10450
+
10451
+ <!-- for images with big height -->
10452
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10429
10453
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10430
10454
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10431
- </xsl:if>
10455
+ </xsl:if> -->
10432
10456
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10457
+
10458
+ <xsl:if test="$scale_y != 1">
10459
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10460
+ </xsl:if>
10461
+
10433
10462
  <xsl:copy-of select="$svg_content"/>
10434
10463
  </fo:instream-foreign-object>
10435
10464
  <!-- </fo:block> -->
@@ -10467,8 +10496,12 @@
10467
10496
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10468
10497
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10469
10498
 
10499
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10500
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10501
+
10470
10502
  <xsl:attribute name="width">
10471
10503
  <xsl:choose>
10504
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10472
10505
  <xsl:when test="$width != ''">
10473
10506
  <xsl:value-of select="round($width)"/>
10474
10507
  </xsl:when>
@@ -10477,6 +10510,7 @@
10477
10510
  </xsl:attribute>
10478
10511
  <xsl:attribute name="height">
10479
10512
  <xsl:choose>
10513
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10480
10514
  <xsl:when test="$height != ''">
10481
10515
  <xsl:value-of select="round($height)"/>
10482
10516
  </xsl:when>
@@ -10488,6 +10522,28 @@
10488
10522
  </xsl:copy>
10489
10523
  </xsl:template>
10490
10524
 
10525
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10526
+ <!-- image[@width]/svg -->
10527
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10528
+ <xsl:attribute name="width">
10529
+ <xsl:choose>
10530
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10531
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10532
+ </xsl:choose>
10533
+ </xsl:attribute>
10534
+ </xsl:template>
10535
+
10536
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10537
+ <!-- image[@height]/svg -->
10538
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10539
+ <xsl:attribute name="height">
10540
+ <xsl:choose>
10541
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10542
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10543
+ </xsl:choose>
10544
+ </xsl:attribute>
10545
+ </xsl:template>
10546
+
10491
10547
  <!-- regex for 'display: inline-block;' -->
10492
10548
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10493
10549
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12572,7 +12628,9 @@
12572
12628
  </xsl:template> <!-- sections_element_style -->
12573
12629
 
12574
12630
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12575
- <fo:block break-after="page"/>
12631
+
12632
+ <fo:block break-after="page"/>
12633
+
12576
12634
  <fo:block>
12577
12635
  <xsl:call-template name="setId"/>
12578
12636
  <xsl:apply-templates/>
@@ -12641,7 +12699,7 @@
12641
12699
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12642
12700
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12643
12701
  </xsl:when>
12644
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12702
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12645
12703
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12646
12704
  </xsl:when>
12647
12705
  </xsl:choose>
@@ -8232,7 +8232,8 @@
8232
8232
  </xsl:template>
8233
8233
 
8234
8234
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8235
- <xsl:variable name="text" select="normalize-space(.)"/>
8235
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8236
+ <xsl:variable name="text" select="."/>
8236
8237
  <fo:inline font-size="75%" role="SKIP">
8237
8238
  <xsl:if test="string-length($text) &gt; 0">
8238
8239
  <xsl:variable name="smallCapsText">
@@ -10420,16 +10421,44 @@
10420
10421
  </xsl:choose>
10421
10422
 
10422
10423
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10423
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10424
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10424
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10425
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10426
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10427
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10428
+
10429
+ <!-- Example: -->
10425
10430
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10426
10431
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10427
10432
  <!-- effective height / width = 1.48, 1.4 - with title -->
10428
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10433
+
10434
+ <xsl:variable name="scale_x">
10435
+ <xsl:choose>
10436
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10437
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10438
+ </xsl:when>
10439
+ <xsl:otherwise>1</xsl:otherwise>
10440
+ </xsl:choose>
10441
+ </xsl:variable>
10442
+ <xsl:variable name="scale_y">
10443
+ <xsl:choose>
10444
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10445
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10446
+ </xsl:when>
10447
+ <xsl:otherwise>1</xsl:otherwise>
10448
+ </xsl:choose>
10449
+ </xsl:variable>
10450
+
10451
+ <!-- for images with big height -->
10452
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10429
10453
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10430
10454
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10431
- </xsl:if>
10455
+ </xsl:if> -->
10432
10456
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10457
+
10458
+ <xsl:if test="$scale_y != 1">
10459
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10460
+ </xsl:if>
10461
+
10433
10462
  <xsl:copy-of select="$svg_content"/>
10434
10463
  </fo:instream-foreign-object>
10435
10464
  <!-- </fo:block> -->
@@ -10467,8 +10496,12 @@
10467
10496
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10468
10497
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10469
10498
 
10499
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10500
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10501
+
10470
10502
  <xsl:attribute name="width">
10471
10503
  <xsl:choose>
10504
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10472
10505
  <xsl:when test="$width != ''">
10473
10506
  <xsl:value-of select="round($width)"/>
10474
10507
  </xsl:when>
@@ -10477,6 +10510,7 @@
10477
10510
  </xsl:attribute>
10478
10511
  <xsl:attribute name="height">
10479
10512
  <xsl:choose>
10513
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10480
10514
  <xsl:when test="$height != ''">
10481
10515
  <xsl:value-of select="round($height)"/>
10482
10516
  </xsl:when>
@@ -10488,6 +10522,28 @@
10488
10522
  </xsl:copy>
10489
10523
  </xsl:template>
10490
10524
 
10525
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10526
+ <!-- image[@width]/svg -->
10527
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10528
+ <xsl:attribute name="width">
10529
+ <xsl:choose>
10530
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10531
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10532
+ </xsl:choose>
10533
+ </xsl:attribute>
10534
+ </xsl:template>
10535
+
10536
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10537
+ <!-- image[@height]/svg -->
10538
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10539
+ <xsl:attribute name="height">
10540
+ <xsl:choose>
10541
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10542
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10543
+ </xsl:choose>
10544
+ </xsl:attribute>
10545
+ </xsl:template>
10546
+
10491
10547
  <!-- regex for 'display: inline-block;' -->
10492
10548
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10493
10549
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12572,7 +12628,9 @@
12572
12628
  </xsl:template> <!-- sections_element_style -->
12573
12629
 
12574
12630
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12575
- <fo:block break-after="page"/>
12631
+
12632
+ <fo:block break-after="page"/>
12633
+
12576
12634
  <fo:block>
12577
12635
  <xsl:call-template name="setId"/>
12578
12636
  <xsl:apply-templates/>
@@ -12641,7 +12699,7 @@
12641
12699
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12642
12700
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12643
12701
  </xsl:when>
12644
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12702
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12645
12703
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12646
12704
  </xsl:when>
12647
12705
  </xsl:choose>
@@ -6092,7 +6092,8 @@
6092
6092
  </xsl:template>
6093
6093
 
6094
6094
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6095
- <xsl:variable name="text" select="normalize-space(.)"/>
6095
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6096
+ <xsl:variable name="text" select="."/>
6096
6097
  <fo:inline font-size="75%" role="SKIP">
6097
6098
  <xsl:if test="string-length($text) &gt; 0">
6098
6099
  <xsl:variable name="smallCapsText">
@@ -8236,16 +8237,44 @@
8236
8237
  </xsl:choose>
8237
8238
 
8238
8239
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8239
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8240
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8240
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8241
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8242
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8243
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8244
+
8245
+ <!-- Example: -->
8241
8246
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8242
8247
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8243
8248
  <!-- effective height / width = 1.48, 1.4 - with title -->
8244
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8249
+
8250
+ <xsl:variable name="scale_x">
8251
+ <xsl:choose>
8252
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8253
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8254
+ </xsl:when>
8255
+ <xsl:otherwise>1</xsl:otherwise>
8256
+ </xsl:choose>
8257
+ </xsl:variable>
8258
+ <xsl:variable name="scale_y">
8259
+ <xsl:choose>
8260
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8261
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8262
+ </xsl:when>
8263
+ <xsl:otherwise>1</xsl:otherwise>
8264
+ </xsl:choose>
8265
+ </xsl:variable>
8266
+
8267
+ <!-- for images with big height -->
8268
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8245
8269
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8246
8270
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8247
- </xsl:if>
8271
+ </xsl:if> -->
8248
8272
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8273
+
8274
+ <xsl:if test="$scale_y != 1">
8275
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8276
+ </xsl:if>
8277
+
8249
8278
  <xsl:copy-of select="$svg_content"/>
8250
8279
  </fo:instream-foreign-object>
8251
8280
  <!-- </fo:block> -->
@@ -8283,8 +8312,12 @@
8283
8312
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8284
8313
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8285
8314
 
8315
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8316
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8317
+
8286
8318
  <xsl:attribute name="width">
8287
8319
  <xsl:choose>
8320
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8288
8321
  <xsl:when test="$width != ''">
8289
8322
  <xsl:value-of select="round($width)"/>
8290
8323
  </xsl:when>
@@ -8293,6 +8326,7 @@
8293
8326
  </xsl:attribute>
8294
8327
  <xsl:attribute name="height">
8295
8328
  <xsl:choose>
8329
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8296
8330
  <xsl:when test="$height != ''">
8297
8331
  <xsl:value-of select="round($height)"/>
8298
8332
  </xsl:when>
@@ -8304,6 +8338,28 @@
8304
8338
  </xsl:copy>
8305
8339
  </xsl:template>
8306
8340
 
8341
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8342
+ <!-- image[@width]/svg -->
8343
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8344
+ <xsl:attribute name="width">
8345
+ <xsl:choose>
8346
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8347
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8348
+ </xsl:choose>
8349
+ </xsl:attribute>
8350
+ </xsl:template>
8351
+
8352
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8353
+ <!-- image[@height]/svg -->
8354
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8355
+ <xsl:attribute name="height">
8356
+ <xsl:choose>
8357
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8358
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8359
+ </xsl:choose>
8360
+ </xsl:attribute>
8361
+ </xsl:template>
8362
+
8307
8363
  <!-- regex for 'display: inline-block;' -->
8308
8364
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8309
8365
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10380,7 +10436,9 @@
10380
10436
  </xsl:template> <!-- sections_element_style -->
10381
10437
 
10382
10438
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10383
- <fo:block break-after="page"/>
10439
+
10440
+ <fo:block break-after="page"/>
10441
+
10384
10442
  <fo:block>
10385
10443
  <xsl:call-template name="setId"/>
10386
10444
  <xsl:apply-templates/>
@@ -10451,7 +10509,7 @@
10451
10509
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10452
10510
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10453
10511
  </xsl:when>
10454
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10512
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10455
10513
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10456
10514
  </xsl:when>
10457
10515
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.4.3".freeze
3
+ VERSION = "2.4.4".freeze
4
4
  end
5
5
  end
@@ -9,6 +9,7 @@ module Relaton
9
9
  end
10
10
 
11
11
  def klass_initialize(_options)
12
+ super
12
13
  @nametemplateklass = Relaton::Render::Template::Name
13
14
  @seriestemplateklass = Relaton::Render::Template::Series
14
15
  @extenttemplateklass = Relaton::Render::Template::Extent
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: 2.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-04 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic