[PATCH] Export only used cylinders to divelogs.de

Miika Turkia miika.turkia at gmail.com
Sat Dec 13 05:12:37 PST 2014


This attempts to export only used cylinders to divelogs.de. The
detection is based only on o2 percentage as per our test dives. However,
the new cylinder id would be better, but that does not exist on old
dives.

Fixes #757

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/divelogs-export.xslt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xslt/divelogs-export.xslt b/xslt/divelogs-export.xslt
index b3b8dfa..79f72b5 100644
--- a/xslt/divelogs-export.xslt
+++ b/xslt/divelogs-export.xslt
@@ -109,6 +109,17 @@
 
     <ADDITIONALTANKS>
       <xsl:for-each select="cylinder[position() != $cylinder]">
+        <xsl:variable name="gas">
+          <xsl:choose>
+            <xsl:when test="@o2 != ''">
+              <xsl:value-of select="substring-before(@o2, '.')"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="'21'"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="following-sibling::divecomputer/event[@name='gaschange' and @value=$gas]">
           <xsl:variable name="cur_cyl">
             <xsl:value-of select="position()"/>
           </xsl:variable>
@@ -147,6 +158,7 @@
               <xsl:value-of select="substring-before(@he, '%')"/>
             </HEPCT>
           </TANK>
+        </xsl:if>
       </xsl:for-each>
     </ADDITIONALTANKS>
 
-- 
1.9.1



More information about the subsurface mailing list