summaryrefslogtreecommitdiffstats
path: root/xslt/csv2xml.xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-10-19 08:17:13 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-20 15:27:07 +0200
commit89770249d0c71d6670fc61abbdca65c284dc77c2 (patch)
tree1a12717204ea879be083505d66768badbd43a14e /xslt/csv2xml.xslt
parent3e485113185bf230ee408e921de958dfa804fc0e (diff)
downloadsubsurface-89770249d0c71d6670fc61abbdca65c284dc77c2.tar.gz
Add current date to CSV import
Since CSV import does not include date/time stamp, we need to generate one for ourselves. This patch uses current time of the import as dive time. 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.xslt8
1 files changed, 8 insertions, 0 deletions
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index f50457257..5c9abfe1e 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -5,6 +5,8 @@
<xsl:param name="timeField" select="timeField"/>
<xsl:param name="depthField" select="depthField"/>
<xsl:param name="tempField" select="tempField"/>
+ <xsl:param name="date" select="date"/>
+ <xsl:param name="time" select="time"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="lf"><xsl:text>
@@ -15,6 +17,12 @@
<divelog program="subsurface-import" version="2">
<dives>
<dive>
+ <xsl:attribute name="date">
+ <xsl:value-of select="concat(substring($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/>
+ </xsl:attribute>
+ <xsl:attribute name="time">
+ <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>
+ </xsl:attribute>
<divecomputerid deviceid="ffffffff" model="stone" />
<xsl:call-template name="printLine">
<xsl:with-param name="line" select="substring-before(//csv, $lf)"/>