summaryrefslogtreecommitdiffstats
path: root/xslt/divelogs-export.xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-03-14 20:43:17 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-14 12:20:05 -0700
commit98d769a02fc4f42c5afb20153847ab358ecc126f (patch)
treea1ba7aa9e9395c6c52553e3ef647156a5552ae1a /xslt/divelogs-export.xslt
parentd6e77cd1682e6396bd5c63a9c7e5dcc9fa6a7809 (diff)
downloadsubsurface-98d769a02fc4f42c5afb20153847ab358ecc126f.tar.gz
Correct ending pressure for .DLD export
We grab the pressure information from samples, if available. Otherwise, we use information from first cylinder. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/divelogs-export.xslt')
-rw-r--r--xslt/divelogs-export.xslt24
1 files changed, 19 insertions, 5 deletions
diff --git a/xslt/divelogs-export.xslt b/xslt/divelogs-export.xslt
index 9a69546b0..00f603716 100644
--- a/xslt/divelogs-export.xslt
+++ b/xslt/divelogs-export.xslt
@@ -45,13 +45,27 @@
<xsl:value-of select="substring-before(cylinder/@size, ' ')"/>
</CYLINDERSIZE>
<CYLINDERSTARTPRESSURE>
- <xsl:value-of select="substring-before(node()/sample/@pressure, ' ')"/>
+ <xsl:choose>
+ <xsl:when test="node()/sample/@pressure != ''">
+ <xsl:value-of select="substring-before(node()/sample/@pressure, ' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="cylinder[1]/@start"/>
+ </xsl:otherwise>
+ </xsl:choose>
</CYLINDERSTARTPRESSURE>
<CYLINDERENDPRESSURE>
- <xsl:variable name="samples">
- <xsl:value-of select="count(node()/sample)"/>
- </xsl:variable>
- <xsl:value-of select="node()/sample[position() = $samples]/@pressure"/>
+ <xsl:choose>
+ <xsl:when test="count(node()/sample[@pressure!='']) &gt; 0">
+ <xsl:variable name="samples">
+ <xsl:value-of select="count(node()/sample[@pressure!=''])"/>
+ </xsl:variable>
+ <xsl:value-of select="node()/sample[position() = $samples]/@pressure"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="cylinder[1]/@end"/>
+ </xsl:otherwise>
+ </xsl:choose>
</CYLINDERENDPRESSURE>
<WEIGHT>
<xsl:call-template name="sum">