On Sun, Oct 12, 2014 at 9:27 PM, Rainer Mohr <[email protected]> wrote:

> Hi Miika,
>
> As you are the XML and XSLT Master, here comes a request to you for the
> divelogs sync:
> I just released a new version which finally supports multiple tanks. I had
> lots of requests for this, most coming from Subsurface users who want all
> their tanks transferred to divelogs.
>

What is the status of picture support on the API? IIRC you mentioned that
you are working on it, but I don't think it existed the last time I checked.


> So the DLD Format just got a few new fields. Example attached. The
> <ADDITIONALTANKS> is completely optional and always additional to the main
> tank which continues to live directly in the <DIVELOGSDATA>.
> Also please note, that a new tag <HEPCT> for Helium percentage has been
> added to the main tank and all additional tanks.
>

The import to Subsurface is now implemented. The export is a bit more
"interesting" as we do not have concept of main tank. I think to just use
the first in the XML as the main cylinder and the others as additional.
Does this make sense?


> This will work in both directions off course and the API has already been
> updated, so feel free to try and play around.
>

I only have single tank dives, so I leave the testing to others.

miika
From 03113346b008df2fff36604abef296a6eace62a1 Mon Sep 17 00:00:00 2001
From: Miika Turkia <[email protected]>
Date: Sun, 12 Oct 2014 21:42:09 +0300
Subject: [PATCH] Support for importing additional tanks

This patch adds support for importing additional cylinders from
divelogs.de. This also adds support for He on the import.

Signed-off-by: Miika Turkia <[email protected]>
---
 xslt/divelogs.xslt | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/xslt/divelogs.xslt b/xslt/divelogs.xslt
index 2f191ae..067a726 100644
--- a/xslt/divelogs.xslt
+++ b/xslt/divelogs.xslt
@@ -75,11 +75,15 @@
         <xsl:value-of select="PARTNER"/>
       </buddy>
 
-      <!-- Helium? -->
       <cylinder>
         <xsl:attribute name="o2">
           <xsl:value-of select="O2PCT"/>
         </xsl:attribute>
+        <xsl:if test="HEPCT != ''">
+          <xsl:attribute name="he">
+            <xsl:value-of select="HEPCT"/>
+          </xsl:attribute>
+        </xsl:if>
         <xsl:attribute name="start">
           <xsl:value-of select="CYLINDERSTARTPRESSURE"/>
         </xsl:attribute>
@@ -101,6 +105,38 @@
         </xsl:attribute>
       </cylinder>
 
+      <xsl:for-each select="ADDITIONALTANKS/TANK">
+        <cylinder>
+          <xsl:attribute name="o2">
+            <xsl:value-of select="O2PCT"/>
+          </xsl:attribute>
+          <xsl:if test="HEPCT != ''">
+            <xsl:attribute name="he">
+              <xsl:value-of select="HEPCT"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:attribute name="start">
+            <xsl:value-of select="CYLINDERSTARTPRESSURE"/>
+          </xsl:attribute>
+          <xsl:attribute name="end">
+            <xsl:value-of select="CYLINDERENDPRESSURE"/>
+          </xsl:attribute>
+          <xsl:if test="CYLINDERSIZE != ''">
+            <xsl:attribute name="size">
+              <xsl:value-of select="format-number(CYLINDERSIZE + CYLINDERSIZE * DBLTANK, '#.##')"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:if test="WORKINGPRESSURE &gt; 0">
+            <xsl:attribute name="workpressure">
+              <xsl:value-of select="WORKINGPRESSURE"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:attribute name="description">
+            <xsl:value-of select="CYLINDERDESCRIPTION"/>
+          </xsl:attribute>
+        </cylinder>
+      </xsl:for-each>
+
       <xsl:if test="WEIGHT != ''">
         <weightsystem>
           <xsl:attribute name="description">
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to