diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2013-03-26 10:25:50 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-03-26 12:52:30 -0700 |
commit | ac5881c3fe852ba0fbadadf09d7fe0cbb6255a1b (patch) | |
tree | e91918c92df7868762f3e46713f0bb8932648a30 /xslt | |
parent | b18f9fa057a5f4bea447eb03a49926d19acfb4c9 (diff) | |
download | subsurface-ac5881c3fe852ba0fbadadf09d7fe0cbb6255a1b.tar.gz |
Fix pressures on UDDF export
Examples on UDDF specification indicate that pressures are reported in
Pascal. Also prefer the sample data from first dive computer for start
and end tank pressures.
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/uddf-export.xslt | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt index b4343700b..a41a7fccd 100644 --- a/xslt/uddf-export.xslt +++ b/xslt/uddf-export.xslt @@ -139,7 +139,7 @@ </divetime> <xsl:if test="./@pressure != ''"> <tankpressure> - <xsl:value-of select="substring-before(./@pressure, ' ')"/> + <xsl:value-of select="substring-before(./@pressure, ' ') * 100000"/> </tankpressure> </xsl:if> <xsl:if test="./@temp != ''"> @@ -193,21 +193,41 @@ </samples> <tankdata> - <xsl:if test="./cylinder[1]/@size"> + <xsl:if test="cylinder[1]/@size"> <tankvolume> - <xsl:value-of select="substring-before(./cylinder[1]/@size, ' ')"/> + <xsl:value-of select="substring-before(cylinder[1]/@size, ' ')"/> </tankvolume> </xsl:if> - <xsl:if test="./cylinder[1]/@start"> - <tankpressurebegin> - <xsl:value-of select="substring-before(./cylinder[1]/@start, ' ')"/> - </tankpressurebegin> - </xsl:if> - <xsl:if test="./cylinder[1]/@end"> - <tankpressureend> - <xsl:value-of select="substring-before(./cylinder[1]/@end, ' ')"/> - </tankpressureend> - </xsl:if> + <xsl:choose> + <xsl:when test="divecomputer[1]/sample/@pressure != ''"> + <tankpressurebegin> + <xsl:value-of select="substring-before(divecomputer[1]/sample/@pressure[1], ' ') * 100000"/> + </tankpressurebegin> + </xsl:when> + <xsl:otherwise> + <xsl:if test="cylinder[1]/@start"> + <tankpressurebegin> + <xsl:value-of select="substring-before(cylinder[1]/@start, ' ') * 100000"/> + </tankpressurebegin> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="count(divecomputer[1]/sample[@pressure]) > 0"> + <tankpressureend> + <xsl:value-of select="substring-before(divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') * 100000"/> + </tankpressureend> + </xsl:when> + <xsl:otherwise> + <xsl:if test="cylinder[1]/@end"> + <tankpressureend> + <xsl:value-of select="substring-before(cylinder[1]/@end, ' ') * 100000"/> + </tankpressureend> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </tankdata> <informationafterdive> |