[PATCH] Grab also the last column in CSV when requested

Miika Turkia miika.turkia at gmail.com
Wed Jan 15 11:17:29 UTC 2014


Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/csv2xml.xslt | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 5c524f6..eb4c876 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -88,9 +88,6 @@
       </xsl:call-template>
     </xsl:variable>
 
-    <!-- First field should be dive time. If the value is not numeric,
-         we'll skip it. (We do also allow time in h:m:s notation.) -->
-
     <xsl:if test="number($value) = $value or number(substring-before($value, ':')) = substring-before($value, ':')">
       <sample>
         <xsl:attribute name="time">
@@ -192,7 +189,14 @@
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:value-of select="substring-before($line,$fs)"/>
+        <xsl:choose>
+          <xsl:when test="substring-before($line,$fs) != ''">
+            <xsl:value-of select="substring-before($line,$fs)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$line"/>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-- 
1.8.3.2



More information about the subsurface mailing list