2014-12-22 01:53:18 +00:00
|
|
|
<?xml version="1.0"?>
|
2014-12-26 14:11:36 +00:00
|
|
|
<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">
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:strip-space elements="*"/>
|
|
|
|
<xsl:output method="text" encoding="UTF-8"/>
|
|
|
|
|
|
|
|
<xsl:variable name="fs">,</xsl:variable>
|
|
|
|
|
|
|
|
<xsl:template match="/divelog/dives">
|
2014-12-26 14:11:36 +00:00
|
|
|
<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"')"/>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:text>
|
|
|
|
</xsl:text>
|
|
|
|
<xsl:apply-templates select="dive|trip/dive"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="dive">
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@number"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@date"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@time"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@duration"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-22 21:04:03 +00:00
|
|
|
<xsl:apply-templates select="divecomputer[1]/depth"/>
|
2014-12-22 21:04:02 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="divetemperature/@air|divetemperature/@water != ''">
|
|
|
|
<xsl:apply-templates select="divetemperature"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:apply-templates select="divecomputer[1]/temperature"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-12-22 21:04:04 +00:00
|
|
|
<xsl:choose>
|
2014-12-26 14:11:34 +00:00
|
|
|
<xsl:when test="cylinder[1]/@start|cylinder[1]/@end != ''">
|
|
|
|
<xsl:apply-templates select="cylinder[1]"/>
|
2014-12-22 21:04:04 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2014-12-26 14:11:35 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="cylinder[1]/@size"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-22 21:04:04 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="divecomputer[1]/sample[@pressure]/@pressure"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="divecomputer[1]/sample[@pressure][last()]/@pressure"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-26 14:11:35 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="cylinder[1]/@o2"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="cylinder[1]/@he"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-22 21:04:04 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:apply-templates select="location"/>
|
2014-12-22 21:04:05 +00:00
|
|
|
<xsl:if test="string-length(location) = 0">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>""</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>""</xsl:text>
|
|
|
|
</xsl:if>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:apply-templates select="divemaster"/>
|
2014-12-22 21:04:06 +00:00
|
|
|
<xsl:if test="string-length(divemaster) = 0">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>""</xsl:text>
|
|
|
|
</xsl:if>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:apply-templates select="buddy"/>
|
2014-12-22 21:04:06 +00:00
|
|
|
<xsl:if test="string-length(buddy) = 0">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>""</xsl:text>
|
|
|
|
</xsl:if>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:apply-templates select="suit"/>
|
2014-12-22 21:04:06 +00:00
|
|
|
<xsl:if test="string-length(suit) = 0">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>""</xsl:text>
|
|
|
|
</xsl:if>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@rating"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@visibility"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:apply-templates select="notes"/>
|
2014-12-22 21:04:06 +00:00
|
|
|
<xsl:if test="string-length(notes) = 0">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>""</xsl:text>
|
|
|
|
</xsl:if>
|
2014-12-26 14:11:36 +00:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:text>
|
|
|
|
</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="divecomputer/depth">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@max"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@mean"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
2014-12-22 21:04:02 +00:00
|
|
|
<xsl:template match="divetemperature|temperature">
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@air"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@water"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="cylinder">
|
2014-12-26 14:11:35 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@size"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-22 01:53:18 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@start"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@end"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-26 14:11:35 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@o2"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@he"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
2014-12-22 01:53:18 +00:00
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="location">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="@gps"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="divemaster">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="buddy">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="suit">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="notes">
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
<xsl:text>"</xsl:text>
|
|
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|