[PATCH] Support h:m:s format for duration on CSV import
Miika Turkia
miika.turkia at gmail.com
Fri Sep 23 22:18:03 PDT 2016
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
xslt/manualcsv2xml.xslt | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index 287524d..4e95d6f 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -183,7 +183,14 @@
<xsl:value-of select="$duration * 60"/>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="$duration"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($duration, translate($duration, ':', ''), '')) = 2">
+ <xsl:value-of select="concat(substring-before($duration, ':') * 60 + substring-before(substring-after($duration, ':'), ':'), ':', substring-after(substring-after($duration, ':'), ':'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$duration"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
--
2.5.0
More information about the subsurface
mailing list