[PATCH 09/12] CSV import: support min.sec format

Miika Turkia miika.turkia at gmail.com
Sun Apr 24 11:11:22 PDT 2016


Assume a format containing a dot to be min.sec as defined in DL7
specification.

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

diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 5ce5847..0f83629 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -166,7 +166,15 @@
 
               <xsl:call-template name="sec2time">
                 <xsl:with-param name="timeSec">
-                  <xsl:value-of select="$value"/>
+                  <xsl:choose>
+                    <xsl:when test="substring-after($value, '.') != ''">
+                      <!-- Well, I suppose it was min.sec -->
+                      <xsl:value-of select="substring-before($value, '.') * 60 + substring-after($value, '.')" />
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <xsl:value-of select="$value"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
                 </xsl:with-param>
               </xsl:call-template>
             </xsl:when>
-- 
2.5.0



More information about the subsurface mailing list