[PATCH 2/3] Default dive number on manual CSV import

Miika Turkia miika.turkia at gmail.com
Mon Nov 24 09:23:15 PST 2014


If manual CSV import does not have any dive number, give a default one
so that the dives get import and not silently ignored.

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

diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index 90691f4..be923ac 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -61,12 +61,17 @@
     <xsl:param name="line"/>
 
     <xsl:variable name="number">
-      <xsl:if test="$numberField >= 0">
-        <xsl:call-template name="getFieldByIndex">
-          <xsl:with-param name="index" select="$numberField"/>
-          <xsl:with-param name="line" select="$line"/>
-        </xsl:call-template>
-      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="$numberField >= 0">
+          <xsl:call-template name="getFieldByIndex">
+            <xsl:with-param name="index" select="$numberField"/>
+            <xsl:with-param name="line" select="$line"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="'0'"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
 
     <xsl:if test="$number >= 0">
-- 
1.9.1



More information about the subsurface mailing list