2014-03-01 23:17:32 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
|
|
|
<xsl:strip-space elements="*"/>
|
2014-12-31 20:09:38 +00:00
|
|
|
<xsl:param name="units" select="units"/>
|
2014-03-01 23:17:32 +00:00
|
|
|
<xsl:output method="text" encoding="UTF-8"/>
|
|
|
|
|
|
|
|
<xsl:variable name="fs">,</xsl:variable>
|
|
|
|
|
|
|
|
<xsl:template match="/divelog/dives">
|
2017-07-09 08:16:28 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 1">
|
2018-03-11 20:34:47 +00:00
|
|
|
<xsl:value-of select="concat('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"sample time (min)"', $fs, '"sample depth (ft)"', $fs, '"sample temperature (F)"', $fs, '"sample pressure (psi)"', $fs, '"sample heartrate"')"/>
|
2017-07-09 08:16:28 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2018-03-11 20:34:47 +00:00
|
|
|
<xsl:value-of select="concat('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"sample time (min)"', $fs, '"sample depth (m)"', $fs, '"sample temperature (C)"', $fs, '"sample pressure (bar)"', $fs, '"sample heartrate"')"/>
|
2017-07-09 08:16:28 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-03-01 23:17:32 +00:00
|
|
|
<xsl:text>
|
|
|
|
</xsl:text>
|
|
|
|
<xsl:apply-templates select="dive|trip/dive"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
2018-03-15 21:02:18 +00:00
|
|
|
<xsl:template match="divesites/site/notes"/>
|
|
|
|
|
2014-03-01 23:17:32 +00:00
|
|
|
<xsl:template match="dive">
|
|
|
|
<xsl:variable name="number">
|
|
|
|
<xsl:value-of select="@number"/>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="date">
|
|
|
|
<xsl:value-of select="@date"/>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="time">
|
|
|
|
<xsl:value-of select="@time"/>
|
|
|
|
</xsl:variable>
|
2014-12-31 20:09:39 +00:00
|
|
|
<xsl:for-each select="divecomputer[1]/sample|sample">
|
2014-03-01 23:17:32 +00:00
|
|
|
<xsl:value-of select="concat('"', $number, '"')"/>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:value-of select="concat('"', $date, '"')"/>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:value-of select="concat('"', $time, '"')"/>
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:value-of select="concat('"', substring-before(@time, ' '), '"')"/>
|
|
|
|
<xsl:value-of select="$fs"/>
|
2014-12-31 20:09:38 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 1">
|
2018-03-12 06:22:59 +00:00
|
|
|
<xsl:value-of select="concat('"', format-number(substring-before(@depth, ' ') div 0.3048, '#.###'), '"')"/>
|
2014-12-31 20:09:38 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2018-03-12 06:22:59 +00:00
|
|
|
<xsl:value-of select="concat('"', format-number(substring-before(@depth, ' '), '#.###'), '"')"/>
|
2014-12-31 20:09:38 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-03-01 23:17:32 +00:00
|
|
|
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:if test="@temp != ''">
|
2014-12-31 20:09:38 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 1">
|
2017-07-09 08:16:28 +00:00
|
|
|
<xsl:value-of select="concat('"', format-number((substring-before(@temp, ' ') * 1.8) + 32, '#.#'), '"')"/>
|
2014-12-31 20:09:38 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat('"', substring-before(@temp, ' '), '"')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-03-01 23:17:32 +00:00
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:if test="@pressure != ''">
|
2014-12-31 20:09:38 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 1">
|
2017-07-09 08:16:28 +00:00
|
|
|
<xsl:value-of select="concat('"', format-number((substring-before(@pressure, ' ') * 14.5037738007), '#'), '"')"/>
|
2014-12-31 20:09:38 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat('"', substring-before(@pressure, ' '), '"')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-03-01 23:17:32 +00:00
|
|
|
</xsl:if>
|
|
|
|
|
2018-03-11 20:34:47 +00:00
|
|
|
<xsl:value-of select="$fs"/>
|
|
|
|
<xsl:if test="@heartbeat != ''">
|
|
|
|
<xsl:value-of select="concat('"', @heartbeat, '"')"/>
|
|
|
|
</xsl:if>
|
|
|
|
|
2014-03-01 23:17:32 +00:00
|
|
|
<xsl:text>
|
|
|
|
</xsl:text>
|
|
|
|
</xsl:for-each>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|