aboutsummaryrefslogtreecommitdiffstats
path: root/xslt/MacDive.xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-02-07 21:20:03 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-08 07:51:21 +1100
commitb85d5a36fc7285ffc380fd0dcf59d84bd2855082 (patch)
tree852fb25440f7b264c056ec02a792a84c4a1a2239 /xslt/MacDive.xslt
parent3150c1a6e84a3ed988f093e314149a5530a8ccb3 (diff)
downloadsubsurface-b85d5a36fc7285ffc380fd0dcf59d84bd2855082.tar.gz
Support for Imperial units on MacDive log import
The cylinder size is treated as metric as the samples received indicate it would be so. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/MacDive.xslt')
-rw-r--r--xslt/MacDive.xslt31
1 files changed, 28 insertions, 3 deletions
diff --git a/xslt/MacDive.xslt b/xslt/MacDive.xslt
index 2ddeb272f..bd1ba9c4a 100644
--- a/xslt/MacDive.xslt
+++ b/xslt/MacDive.xslt
@@ -114,12 +114,18 @@
</xsl:if>
<xsl:if test="pressureStart != ''">
<xsl:attribute name="start">
- <xsl:value-of select="concat(pressureStart, ' bar')"/>
+ <xsl:call-template name="pressureConvert">
+ <xsl:with-param name="number" select="pressureStart"/>
+ <xsl:with-param name="units" select="$units"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:if test="pressureEnd != ''">
<xsl:attribute name="end">
- <xsl:value-of select="concat(pressureEnd, ' bar')"/>
+ <xsl:call-template name="pressureConvert">
+ <xsl:with-param name="number" select="pressureEnd"/>
+ <xsl:with-param name="units" select="$units"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:if test="tankSize != ''">
@@ -129,7 +135,10 @@
</xsl:if>
<xsl:if test="workingPressure != ''">
<xsl:attribute name="workpressure">
- <xsl:value-of select="concat(workingPressure, ' bar')"/>
+ <xsl:call-template name="pressureConvert">
+ <xsl:with-param name="number" select="workingPressure"/>
+ <xsl:with-param name="units" select="$units"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
</cylinder>
@@ -242,6 +251,22 @@
</dive>
</xsl:template>
+ <!-- convert pressure to bars -->
+ <xsl:template name="pressureConvert">
+ <xsl:param name="number"/>
+ <xsl:param name="units"/>
+
+ <xsl:choose>
+ <xsl:when test="$units = 'Imperial'">
+ <xsl:value-of select="concat(round($number div 14.5037738007), ' bar')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($number, ' bar')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- end convert pressure -->
+
<!-- convert time in seconds to minutes:seconds -->
<xsl:template name="timeConvert">
<xsl:param name="timeSec"/>