metanorma-ogc 2.5.3 → 2.5.4

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: f0877a135122a9679c77a798d1dcdbb87ab12eb88064d4e9cb0b27e6801ce01e
4
- data.tar.gz: 96698d9f3307659aae17d583013669f255b66fb26da573ec1a5c6895bb305f2d
3
+ metadata.gz: f5b7bc9526465aeb1342c9c40c24ca19acf01c1033325648a13725cfb660ffcc
4
+ data.tar.gz: 5dda146079759e69208a3349bacc4bf8964b67eb201aa3590f2053a2fc0cd16f
5
5
  SHA512:
6
- metadata.gz: 87400e1bc50e17d41f0ee8ac284d0b711eb90537904751cf974073a59294aab85ff65167df3cddc3d5cebd7c17e1abb601e54a3e8fe7261e414f9450ed885a57
7
- data.tar.gz: 9a97e9cc207be3725110845bbc29d13c688cba3d58ad297eca15dfa53dd89ef62901561191287aecfa3e01bba431325f077230448b09c369151b0ad3e581e7eb
6
+ metadata.gz: cce390cedf519a9a6e0d3b2a5c214b3c6431b05aaea86b1e3f03413f3dac9681b09edd684c4773e9d6eec5f804db2999cefc04d53cd3edb0b6adb5f74c6a958c
7
+ data.tar.gz: ce4b59d8cae0ec31c4c141f1806f89a929aa4091bf7a936c6c9d2fc3239e7041b853fcc56df969397c7d7fdf0b1cc09ca2df09faf907b345f90d5003f00acb5f
@@ -6000,7 +6000,8 @@
6000
6000
  </xsl:template>
6001
6001
 
6002
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
6004
6005
  <fo:inline font-size="75%" role="SKIP">
6005
6006
  <xsl:if test="string-length($text) &gt; 0">
6006
6007
  <xsl:variable name="smallCapsText">
@@ -8143,16 +8144,44 @@
8143
8144
  </xsl:choose>
8144
8145
 
8145
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8148
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8178
+ </xsl:if> -->
8155
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8156
8185
  <xsl:copy-of select="$svg_content"/>
8157
8186
  </fo:instream-foreign-object>
8158
8187
  <!-- </fo:block> -->
@@ -8190,8 +8219,12 @@
8190
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8193
8225
  <xsl:attribute name="width">
8194
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8228
  <xsl:when test="$width != ''">
8196
8229
  <xsl:value-of select="round($width)"/>
8197
8230
  </xsl:when>
@@ -8200,6 +8233,7 @@
8200
8233
  </xsl:attribute>
8201
8234
  <xsl:attribute name="height">
8202
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8237
  <xsl:when test="$height != ''">
8204
8238
  <xsl:value-of select="round($height)"/>
8205
8239
  </xsl:when>
@@ -8211,6 +8245,28 @@
8211
8245
  </xsl:copy>
8212
8246
  </xsl:template>
8213
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8214
8270
  <!-- regex for 'display: inline-block;' -->
8215
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10331,7 +10387,9 @@
10331
10387
  </xsl:template> <!-- sections_element_style -->
10332
10388
 
10333
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10335
10393
  <fo:block>
10336
10394
  <xsl:call-template name="setId"/>
10337
10395
  <xsl:apply-templates/>
@@ -10398,7 +10456,7 @@
10398
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10458
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10461
  </xsl:when>
10404
10462
  </xsl:choose>
@@ -6000,7 +6000,8 @@
6000
6000
  </xsl:template>
6001
6001
 
6002
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
6004
6005
  <fo:inline font-size="75%" role="SKIP">
6005
6006
  <xsl:if test="string-length($text) &gt; 0">
6006
6007
  <xsl:variable name="smallCapsText">
@@ -8143,16 +8144,44 @@
8143
8144
  </xsl:choose>
8144
8145
 
8145
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8148
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8178
+ </xsl:if> -->
8155
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8156
8185
  <xsl:copy-of select="$svg_content"/>
8157
8186
  </fo:instream-foreign-object>
8158
8187
  <!-- </fo:block> -->
@@ -8190,8 +8219,12 @@
8190
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8193
8225
  <xsl:attribute name="width">
8194
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8228
  <xsl:when test="$width != ''">
8196
8229
  <xsl:value-of select="round($width)"/>
8197
8230
  </xsl:when>
@@ -8200,6 +8233,7 @@
8200
8233
  </xsl:attribute>
8201
8234
  <xsl:attribute name="height">
