[PATCH 1/6] Grab divecomputer/temperature on CSV export

Miika Turkia miika.turkia at gmail.com
Mon Dec 22 13:04:02 PST 2014


If temperature is recorded by a DC it must be taken from under the
divecomputer tag. However, this will prefer the manually written value
if such exists.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/xml2manualcsv.xslt | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt
index fa3868c..93894a7 100644
--- a/xslt/xml2manualcsv.xslt
+++ b/xslt/xml2manualcsv.xslt
@@ -29,7 +29,14 @@
     <xsl:value-of select="@duration"/>
     <xsl:text>"</xsl:text>
     <xsl:apply-templates select="divecomputer/depth"/>
-    <xsl:apply-templates select="divetemperature"/>
+    <xsl:choose>
+      <xsl:when test="divetemperature/@air|divetemperature/@water != ''">
+        <xsl:apply-templates select="divetemperature"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="divecomputer[1]/temperature"/>
+      </xsl:otherwise>
+    </xsl:choose>
     <xsl:apply-templates select="cylinder"/>
     <xsl:apply-templates select="location"/>
     <xsl:apply-templates select="divemaster"/>
@@ -57,7 +64,7 @@
     <xsl:value-of select="@mean"/>
     <xsl:text>"</xsl:text>
   </xsl:template>
-  <xsl:template match="divetemperature">
+  <xsl:template match="divetemperature|temperature">
     <xsl:value-of select="$fs"/>
     <xsl:text>"</xsl:text>
     <xsl:value-of select="@air"/>
-- 
1.9.1



More information about the subsurface mailing list