[PATCH 2/3] Get information only from first line at each time

Miika Turkia miika.turkia at gmail.com
Thu Oct 17 12:05:28 UTC 2013


As some CSV log files seem to contain multiple sample lines for a single
time, we'll just grab the first one of them to avoid duplicates.

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

diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index f3ec101..f504572 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -28,9 +28,12 @@
   <xsl:template name="printLine">
     <xsl:param name="line"/>
     <xsl:param name="remaining"/>
-    <xsl:call-template name="printFields">
-      <xsl:with-param name="line" select="$line"/>
-    </xsl:call-template>
+
+    <xsl:if test="substring-before($line, $fs) != substring-before(substring-before($remaining, $lf), $fs)">
+      <xsl:call-template name="printFields">
+        <xsl:with-param name="line" select="$line"/>
+      </xsl:call-template>
+    </xsl:if>
     <xsl:if test="$remaining != ''">
       <xsl:call-template name="printLine">
         <xsl:with-param name="line" select="substring-before($remaining, $lf)"/>
-- 
1.8.1.2



More information about the subsurface mailing list