[Libreoffice-commits] help.git: help3xsl/online_transform.xsl

Olivier Hallot ohallot at collabora.co.uk
Mon Nov 7 01:55:13 UTC 2016


 help3xsl/online_transform.xsl |   31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

New commits:
commit bf3db717e483f7d0f5b3fa8529d830dfd135d711
Author: Olivier Hallot <ohallot at collabora.co.uk>
Date:   Sun Nov 6 23:51:24 2016 -0200

    Correction to width and height pixel calculation
    
    Change-Id: I6b4eb642e7e45785a7377fc79c6f7c90f8aea9ec
    Reviewed-on: https://gerrit.libreoffice.org/30617
    Reviewed-by: Olivier Hallot <olivier.hallot at edx.srv.br>
    Tested-by: Olivier Hallot <olivier.hallot at edx.srv.br>

diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 3d8de82..1d78223 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, at src)"/></xsl:variable>-->
-	<xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
-    <xsl:variable name="istyle"><xsl:value-of select="concat('width:', at width,';','height:', at 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 -->


More information about the Libreoffice-commits mailing list