summaryrefslogtreecommitdiffstats
path: root/xslt/csv2xml.xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-05-02 20:11:36 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-05-02 10:25:07 -0700
commit7ec83ef02a7216bd2de19798d250df8540b90b38 (patch)
tree7be28957bafaabb2eeb0e4b344f438a189d65d8c /xslt/csv2xml.xslt
parenta83c674139562010e9b9ee281b121ed4434c8a5a (diff)
downloadsubsurface-7ec83ef02a7216bd2de19798d250df8540b90b38.tar.gz
CSV import: import time field if available
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/csv2xml.xslt')
-rw-r--r--xslt/csv2xml.xslt13
1 files changed, 12 insertions, 1 deletions
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 5c97b7aee..b196ae054 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -4,6 +4,7 @@
<xsl:strip-space elements="*"/>
<xsl:param name="dateField" select="dateField"/>
<xsl:param name="datefmt" select="datefmt"/>
+ <xsl:param name="starttimeField" select="starttimeField"/>
<xsl:param name="timeField" select="timeField"/>
<xsl:param name="depthField" select="depthField"/>
<xsl:param name="tempField" select="tempField"/>
@@ -87,7 +88,17 @@
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="time">
- <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>
+ <xsl:choose>
+ <xsl:when test="$starttimeField >= 0">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$starttimeField"/>
+ <xsl:with-param name="line" select="substring-after(substring-after(., $lf), $lf)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
<!-- If the dive is CCR, create oxygen and diluent cylinders -->