[PATCH] Add 'trip' support to UDDF export

Martin Long martin at longhome.co.uk
Wed Dec 10 14:46:53 PST 2014


Currently repetition groups are used to group dives into trips. This
is not really correct. Repetition groups should really represent a
group of dives where tissue loading needs to be preserved between
dives (typically the same day).

UDDF has support for trips, using the <divetrip> tags. This is a
bidirectional link between the dives and the trips.

This patch adds support for these trips. However, it leaves in the
repetition groups. Repetition groups may need further consideration.

Signed-off-by: Martin Long <martin at longhome.co.uk>
---
 xslt/uddf-export.xslt | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt
index d4683ee..341155a 100644
--- a/xslt/uddf-export.xslt
+++ b/xslt/uddf-export.xslt
@@ -149,6 +149,7 @@
       </gasdefinitions>
 
       <profiledata>
+        
         <xsl:for-each select="trip">
           <repetitiongroup id="{generate-id(.)}">
             <xsl:apply-templates select="dive"/>
@@ -160,6 +161,11 @@
           </repetitiongroup>
         </xsl:for-each>
       </profiledata>
+
+      <divetrip>
+        <xsl:apply-templates select="//trip"/>
+      </divetrip>
+
     </uddf>
   </xsl:template>
 
@@ -260,6 +266,9 @@
             <xsl:value-of select="sum(xt:node-set($trimmedweightlist)/weight)"/>
           </leadquantity>
         </equipmentused>
+        <xsl:if test="parent::trip">
+          <tripmembership><xsl:value-of select="../@location"/>&#xA0;<xsl:value-of select="../@date"/></tripmembership>
+        </xsl:if>
       </informationbeforedive>
 
       <samples>
@@ -573,7 +582,26 @@
     </dive>
   </xsl:template>
 
-
+  <xsl:template match="trip">
+      <trip id="{@location} {@date}">
+        <trippart>
+          <name><xsl:value-of select="@location"/>&#xA0;<xsl:value-of select="@date"/></name>
+          <relateddives>
+            <xsl:for-each select="dive">
+              <link ref="{generate-id(.)}"/>
+            </xsl:for-each>
+          </relateddives>
+          <xsl:if test="notes != ''">
+            <notes>
+              <para>
+                  <xsl:value-of select="notes"/>
+              </para>
+            </notes>
+          </xsl:if>
+        </trippart>
+      </trip>
+  </xsl:template>
+  
 <!-- Approximate waypoint depth.
      Parameters:
      timefirst    Time of the previous waypoint in seconds
-- 
1.9.1



More information about the subsurface mailing list