summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-05-12 12:01:38 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-05-12 12:01:38 -0700
commit8a58dae3ae028bc1849a4d60930f10de7b67228a (patch)
treeb997c29bce6866ea0b9534a5cef2a21e6ca5284e /xslt
parent12f2c2ed5cbf45f13c63af4eb778833cd21e8ce4 (diff)
downloadsubsurface-8a58dae3ae028bc1849a4d60930f10de7b67228a.tar.gz
Fix more Suunto SDM xml conversion problems
Looking at the XML of the two dives Szymon Kosecki sent out to the subsurface list, I notice that our cylinder size conversion was wrong. It looks like CYLINDERUNITS is what determines whether the cylinder size is in metric (0) or imperial (1) units. Of course, if you gave a cylinder size in cuft and didn't give a working pressure, subsurface will just ignore the size as the random crap it is. We *could* default to a working pressure of 3000 psi, of course. This also picks up the CYLINDERDESCRIPTION value, although neither of Szymon's dives actually had any description. I need more SDE xml files to figure out how multi-cylinder dives look etc, but I think this gets most *simple* SDE files converted almost correctly now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'xslt')
-rw-r--r--xslt/SuuntoSDM.xslt14
1 files changed, 12 insertions, 2 deletions
diff --git a/xslt/SuuntoSDM.xslt b/xslt/SuuntoSDM.xslt
index 391bdf8c4..64564adf1 100644
--- a/xslt/SuuntoSDM.xslt
+++ b/xslt/SuuntoSDM.xslt
@@ -86,10 +86,15 @@
<xsl:value-of select="concat(HEPCT, '%')"/>
</xsl:attribute>
</xsl:if>
+ <xsl:if test="CYLINDERDESCRIPTION != ''">
+ <xsl:attribute name="description">
+ <xsl:value-of select="CYLINDERDESCRIPTION"/>
+ </xsl:attribute>
+ </xsl:if>
<xsl:if test="CYLINDERSIZE != ''">
<xsl:attribute name="size">
<xsl:choose>
- <xsl:when test="CYLINDERWORKPRESSURE = '0'">
+ <xsl:when test="CYLINDERUNITS = '0'">
<xsl:value-of select="concat(CYLINDERSIZE, ' l')"/>
</xsl:when>
<xsl:otherwise>
@@ -219,7 +224,12 @@
<xsl:template name="cuft2l">
<xsl:param name="size"/>
<xsl:param name="pressure"/>
- <xsl:value-of select="concat(format-number((($size*28.3168466) div ($pressure div 1013.25)), '0.000'), ' l')" />
+ <xsl:choose>
+ <xsl:when test="$pressure != '0'">
+ <xsl:value-of select="concat(format-number((($size*28.3168466) div ($pressure div 1013.25)), '0.000'), ' l')" />
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- end cuft2l -->