[PATCH 3/5] Export total weight on CSV export
Miika Turkia
miika.turkia at gmail.com
Fri Dec 26 06:11:36 PST 2014
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
xslt/xml2manualcsv.xslt | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt
index b206061..000149a 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('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"duration"', $fs, '"maxdepth"', $fs, '"avgdepth"', $fs, '"airtemp"', $fs, '"watertemp"', $fs, '"cylinder size"', $fs, '"startpressure"', $fs, '"endpressure"', $fs, '"o2"', $fs, '"he"', $fs, '"location"', $fs, '"gps"', $fs, '"divemaster"', $fs, '"buddy"', $fs, '"suit"', $fs, '"rating"', $fs, '"visibility"', $fs, '"notes"')"/>
+ <xsl:value-of select="concat('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"duration"', $fs, '"maxdepth"', $fs, '"avgdepth"', $fs, '"airtemp"', $fs, '"watertemp"', $fs, '"cylinder size"', $fs, '"startpressure"', $fs, '"endpressure"', $fs, '"o2"', $fs, '"he"', $fs, '"location"', $fs, '"gps"', $fs, '"divemaster"', $fs, '"buddy"', $fs, '"suit"', $fs, '"rating"', $fs, '"visibility"', $fs, '"notes"', $fs, '"weight"')"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="dive|trip/dive"/>
@@ -99,6 +101,21 @@
<xsl:value-of select="$fs"/>
<xsl:text>""</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>"</xsl:text>
+ <xsl:if test="weightsystem">
+ <xsl:value-of select="concat(sum(xt:node-set($trimmedweightlist)/node()), ' kg')"/>
+ </xsl:if>
+ <xsl:text>"</xsl:text>
+
<xsl:text>
</xsl:text>
</xsl:template>
--
1.9.1
More information about the subsurface
mailing list