summaryrefslogtreecommitdiffstats
path: root/xslt/commonTemplates.xsl
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2018-02-13 21:40:38 +0200
committerGravatar mturkia <miika.turkia@gmail.com>2018-02-15 17:54:05 +0200
commit405e5050a1585ee062f3f96771257af00bf65173 (patch)
treea6d5f5e1be4f65c46649eae7602e4f5a80cbda87 /xslt/commonTemplates.xsl
parente123fe912d8827980620c5bba4aca4269e01571d (diff)
downloadsubsurface-405e5050a1585ee062f3f96771257af00bf65173.tar.gz
Move XSLT depth conversion to commonTemplates
Moving depth conversion template from MacDive specific XSLT to commonTemplates. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'xslt/commonTemplates.xsl')
-rw-r--r--xslt/commonTemplates.xsl17
1 files changed, 17 insertions, 0 deletions
diff --git a/xslt/commonTemplates.xsl b/xslt/commonTemplates.xsl
index 9f0423a11..c3709e003 100644
--- a/xslt/commonTemplates.xsl
+++ b/xslt/commonTemplates.xsl
@@ -168,6 +168,23 @@
<xsl:value-of select="concat(floor($depth div 1000), '.', format-number($depth mod 1000, '00'))"/>
</xsl:template>
+ <!-- convert depth to meters -->
+ <xsl:template name="depthConvert">
+ <xsl:param name="depth"/>
+ <xsl:param name="units"/>
+
+ <xsl:choose>
+ <xsl:when test="$units = 'Imperial'">
+ <xsl:value-of select="concat(format-number(($depth * 0.3048), '#.##'), ' m')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($depth, ' m')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- end convert depth -->
+
+
<!-- Convert date format "Sun Jan 19 11:02:56 2014 UTC" => 2014-1-19
11:02 -->
<xsl:template name="convertDate">