[PATCH] Fix import when locale set to decimal comma
Miika Turkia
miika.turkia at gmail.com
Wed Mar 6 09:11:19 PST 2013
This should take care of locale caused problems when the input uses decimal
point but locale uses decimal comma. Also the sample I have of Suunto DM3
format weight is represented with comma instead of dot so converting that as
well.
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
xslt/DivingLog.xslt | 2 +-
xslt/MacDive.xslt | 10 +++++-----
xslt/SuuntoSDM.xslt | 4 ++--
xslt/divelogs.xslt | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/xslt/DivingLog.xslt b/xslt/DivingLog.xslt
index 9c17f2c..91c5d50 100644
--- a/xslt/DivingLog.xslt
+++ b/xslt/DivingLog.xslt
@@ -97,7 +97,7 @@
<xsl:value-of select="Tanksize"/>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="Tanksize * 2"/>
+ <xsl:value-of select="format-number(Tanksize * 2, '#.##')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
diff --git a/xslt/MacDive.xslt b/xslt/MacDive.xslt
index 8faa429..e9ad9a8 100644
--- a/xslt/MacDive.xslt
+++ b/xslt/MacDive.xslt
@@ -395,7 +395,7 @@
<xsl:choose>
<xsl:when test="$units = 'Imperial'">
- <xsl:value-of select="concat(($number div 14.5037738007), ' bar')"/>
+ <xsl:value-of select="concat(format-number(($number div 14.5037738007), '#.##'), ' bar')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($number, ' bar')"/>
@@ -412,13 +412,13 @@
<xsl:param name="units"/>
<xsl:variable name="size">
- <xsl:value-of select="$singleSize + $singleSize * $double"/>
+ <xsl:value-of select="format-number($singleSize + $singleSize * $double, '#.##')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$units = 'Imperial'">
<xsl:if test="$pressure != '0'">
- <xsl:value-of select="concat((($size * 14.7 div $pressure) div 0.035315), ' l')"/>
+ <xsl:value-of select="concat(format-number((($size * 14.7 div $pressure) div 0.035315), '#.##'), ' l')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
@@ -462,7 +462,7 @@
<xsl:choose>
<xsl:when test="$units = 'Imperial'">
- <xsl:value-of select="concat(($depth * 0.3048), ' m')"/>
+ <xsl:value-of select="concat(format-number(($depth * 0.3048), '#.##'), ' m')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($depth, ' m')"/>
@@ -480,7 +480,7 @@
<xsl:when test="$weight > 0">
<xsl:choose>
<xsl:when test="$units = 'Imperial'">
- <xsl:value-of select="concat(($weight * 0.453592), ' kg')"/>
+ <xsl:value-of select="concat(format-number(($weight * 0.453592), '#.##'), ' kg')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($weight, ' kg')"/>
diff --git a/xslt/SuuntoSDM.xslt b/xslt/SuuntoSDM.xslt
index 14d088c..a3159a5 100644
--- a/xslt/SuuntoSDM.xslt
+++ b/xslt/SuuntoSDM.xslt
@@ -65,7 +65,7 @@
<xsl:if test="WEIGTH != ''">
<weightsystem>
<xsl:attribute name="weight">
- <xsl:value-of select="concat(WEIGTH, ' kg')"/>
+ <xsl:value-of select="concat(translate(WEIGTH, ',', '.'), ' kg')"/>
</xsl:attribute>
</weightsystem>
</xsl:if>
@@ -240,7 +240,7 @@
<xsl:choose>
<xsl:when test="$number != ''">
- <xsl:value-of select="concat(($number div 1000), ' bar')"/>
+ <xsl:value-of select="concat(format-number(($number div 1000), '#.##'), ' bar')"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
diff --git a/xslt/divelogs.xslt b/xslt/divelogs.xslt
index 879fd3d..3855c15 100644
--- a/xslt/divelogs.xslt
+++ b/xslt/divelogs.xslt
@@ -94,7 +94,7 @@
</xsl:attribute>
<xsl:if test="CYLINDERSIZE != ''">
<xsl:attribute name="size">
- <xsl:value-of select="CYLINDERSIZE + CYLINDERSIZE * DBLTANK"/>
+ <xsl:value-of select="format-number(CYLINDERSIZE + CYLINDERSIZE * DBLTANK, '#.##')"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="WORKINGPRESSURE > 0">
--
1.7.9.5
More information about the subsurface
mailing list