summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-01-25 20:09:11 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-25 12:02:13 -0800
commit7c43ca90353a547553423bf03f2e968d8db4b0a2 (patch)
treed46b09c1f0c01d3c8eda396cf7050324c542a5c1 /xslt
parent0f967063c0d4487ad71081564bfef139426c50b1 (diff)
downloadsubsurface-7c43ca90353a547553423bf03f2e968d8db4b0a2.tar.gz
Support for AM/PM time format on manual CSV 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/manualcsv2xml.xslt21
1 files changed, 17 insertions, 4 deletions
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index e7f295566..f771df56f 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -136,10 +136,23 @@
<xsl:attribute name="time">
<xsl:choose>
<xsl:when test="$timeField >= 0">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$timeField"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
+ <xsl:variable name="timef">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$timeField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($timef, 'AM')">
+ <xsl:value-of select="concat(substring-before($timef, ':') mod 12, ':', translate(substring-after($timef, ':'), ' AM', ''))"/>
+ </xsl:when>
+ <xsl:when test="contains($timef, 'PM')">
+ <xsl:value-of select="concat(substring-before($timef, ':') mod 12 + 12, ':', translate(substring-after($timef, ':'), ' PM', ''))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$timef"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>