summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-12-26 16:11:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-26 08:43:30 -0800
commite750eb1686db3280aacb0b5196840af706226909 (patch)
tree9805cff71bfcdcdf050f2a16a5e8e9e3dc7539cd /xslt
parent0b040b769de4f566c95abc5dcd2c3216b2f3c399 (diff)
downloadsubsurface-e750eb1686db3280aacb0b5196840af706226909.tar.gz
Export total weight on CSV export
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/xml2manualcsv.xslt21
1 files changed, 19 insertions, 2 deletions
diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt
index b2060615d..000149ac4 100644
--- a/xslt/xml2manualcsv.xslt
+++ b/xslt/xml2manualcsv.xslt
@@ -1,12 +1,14 @@
<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xt="http://www.jclark.com/xt"
+ extension-element-prefixes="xt" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output method="text" encoding="UTF-8"/>
<xsl:variable name="fs">,</xsl:variable>
<xsl:template match="/divelog/dives">
- <xsl:value-of select="concat('&quot;dive number&quot;', $fs, '&quot;date&quot;', $fs, '&quot;time&quot;', $fs, '&quot;duration&quot;', $fs, '&quot;maxdepth&quot;', $fs, '&quot;avgdepth&quot;', $fs, '&quot;airtemp&quot;', $fs, '&quot;watertemp&quot;', $fs, '&quot;cylinder size&quot;', $fs, '&quot;startpressure&quot;', $fs, '&quot;endpressure&quot;', $fs, '&quot;o2&quot;', $fs, '&quot;he&quot;', $fs, '&quot;location&quot;', $fs, '&quot;gps&quot;', $fs, '&quot;divemaster&quot;', $fs, '&quot;buddy&quot;', $fs, '&quot;suit&quot;', $fs, '&quot;rating&quot;', $fs, '&quot;visibility&quot;', $fs, '&quot;notes&quot;')"/>
+ <xsl:value-of select="concat('&quot;dive number&quot;', $fs, '&quot;date&quot;', $fs, '&quot;time&quot;', $fs, '&quot;duration&quot;', $fs, '&quot;maxdepth&quot;', $fs, '&quot;avgdepth&quot;', $fs, '&quot;airtemp&quot;', $fs, '&quot;watertemp&quot;', $fs, '&quot;cylinder size&quot;', $fs, '&quot;startpressure&quot;', $fs, '&quot;endpressure&quot;', $fs, '&quot;o2&quot;', $fs, '&quot;he&quot;', $fs, '&quot;location&quot;', $fs, '&quot;gps&quot;', $fs, '&quot;divemaster&quot;', $fs, '&quot;buddy&quot;', $fs, '&quot;suit&quot;', $fs, '&quot;rating&quot;', $fs, '&quot;visibility&quot;', $fs, '&quot;notes&quot;', $fs, '&quot;weight&quot;')"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="dive|trip/dive"/>
@@ -99,6 +101,21 @@
<xsl:value-of select="$fs"/>
<xsl:text>&quot;&quot;</xsl:text>
</xsl:if>
+
+ <xsl:variable name="trimmedweightlist">
+ <xsl:for-each select="weightsystem">
+ <weight>
+ <xsl:value-of select="substring-before(@weight, ' ')"/>
+ </weight>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:if test="weightsystem">
+ <xsl:value-of select="concat(sum(xt:node-set($trimmedweightlist)/node()), ' kg')"/>
+ </xsl:if>
+ <xsl:text>&quot;</xsl:text>
+
<xsl:text>
</xsl:text>
</xsl:template>