summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2018-02-14 20:39:54 +0200
committerGravatar mturkia <miika.turkia@gmail.com>2018-02-15 17:54:05 +0200
commit3cf9989d65767797b2e6f45494be73610cd1036a (patch)
tree18f26b03a04f5a96f7b95bc7dd12e861961a565f
parent1e45637575d316e86360a6bde7729f396bd2175b (diff)
downloadsubsurface-3cf9989d65767797b2e6f45494be73610cd1036a.tar.gz
Import: move some "functions" to commonTemplates
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--xslt/MacDive.xslt60
-rw-r--r--xslt/commonTemplates.xsl60
2 files changed, 60 insertions, 60 deletions
diff --git a/xslt/MacDive.xslt b/xslt/MacDive.xslt
index 2f2c84c85..3dc77f773 100644
--- a/xslt/MacDive.xslt
+++ b/xslt/MacDive.xslt
@@ -458,66 +458,6 @@
</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(format-number(($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 cuft to litres -->
- <xsl:template name="sizeConvert">
- <xsl:param name="singleSize"/>
- <xsl:param name="double"/>
- <xsl:param name="pressure"/>
- <xsl:param name="units"/>
-
- <xsl:variable name="size">
- <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(format-number((($size * 14.7 div $pressure) div 0.035315), '#.##'), ' l')"/>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($size, ' l')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- end convert pressure -->
-
- <!-- convert temperature from F to C -->
- <xsl:template name="tempConvert">
- <xsl:param name="temp"/>
- <xsl:param name="units"/>
-
- <xsl:choose>
- <xsl:when test="$units = 'Imperial'">
- <xsl:if test="$temp != ''">
- <xsl:value-of select="concat(format-number(($temp - 32) * 5 div 9, '0.0'), ' C')"/>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$temp != ''">
- <xsl:value-of select="concat($temp, ' C')"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- end convert temperature -->
-
<!-- convert time in seconds to minutes:seconds -->
<xsl:template name="timeConvert">
<xsl:param name="timeSec"/>
diff --git a/xslt/commonTemplates.xsl b/xslt/commonTemplates.xsl
index c3709e003..934017fac 100644
--- a/xslt/commonTemplates.xsl
+++ b/xslt/commonTemplates.xsl
@@ -184,6 +184,66 @@
</xsl:template>
<!-- end convert depth -->
+ <!-- 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(format-number(($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 cuft to litres -->
+ <xsl:template name="sizeConvert">
+ <xsl:param name="singleSize"/>
+ <xsl:param name="double"/>
+ <xsl:param name="pressure"/>
+ <xsl:param name="units"/>
+
+ <xsl:variable name="size">
+ <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(format-number((($size * 14.7 div $pressure) div 0.035315), '#.##'), ' l')"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($size, ' l')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- end convert pressure -->
+
+ <!-- convert temperature from F to C -->
+ <xsl:template name="tempConvert">
+ <xsl:param name="temp"/>
+ <xsl:param name="units"/>
+
+ <xsl:choose>
+ <xsl:when test="$units = 'Imperial'">
+ <xsl:if test="$temp != ''">
+ <xsl:value-of select="concat(format-number(($temp - 32) * 5 div 9, '0.0'), ' C')"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$temp != ''">
+ <xsl:value-of select="concat($temp, ' C')"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- end convert temperature -->
+
<!-- Convert date format "Sun Jan 19 11:02:56 2014 UTC" => 2014-1-19
11:02 -->