diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2016-05-02 20:11:33 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-05-02 10:24:52 -0700 |
commit | a480d28afd7702cb27e99765779cb70736cdea45 (patch) | |
tree | a4fdbbed8d0b0febf02d05fc06ba3998c5370e43 /xslt | |
parent | 98f93be0c4168d42a6b2f2fa9bd3fcc9f9d9a4f7 (diff) | |
download | subsurface-a480d28afd7702cb27e99765779cb70736cdea45.tar.gz |
CSV import: use date field on profile import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/csv2xml.xslt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt index 0f8362936..7dc4fa4be 100644 --- a/xslt/csv2xml.xslt +++ b/xslt/csv2xml.xslt @@ -2,6 +2,7 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="commonTemplates.xsl"/> <xsl:strip-space elements="*"/> + <xsl:param name="dateField" select="dateField"/> <xsl:param name="timeField" select="timeField"/> <xsl:param name="depthField" select="depthField"/> <xsl:param name="tempField" select="tempField"/> @@ -40,7 +41,17 @@ <dives> <dive> <xsl:attribute name="date"> - <xsl:value-of select="concat(substring($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/> + <xsl:choose> + <xsl:when test="$dateField >= 0"> + <xsl:call-template name="getFieldByIndex"> + <xsl:with-param name="index" select="$dateField"/> + <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($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/> + </xsl:otherwise> + </xsl:choose> </xsl:attribute> <xsl:attribute name="time"> <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/> |