summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-12-27 09:07:02 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-26 23:11:18 -0800
commitde76cb3ebb819f5be78965a78695c503018e4cdf (patch)
tree4821a0783ae2fd65592cd4865770b218a58d0be2 /xslt
parent99a5a743c48e88d94bce96a78bc9bea9d8f4343e (diff)
downloadsubsurface-de76cb3ebb819f5be78965a78695c503018e4cdf.tar.gz
Fix UDCF import time unit in timedepthmode
The timedepthmode specifies the time in seconds when using si units, otherwise minutes. This patch implements this support. Fixes #981 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt')
-rw-r--r--xslt/udcf.xslt19
1 files changed, 15 insertions, 4 deletions
diff --git a/xslt/udcf.xslt b/xslt/udcf.xslt
index 62cee55be..623273b8d 100644
--- a/xslt/udcf.xslt
+++ b/xslt/udcf.xslt
@@ -90,13 +90,24 @@
<!-- samples recorded at irregular internal, but storing time stamp -->
<xsl:when test="timedepthmode">
+ <xsl:variable name="timeconvert">
+ <xsl:choose>
+ <xsl:when test="//units = 'si'">
+ <xsl:value-of select="60"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <debug name="{$timeconvert}"/>
<!-- gas change -->
<xsl:for-each select="SAMPLES/SWITCH|samples/switch">
<event name="gaschange">
<xsl:variable name="timeSec" select="following-sibling::T|following-sibling::t"/>
<xsl:attribute name="time">
- <xsl:value-of select="concat(floor($timeSec div 60), ':',
- format-number(floor($timeSec mod 60), '00'), ' min')"/>
+ <xsl:value-of select="concat(floor($timeSec div $timeconvert), ':',
+ format-number(floor($timeSec mod $timeconvert), '00'), ' min')"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="ancestor::DIVE/GASES/MIX[MIXNAME=current()]/O2|ancestor::dive/gases/mix[mixname=current()]/o2 * 100" />
@@ -110,8 +121,8 @@
<sample>
<xsl:variable name="timeSec" select="preceding-sibling::T[position()=1]|preceding-sibling::t[position()=1]"/>
<xsl:attribute name="time">
- <xsl:value-of select="concat(floor($timeSec div 60), ':',
- format-number(floor($timeSec mod 60), '00'), ' min')"/>
+ <xsl:value-of select="concat(floor($timeSec div $timeconvert), ':',
+ format-number(floor($timeSec mod $timeconvert), '00'), ' min')"/>
</xsl:attribute>
<xsl:attribute name="depth">
<xsl:value-of select="concat(., ' m')"/>