2013-03-10 07:52:20 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
2013-12-24 15:01:40 +00:00
|
|
|
<xsl:include href="commonTemplates.xsl"/>
|
2013-03-10 07:52:20 +00:00
|
|
|
<xsl:strip-space elements="*"/>
|
2013-04-09 02:25:04 +00:00
|
|
|
<xsl:output method="xml" encoding="UTF-8" indent="yes"
|
2013-03-14 15:20:12 +00:00
|
|
|
cdata-section-elements="LOCATION SITE WEATHER WATERVIZIBILITY PARTNER BOATNAME CYLINDERDESCRIPTION LOGNOTES"
|
|
|
|
/>
|
2013-03-10 07:52:20 +00:00
|
|
|
|
|
|
|
<xsl:template match="/divelog/dives">
|
|
|
|
<xsl:apply-templates select="dive"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="dive">
|
|
|
|
<DIVELOGSDATA>
|
|
|
|
<DIVELOGSNUMBER>
|
|
|
|
<xsl:value-of select="@number"/>
|
|
|
|
</DIVELOGSNUMBER>
|
|
|
|
<DATE>
|
|
|
|
<xsl:value-of select="concat(substring-after(substring-after(@date, '-'), '-'), '.', substring-before(substring-after(@date, '-'), '-'), '.', substring-before(@date, '-'))"/>
|
|
|
|
</DATE>
|
|
|
|
<TIME>
|
|
|
|
<xsl:value-of select="@time"/>
|
|
|
|
</TIME>
|
|
|
|
<DIVETIMESEC>
|
|
|
|
<xsl:call-template name="time2sec">
|
|
|
|
<xsl:with-param name="time">
|
|
|
|
<xsl:value-of select="@duration"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</DIVETIMESEC>
|
|
|
|
<LOCATION>
|
|
|
|
<xsl:value-of select="location"/>
|
|
|
|
</LOCATION>
|
|
|
|
<WATERVIZIBILITY>
|
|
|
|
<xsl:value-of select="@visibility"/>
|
|
|
|
</WATERVIZIBILITY>
|
|
|
|
<PARTNER>
|
|
|
|
<xsl:value-of select="buddy"/>
|
|
|
|
</PARTNER>
|
2014-07-16 03:20:21 +00:00
|
|
|
|
|
|
|
<!-- If there is a gas change event within the first few seconds
|
|
|
|
then we try to detect matching cylinder, otherwise the first
|
|
|
|
cylinder is used.
|
|
|
|
-->
|
|
|
|
<xsl:variable name="time">
|
|
|
|
<xsl:call-template name="time2sec">
|
|
|
|
<xsl:with-param name="time">
|
|
|
|
<xsl:value-of select="event[@name = 'gaschange']/@time"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<xsl:variable name="mix">
|
|
|
|
<xsl:value-of select="concat(event[@name = 'gaschange']/@value, '.0%')"/>
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<xsl:variable name="cylinder">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$time < 60">
|
|
|
|
<xsl:value-of select="count(cylinder[@o2 = $mix]/preceding-sibling::cylinder) + 1"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="1"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2013-03-10 07:52:20 +00:00
|
|
|
<CYLINDERDESCRIPTION>
|
2014-07-16 03:20:21 +00:00
|
|
|
<xsl:value-of select="cylinder[position() = $cylinder]/@description"/>
|
2013-03-10 07:52:20 +00:00
|
|
|
</CYLINDERDESCRIPTION>
|
2014-08-16 07:00:14 +00:00
|
|
|
|
|
|
|
<xsl:variable name="double">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="substring(cylinder[position() = $cylinder]/@description, 1, 1) = 'D' and substring-before(substring(cylinder[position() = $cylinder]/@description, 2), ' ') * 2 = substring-before(cylinder[position() = $cylinder]/@size, ' ')">
|
|
|
|
<xsl:value-of select="'2'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="'1'"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
<DBLTANK>
|
|
|
|
<xsl:value-of select="$double - 1"/>
|
|
|
|
</DBLTANK>
|
2013-03-10 07:52:20 +00:00
|
|
|
<CYLINDERSIZE>
|
2014-08-16 07:00:14 +00:00
|
|
|
<xsl:value-of select="substring-before(cylinder[position() = $cylinder]/@size, ' ') div $double"/>
|
2013-03-10 07:52:20 +00:00
|
|
|
</CYLINDERSIZE>
|
|
|
|
<CYLINDERSTARTPRESSURE>
|
2013-03-14 18:43:17 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="node()/sample/@pressure != ''">
|
|
|
|
<xsl:value-of select="substring-before(node()/sample/@pressure, ' ')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2014-07-16 03:20:21 +00:00
|
|
|
<xsl:value-of select="cylinder[position() = $cylinder]/@start"/>
|
2013-03-14 18:43:17 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-03-10 07:52:20 +00:00
|
|
|
</CYLINDERSTARTPRESSURE>
|
|
|
|
<CYLINDERENDPRESSURE>
|
2013-03-14 18:43:17 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="count(node()/sample[@pressure!='']) > 0">
|
2013-03-26 08:25:51 +00:00
|
|
|
<xsl:value-of select="node()/sample[@pressure][last()]/@pressure"/>
|
2013-03-14 18:43:17 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2014-07-16 11:04:15 +00:00
|
|
|
<xsl:value-of select="cylinder[position() = $cylinder]/@end"/>
|
2013-03-14 18:43:17 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-03-10 07:52:20 +00:00
|
|
|
</CYLINDERENDPRESSURE>
|
2014-07-16 03:20:21 +00:00
|
|
|
|
2014-10-12 19:19:26 +00:00
|
|
|
<ADDITIONALTANKS>
|
|
|
|
<xsl:for-each select="cylinder[position() != $cylinder]">
|
2014-12-13 13:12:37 +00:00
|
|
|
<xsl:variable name="gas">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="@o2 != ''">
|
|
|
|
<xsl:value-of select="substring-before(@o2, '.')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="'21'"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
2015-01-29 17:11:48 +00:00
|
|
|
<xsl:if test="following-sibling::divecomputer/event[@name='gaschange' and @value=$gas] or substring-before(@start, ' ') - 5 > substring-before(@end, ' ')">
|
2014-10-12 19:19:26 +00:00
|
|
|
<xsl:variable name="cur_cyl">
|
|
|
|
<xsl:value-of select="position()"/>
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<TANK>
|
|
|
|
<CYLINDERDESCRIPTION>
|
|
|
|
<xsl:value-of select="@description"/>
|
|
|
|
</CYLINDERDESCRIPTION>
|
|
|
|
|
|
|
|
<xsl:variable name="dbl">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="substring(@description, 1, 1) = 'D' and substring-before(substring(@description, 2), ' ') * 2 = substring-before(@size, ' ')">
|
|
|
|
<xsl:value-of select="'2'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="'1'"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
<DBLTANK>
|
|
|
|
<xsl:value-of select="$dbl - 1"/>
|
|
|
|
</DBLTANK>
|
|
|
|
<CYLINDERSIZE>
|
|
|
|
<xsl:value-of select="substring-before(@size, ' ') div $dbl"/>
|
|
|
|
</CYLINDERSIZE>
|
|
|
|
<CYLINDERSTARTPRESSURE>
|
|
|
|
<xsl:value-of select="@start"/>
|
|
|
|
</CYLINDERSTARTPRESSURE>
|
|
|
|
<CYLINDERENDPRESSURE>
|
|
|
|
<xsl:value-of select="@end"/>
|
|
|
|
</CYLINDERENDPRESSURE>
|
|
|
|
<O2PCT>
|
|
|
|
<xsl:value-of select="substring-before(@o2, '%')"/>
|
|
|
|
</O2PCT>
|
|
|
|
<HEPCT>
|
|
|
|
<xsl:value-of select="substring-before(@he, '%')"/>
|
|
|
|
</HEPCT>
|
|
|
|
</TANK>
|
2014-12-13 13:12:37 +00:00
|
|
|
</xsl:if>
|
2014-10-12 19:19:26 +00:00
|
|
|
</xsl:for-each>
|
|
|
|
</ADDITIONALTANKS>
|
|
|
|
|
2013-03-10 07:52:20 +00:00
|
|
|
<WEIGHT>
|
|
|
|
<xsl:call-template name="sum">
|
|
|
|
<xsl:with-param name="values" select="weightsystem/@weight"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</WEIGHT>
|
|
|
|
<O2PCT>
|
2014-07-16 11:04:15 +00:00
|
|
|
<xsl:value-of select="substring-before(cylinder[position() = $cylinder]/@o2, '%')"/>
|
2013-03-10 07:52:20 +00:00
|
|
|
</O2PCT>
|
2014-10-12 19:19:26 +00:00
|
|
|
<HEPCT>
|
|
|
|
<xsl:value-of select="substring-before(cylinder[position() = $cylinder]/@he, '%')"/>
|
|
|
|
</HEPCT>
|
2013-03-10 07:52:20 +00:00
|
|
|
<LOGNOTES>
|
|
|
|
<xsl:value-of select="notes"/>
|
|
|
|
</LOGNOTES>
|
|
|
|
<LAT>
|
|
|
|
<xsl:value-of select="substring-before(location/@gps, ' ')"/>
|
|
|
|
</LAT>
|
|
|
|
<LNG>
|
|
|
|
<xsl:value-of select="substring-after(location/@gps, ' ')"/>
|
|
|
|
</LNG>
|
|
|
|
<MAXDEPTH>
|
|
|
|
<xsl:value-of select="substring-before(node()/depth/@max, ' ')"/>
|
|
|
|
</MAXDEPTH>
|
|
|
|
<MEANDEPTH>
|
|
|
|
<xsl:value-of select="substring-before(node()/depth/@mean, ' ')"/>
|
|
|
|
</MEANDEPTH>
|
|
|
|
<AIRTEMP>
|
2014-02-17 18:23:03 +00:00
|
|
|
<xsl:value-of select="substring-before(node()/temperature/@air, ' ')"/>
|
2013-03-10 07:52:20 +00:00
|
|
|
</AIRTEMP>
|
|
|
|
<WATERTEMPMAXDEPTH>
|
|
|
|
<xsl:value-of select="substring-before(node()/temperature/@water, ' ')"/>
|
|
|
|
</WATERTEMPMAXDEPTH>
|
2014-04-08 19:31:45 +00:00
|
|
|
<xsl:variable name="manual">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="divecomputer/@model = 'manually added dive'">
|
|
|
|
<xsl:value-of select="1"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="0"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2013-03-10 07:52:20 +00:00
|
|
|
<SAMPLEINTERVAL>
|
2014-04-08 19:31:45 +00:00
|
|
|
<xsl:choose>
|
2015-04-30 23:48:06 +00:00
|
|
|
<xsl:when test="divecomputer/@model = 'Suunto EON Steel'">
|
|
|
|
<xsl:text>10</xsl:text>
|
2014-04-08 19:31:45 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2015-04-30 23:48:06 +00:00
|
|
|
<xsl:variable name="first">
|
|
|
|
<xsl:call-template name="time2sec">
|
|
|
|
<xsl:with-param name="time">
|
|
|
|
<xsl:value-of select="node()/sample[1]/@time"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="second">
|
|
|
|
<xsl:call-template name="time2sec">
|
|
|
|
<xsl:with-param name="time">
|
|
|
|
<xsl:value-of select="node()/sample[2]/@time"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$manual = 0">
|
|
|
|
<xsl:value-of select="$second - $first"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="60"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-04-08 19:31:45 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-03-10 07:52:20 +00:00
|
|
|
</SAMPLEINTERVAL>
|
2015-04-30 23:48:06 +00:00
|
|
|
|
2013-03-10 07:52:20 +00:00
|
|
|
<xsl:for-each select="divecomputer[1]/sample">
|
2014-04-08 19:31:45 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$manual = 1 and @time != '0:00 min'">
|
|
|
|
<xsl:variable name="timesecond">
|
|
|
|
<xsl:call-template name="time2sec">
|
|
|
|
<xsl:with-param name="time" select="@time"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="timefirst">
|
|
|
|
<xsl:call-template name="time2sec">
|
|
|
|
<xsl:with-param name="time" select="preceding-sibling::sample[1]/@time"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:call-template name="while">
|
|
|
|
<xsl:with-param name="until">
|
|
|
|
<xsl:value-of select="($timesecond - $timefirst) div 60 - 1"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="count">
|
|
|
|
<xsl:value-of select="0"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="timefirst">
|
|
|
|
<xsl:value-of select="$timefirst"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="timesecond">
|
|
|
|
<xsl:value-of select="$timesecond"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="depthsecond">
|
|
|
|
<xsl:call-template name="depth2mm">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="./@depth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="depthfirst">
|
|
|
|
<xsl:call-template name="depth2mm">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="preceding-sibling::sample[1]/@depth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
<!-- <name select="{concat(@time, ' - ', preceding-sibling::sample[1]/@time)}"/>-->
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<SAMPLE>
|
|
|
|
<DEPTH>
|
|
|
|
<xsl:value-of select="substring-before(./@depth, ' ')"/>
|
|
|
|
</DEPTH>
|
|
|
|
</SAMPLE>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-03-10 07:52:20 +00:00
|
|
|
</xsl:for-each>
|
|
|
|
</DIVELOGSDATA>
|
|
|
|
</xsl:template>
|
|
|
|
|
2014-04-08 19:31:45 +00:00
|
|
|
<xsl:template name="while">
|
|
|
|
<xsl:param name="timefirst"/>
|
|
|
|
<xsl:param name="timesecond"/>
|
|
|
|
<xsl:param name="depthfirst"/>
|
|
|
|
<xsl:param name="depthsecond"/>
|
|
|
|
<xsl:param name="count"/>
|
|
|
|
<xsl:param name="until"/>
|
|
|
|
|
|
|
|
<xsl:variable name="curdepth">
|
|
|
|
<xsl:value-of select="format-number(((($timefirst + 60) - $timefirst) div ($timesecond - $timefirst) * ($depthsecond - $depthfirst) + $depthfirst), '#.##')"/>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="curtime">
|
|
|
|
<xsl:value-of select="$timefirst + 60"/>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$count < $until">
|
|
|
|
<SAMPLE>
|
|
|
|
<DEPTH>
|
|
|
|
<xsl:value-of select="$curdepth div 1000"/>
|
|
|
|
</DEPTH>
|
|
|
|
</SAMPLE>
|
|
|
|
<xsl:call-template name="while">
|
|
|
|
<xsl:with-param name="timefirst" select="$curtime"/>
|
|
|
|
<xsl:with-param name="timesecond" select="$timesecond"/>
|
|
|
|
<xsl:with-param name="depthfirst" select="$curdepth"/>
|
|
|
|
<xsl:with-param name="depthsecond" select="$depthsecond"/>
|
|
|
|
<xsl:with-param name="count" select="$count + 1"/>
|
|
|
|
<xsl:with-param name="until" select="$until"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2014-04-08 20:08:58 +00:00
|
|
|
<xsl:if test="$curdepth > 0">
|
|
|
|
<SAMPLE>
|
|
|
|
<DEPTH>
|
|
|
|
<xsl:value-of select="$curdepth div 1000"/>
|
|
|
|
</DEPTH>
|
|
|
|
</SAMPLE>
|
|
|
|
</xsl:if>
|
2014-04-08 19:31:45 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-03-10 07:52:20 +00:00
|
|
|
</xsl:stylesheet>
|