summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Hallot <ohallot@collabora.co.uk>2016-11-06 23:51:24 -0200
committerOlivier Hallot <olivier.hallot@edx.srv.br>2016-11-07 01:54:48 +0000
commitbf3db717e483f7d0f5b3fa8529d830dfd135d711 (patch)
tree030ab7665679d7496cfb8c55fd3690cb3a213e70
parent63fa2d5d4e0b4136516bd8204109271bf85c91ae (diff)
Correction to width and height pixel calculation
Change-Id: I6b4eb642e7e45785a7377fc79c6f7c90f8aea9ec Reviewed-on: https://gerrit.libreoffice.org/30617 Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br> Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
-rw-r--r--help3xsl/online_transform.xsl31
1 files changed, 28 insertions, 3 deletions
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 3d8de82028..1d78223c1f 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -851,9 +851,34 @@
</xsl:variable>
<p class="bug">Image: <xsl:value-of select="$src"/></p>
<!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>-->
- <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
- <xsl:variable name="istyle"><xsl:value-of select="concat('width:',@width,';','height:',@height,';')"/></xsl:variable>
- <img src="{$src}" alt="{$alt}" title="{$alt}" style="{$istyle}"></img>
+ <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
+ <xsl:variable name="width">
+ <xsl:call-template name="convert2px"><xsl:with-param name="value" select="@width"/></xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:call-template name="convert2px"><xsl:with-param name="value" select="@height"/></xsl:call-template>
+ </xsl:variable>
+ <img src="{$src}" alt="{$alt}" title="{$alt}" style="concat('width:',$width,';','height:',$height,';')"></img>
+</xsl:template>
+
+<!-- changing measure to pixel -->
+<xsl:template name="convert2px">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="concat(round(number(substring-before($value, 'cm')) * $dpcm),'px')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="concat(round(number(substring-before($value, 'in')) * $dpi),'px')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- Insert a Table -->