[PATCH] Add required empty fields on CSV export

Miika Turkia miika.turkia at gmail.com
Mon Jan 5 04:07:53 PST 2015


We need to have empty field printed for every value on the CSV export.
Hopefully this is enough.

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

diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt
index e0cfb57..452da66 100644
--- a/xslt/xml2manualcsv.xslt
+++ b/xslt/xml2manualcsv.xslt
@@ -31,13 +31,31 @@
     <xsl:text>"</xsl:text>
     <xsl:value-of select="@duration"/>
     <xsl:text>"</xsl:text>
-    <xsl:apply-templates select="divecomputer[1]/depth"/>
+    <xsl:choose>
+      <xsl:when test="divecomputer[1]/depth != ''">
+        <xsl:apply-templates select="divecomputer[1]/depth"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$fs"/>
+        <xsl:text>""</xsl:text>
+        <xsl:value-of select="$fs"/>
+        <xsl:text>""</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
     <xsl:choose>
       <xsl:when test="divetemperature/@air|divetemperature/@water != ''">
         <xsl:apply-templates select="divetemperature"/>
       </xsl:when>
-      <xsl:otherwise>
+      <xsl:when test="divecomputer[1]/temperature != ''">
         <xsl:apply-templates select="divecomputer[1]/temperature"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- empty air temperature -->
+        <xsl:value-of select="$fs"/>
+        <xsl:text>""</xsl:text>
+        <!-- water temperature -->
+        <xsl:value-of select="$fs"/>
+        <xsl:text>""</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:choose>
-- 
1.9.1



More information about the subsurface mailing list