Skip to content

Commit

Permalink
Merge pull request #310 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 28, 2024
2 parents 7744503 + 544a032 commit 4ba5d1d
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions lib/isodoc/iec/iec.international-standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -3273,9 +3273,10 @@
<xsl:attribute name="content-height">100%</xsl:attribute>
<xsl:attribute name="scaling">uniform</xsl:attribute>

<xsl:attribute name="width">75%</xsl:attribute>
<xsl:attribute name="content-height">scale-to-fit</xsl:attribute>

<xsl:attribute name="width">75%</xsl:attribute>

</xsl:attribute-set>

<xsl:attribute-set xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tt-style">
Expand Down Expand Up @@ -8748,17 +8749,19 @@
</xsl:variable>
<xsl:value-of select="concat('scale=', $scale,', indent=', $indent)"/>
</fo:block> -->
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
<xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">

<xsl:call-template name="setImageWidthHeight"/>
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}">

<xsl:choose>
<xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
<xsl:attribute name="scaling">non-uniform</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<!-- default -->
<xsl:when test="((@width = 'auto' or @width = 'text-width' or @width = 'full-page-width' or @width = 'narrow') and @height = 'auto') or (normalize-space(@width) = '' and normalize-space(@height) = '') ">
<!-- add attribute for automatic scaling -->
<xsl:variable name="image-graphic-style_attributes">
<attributes xsl:use-attribute-sets="image-graphic-style"/>
</xsl:variable>
<xsl:copy-of select="xalan:nodeset($image-graphic-style_attributes)/attributes/@*"/>

<xsl:if test="not(@mimetype = 'image/svg+xml') and not(ancestor::*[local-name() = 'table'])">
<xsl:variable name="scale">
<xsl:call-template name="getImageScale">
<xsl:with-param name="indent" select="$indent"/>
Expand All @@ -8772,10 +8775,30 @@
<xsl:if test="number($scale) &lt; 100">
<xsl:attribute name="content-width"><xsl:value-of select="number($scale) * number($scaleRatio)"/>%</xsl:attribute>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:if>

</xsl:if>
</xsl:when> <!-- default -->
<xsl:otherwise>

<xsl:variable name="width_height_">
<attributes>
<xsl:call-template name="setImageWidthHeight"/>
</attributes>
</xsl:variable>
<xsl:variable name="width_height" select="xalan:nodeset($width_height_)"/>

<xsl:copy-of select="$width_height/attributes/@*"/>

<xsl:if test="$width_height/attributes/@content-width != '' and $width_height/attributes/@content-height != ''">
<xsl:attribute name="scaling">non-uniform</xsl:attribute>
</xsl:if>

</xsl:otherwise>
</xsl:choose>

<!--
<xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
-->

</fo:external-graphic>
</xsl:otherwise>
Expand All @@ -8801,15 +8824,15 @@
<xsl:call-template name="setImageWidth"/>
</xsl:variable>
<xsl:if test="$width != ''">
<xsl:attribute name="width">
<xsl:attribute name="content-width">
<xsl:value-of select="$width"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="height">
<xsl:call-template name="setImageHeight"/>
</xsl:variable>
<xsl:if test="$height != ''">
<xsl:attribute name="height">
<xsl:attribute name="content-height">
<xsl:value-of select="$height"/>
</xsl:attribute>
</xsl:if>
Expand Down

0 comments on commit 4ba5d1d

Please sign in to comment.