8202
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8237
  <xsl:when test="$height != ''">
8204
8238
  <xsl:value-of select="round($height)"/>
8205
8239
  </xsl:when>
@@ -8211,6 +8245,28 @@
8211
8245
  </xsl:copy>
8212
8246
  </xsl:template>
8213
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8214
8270
  <!-- regex for 'display: inline-block;' -->
8215
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10331,7 +10387,9 @@
10331
10387
  </xsl:template> <!-- sections_element_style -->
10332
10388
 
10333
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10335
10393
  <fo:block>
10336
10394
  <xsl:call-template name="setId"/>
10337
10395
  <xsl:apply-templates/>
@@ -10398,7 +10456,7 @@
10398
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10458
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10461
  </xsl:when>
10404
10462
  </xsl:choose>
@@ -6000,7 +6000,8 @@
6000
6000
  </xsl:template>
6001
6001
 
6002
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
6004
6005
  <fo:inline font-size="75%" role="SKIP">
6005
6006
  <xsl:if test="string-length($text) &gt; 0">
6006
6007
  <xsl:variable name="smallCapsText">
@@ -8143,16 +8144,44 @@
8143
8144
  </xsl:choose>
8144
8145
 
8145
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8148
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8178
+ </xsl:if> -->
8155
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8156
8185
  <xsl:copy-of select="$svg_content"/>
8157
8186
  </fo:instream-foreign-object>
8158
8187
  <!-- </fo:block> -->
@@ -8190,8 +8219,12 @@
8190
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8193
8225
  <xsl:attribute name="width">
8194
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8228
  <xsl:when test="$width != ''">
8196
8229
  <xsl:value-of select="round($width)"/>
8197
8230
  </xsl:when>
@@ -8200,6 +8233,7 @@
8200
8233
  </xsl:attribute>
8201
8234
  <xsl:attribute name="height">
8202
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8237
  <xsl:when test="$height != ''">
8204
8238
  <xsl:value-of select="round($height)"/>
8205
8239
  </xsl:when>
@@ -8211,6 +8245,28 @@
8211
8245
  </xsl:copy>
8212
8246
  </xsl:template>
8213
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8214
8270
  <!-- regex for 'display: inline-block;' -->
8215
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10331,7 +10387,9 @@
10331
10387
  </xsl:template> <!-- sections_element_style -->
10332
10388
 
10333
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10335
10393
  <fo:block>
10336
10394
  <xsl:call-template name="setId"/>
10337
10395
  <xsl:apply-templates/>
@@ -10398,7 +10456,7 @@
10398
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10458
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10461
  </xsl:when>
10404
10462
  </xsl:choose>
@@ -6000,7 +6000,8 @@
6000
6000
  </xsl:template>
6001
6001
 
6002
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
6004
6005
  <fo:inline font-size="75%" role="SKIP">
6005
6006
  <xsl:if test="string-length($text) &gt; 0">
6006
6007
  <xsl:variable name="smallCapsText">
@@ -8143,16 +8144,44 @@
8143
8144
  </xsl:choose>
8144
8145
 
8145
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8148
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8178
+ </xsl:if> -->
8155
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8156
8185
  <xsl:copy-of select="$svg_content"/>
8157
8186
  </fo:instream-foreign-object>
8158
8187
  <!-- </fo:block> -->
@@ -8190,8 +8219,12 @@
8190
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8193
8225
  <xsl:attribute name="width">
8194
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8228
  <xsl:when test="$width != ''">
8196
8229
  <xsl:value-of select="round($width)"/>
8197
8230
  </xsl:when>
@@ -8200,6 +8233,7 @@
8200
8233
  </xsl:attribute>
8201
8234
  <xsl:attribute name="height">
8202
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8237
  <xsl:when test="$height != ''">
8204
8238
  <xsl:value-of select="round($height)"/>
8205
8239
  </xsl:when>
@@ -8211,6 +8245,28 @@
8211
8245
  </xsl:copy>
8212
8246
  </xsl:template>
8213
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8214
8270
  <!-- regex for 'display: inline-block;' -->
8215
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10331,7 +10387,9 @@
10331
10387
  </xsl:template> <!-- sections_element_style -->
10332
10388
 
10333
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10335
10393
  <fo:block>
10336
10394
  <xsl:call-template name="setId"/>
10337
10395
  <xsl:apply-templates/>
@@ -10398,7 +10456,7 @@
10398
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10458
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10461
  </xsl:when>
10404
10462
  </xsl:choose>