|
9284 | 9284 | </xsl:choose>
|
9285 | 9285 |
|
9286 | 9286 | <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
9287 |
| - <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/> |
9288 |
| - <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/> |
| 9287 | + <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/> |
| 9288 | + <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/> |
| 9289 | + <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/> |
| 9290 | + <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/> |
| 9291 | + |
| 9292 | + <!-- Example: --> |
9289 | 9293 | <!-- effective height 297 - 27.4 - 13 = 256.6 -->
|
9290 | 9294 | <!-- effective width 210 - 12.5 - 25 = 172.5 -->
|
9291 | 9295 | <!-- effective height / width = 1.48, 1.4 - with title -->
|
9292 |
| - <xsl:if test="$svg_height > ($svg_width * 1.4)"> <!-- for images with big height --> |
| 9296 | + |
| 9297 | + <xsl:variable name="scale_x"> |
| 9298 | + <xsl:choose> |
| 9299 | + <xsl:when test="$svg_width > $width_effective_px"> |
| 9300 | + <xsl:value-of select="$width_effective_px div $svg_width"/> |
| 9301 | + </xsl:when> |
| 9302 | + <xsl:otherwise>1</xsl:otherwise> |
| 9303 | + </xsl:choose> |
| 9304 | + </xsl:variable> |
| 9305 | + <xsl:variable name="scale_y"> |
| 9306 | + <xsl:choose> |
| 9307 | + <xsl:when test="$svg_height * $scale_x > $height_effective_px"> |
| 9308 | + <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/> |
| 9309 | + </xsl:when> |
| 9310 | + <xsl:otherwise>1</xsl:otherwise> |
| 9311 | + </xsl:choose> |
| 9312 | + </xsl:variable> |
| 9313 | + |
| 9314 | + <!-- for images with big height --> |
| 9315 | + <!-- <xsl:if test="$svg_height > ($svg_width * 1.4)"> |
9293 | 9316 | <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
|
9294 | 9317 | <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
|
9295 |
| - </xsl:if> |
| 9318 | + </xsl:if> --> |
9296 | 9319 | <xsl:attribute name="scaling">uniform</xsl:attribute>
|
| 9320 | + |
| 9321 | + <xsl:if test="$scale_y != 1"> |
| 9322 | + <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute> |
| 9323 | + </xsl:if> |
| 9324 | + |
9297 | 9325 | <xsl:copy-of select="$svg_content"/>
|
9298 | 9326 | </fo:instream-foreign-object>
|
9299 | 9327 | <!-- </fo:block> -->
|
|
11452 | 11480 | </xsl:template> <!-- sections_element_style -->
|
11453 | 11481 |
|
11454 | 11482 | <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
|
11455 |
| - <fo:block break-after="page"/> |
| 11483 | + |
| 11484 | + <fo:block break-after="page"/> |
| 11485 | + |
11456 | 11486 | <fo:block>
|
11457 | 11487 | <xsl:call-template name="setId"/>
|
11458 | 11488 | <xsl:apply-templates/>
|
|
11523 | 11553 | <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
11524 | 11554 | <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
11525 | 11555 | </xsl:when>
|
11526 |
| - <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])"> |
| 11556 | + <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])"> |
11527 | 11557 | <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
11528 | 11558 | </xsl:when>
|
11529 | 11559 | </xsl:choose>
|
|
0 commit comments