aboutsummaryrefslogtreecommitdiffstats
path: root/xslt/xml2manualcsv.xslt
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-21 17:53:18 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-21 21:51:54 -0800
commit74f5842f0c324fdd2d0217e90c11da6c70319f6e (patch)
tree421927bd5a58ee3986ce6ebfe9dfc5dca215041e /xslt/xml2manualcsv.xslt
parent1ba4137fec5b7f83b37c9165e1081f4062c50052 (diff)
downloadsubsurface-74f5842f0c324fdd2d0217e90c11da6c70319f6e.tar.gz
Add second CSV export with dive details
This is intended to export all the details that someone might copy from a paper logbook. We need a matching import template to make this simple. This hasn't been well tested, I'm sure it will break when elements and attributes are missing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/xml2manualcsv.xslt')
-rw-r--r--xslt/xml2manualcsv.xslt114
1 files changed, 114 insertions, 0 deletions
diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt
new file mode 100644
index 000000000..fa3868cf8
--- /dev/null
+++ b/xslt/xml2manualcsv.xslt
@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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;startpressure&quot;', $fs, '&quot;endpressure&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:text>
+</xsl:text>
+ <xsl:apply-templates select="dive|trip/dive"/>
+ </xsl:template>
+
+ <xsl:template match="dive">
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@number"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@date"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@time"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@duration"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:apply-templates select="divecomputer/depth"/>
+ <xsl:apply-templates select="divetemperature"/>
+ <xsl:apply-templates select="cylinder"/>
+ <xsl:apply-templates select="location"/>
+ <xsl:apply-templates select="divemaster"/>
+ <xsl:apply-templates select="buddy"/>
+ <xsl:apply-templates select="suit"/>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@rating"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@visibility"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:apply-templates select="notes"/>
+ <xsl:text>
+</xsl:text>
+ </xsl:template>
+ <xsl:template match="divecomputer/depth">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@max"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@mean"/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="divetemperature">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@air"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@water"/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="cylinder">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@start"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@end"/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="location">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="@gps"/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="divemaster">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="buddy">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="suit">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+ <xsl:template match="notes">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+</xsl:stylesheet>