Add cylinder support for Shearwater XML import

This tries to grab the used cylinders when in open circuit mode.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2014-12-07 08:48:14 +02:00 committed by Dirk Hohndel
parent d7d5c296dd
commit 4dc99a0b56

View file

@ -3,6 +3,8 @@
<xsl:output method="xml" indent="yes"/>
<xsl:include href="commonTemplates.xsl"/>
<xsl:key name="gases" match="diveLogRecord" use="concat(fractionO2, '/', fractionHe)" />
<xsl:template match="/">
<divelog program='subsurface-import' version='2'>
<dives>
@ -74,6 +76,24 @@
</xsl:attribute>
</divecomputer>
<xsl:for-each select="diveLogRecords/diveLogRecord[generate-id() = generate-id(key('gases', concat(fractionO2, '/', fractionHe))[1])]">
<xsl:if test="currentCircuitSetting = 1">
<cylinder>
<xsl:attribute name="description">
<xsl:value-of select="concat(fractionO2 * 100, '/', fractionHe * 100)"/>
</xsl:attribute>
<xsl:attribute name="o2">
<xsl:value-of select="concat(fractionO2 * 100, '%')"/>
</xsl:attribute>
<xsl:if test="fractionHe != 0">
<xsl:attribute name="he">
<xsl:value-of select="concat(fractionHe * 100, '%')"/>
</xsl:attribute>
</xsl:if>
</cylinder>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="diveLogRecords/diveLogRecord">
<sample>
<xsl:attribute name="time">