2013-02-06 19:31:40 +00:00
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
|
|
|
<xsl:strip-space elements="*"/>
|
2015-05-06 14:38:43 +00:00
|
|
|
<xsl:include href="commonTemplates.xsl"/>
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:output method="xml" indent="yes"/>
|
|
|
|
|
|
|
|
<xsl:template match="/">
|
2013-03-08 18:12:38 +00:00
|
|
|
<divelog program='subsurface-import' version='2'>
|
2013-02-06 19:31:40 +00:00
|
|
|
<settings>
|
2013-03-02 11:10:38 +00:00
|
|
|
<xsl:for-each select="/dives/dive">
|
|
|
|
<divecomputerid deviceid="ffffffff">
|
|
|
|
<xsl:attribute name="model">
|
|
|
|
<xsl:value-of select="computer"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="serial">
|
|
|
|
<xsl:value-of select="serial"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</divecomputerid>
|
|
|
|
</xsl:for-each>
|
2013-02-06 19:31:40 +00:00
|
|
|
</settings>
|
|
|
|
<dives>
|
|
|
|
<xsl:apply-templates select="/dives/dive"/>
|
|
|
|
</dives>
|
|
|
|
</divelog>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="dive">
|
|
|
|
<xsl:variable name="units" select="/dives/units"/>
|
2013-02-27 16:05:40 +00:00
|
|
|
|
|
|
|
<!-- Count the amount of temeprature samples during the dive -->
|
|
|
|
<xsl:variable name="temperatureSamples">
|
|
|
|
<xsl:call-template name="temperatureSamples" select="/dives/dive/samples">
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<!-- Count the amount of pressure samples during the dive -->
|
|
|
|
<xsl:variable name="pressureSamples">
|
|
|
|
<xsl:call-template name="pressureSamples" select="/dives/dive/samples"/>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2013-02-06 19:31:40 +00:00
|
|
|
<dive>
|
|
|
|
<xsl:attribute name="number">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="divenumber != ''">
|
|
|
|
<xsl:value-of select="divenumber"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="diveNumber"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
2013-02-09 05:51:06 +00:00
|
|
|
<xsl:if test="rating != ''">
|
|
|
|
<xsl:attribute name="rating">
|
|
|
|
<xsl:value-of select="rating"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:attribute name="date">
|
|
|
|
<xsl:value-of select="date"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
|
|
|
<xsl:attribute name="duration">
|
|
|
|
<xsl:call-template name="timeConvert">
|
|
|
|
<xsl:with-param name="timeSec" select="duration"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
2015-05-04 17:03:25 +00:00
|
|
|
<xsl:attribute name="tags">
|
2015-05-05 12:31:26 +00:00
|
|
|
<xsl:for-each select="tags/tag|entryType">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="position() = 1">
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat(',', .)"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:for-each>
|
2015-05-04 17:03:25 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:variable name="delta">
|
|
|
|
<xsl:value-of select="sampleInterval"/>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2015-05-04 17:03:22 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="site/country|site/location|site/name|site/lat|site/lon">
|
|
|
|
<location debug="true">
|
|
|
|
<xsl:for-each select="site/country|site/location|site/name">
|
|
|
|
<xsl:choose>
|
2015-05-20 18:45:56 +00:00
|
|
|
<xsl:when test="following-sibling::location[1] != '' and . != ''">
|
2015-05-04 17:03:22 +00:00
|
|
|
<xsl:value-of select="concat(., ' / ')"/>
|
|
|
|
</xsl:when>
|
2015-05-20 18:45:56 +00:00
|
|
|
<xsl:when test="following-sibling::name[1] != '' and . != ''">
|
2015-05-04 17:03:22 +00:00
|
|
|
<xsl:value-of select="concat(., ' / ')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:for-each>
|
|
|
|
</location>
|
2013-02-06 19:31:40 +00:00
|
|
|
|
2013-02-27 16:05:40 +00:00
|
|
|
<!-- This will discard GPS coordinates of 0 0 but I suppose that
|
|
|
|
is better than all non-gps dives to be in that location -->
|
2015-05-04 17:03:22 +00:00
|
|
|
<xsl:if test="site/lat != 0">
|
|
|
|
<gps>
|
|
|
|
<xsl:value-of select="concat(site/lat, ' ', site/lon)"/>
|
|
|
|
</gps>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<location>
|
|
|
|
<xsl:for-each select="country|location|site">
|
|
|
|
<xsl:choose>
|
2015-05-20 18:45:56 +00:00
|
|
|
<xsl:when test="following-sibling::location[1] != '' and . != ''">
|
2015-05-04 17:03:22 +00:00
|
|
|
<xsl:value-of select="concat(., ' / ')"/>
|
|
|
|
</xsl:when>
|
2015-05-20 18:45:56 +00:00
|
|
|
<xsl:when test="following-sibling::site[1] != '' and . != ''">
|
2015-05-04 17:03:22 +00:00
|
|
|
<xsl:value-of select="concat(., ' / ')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:for-each>
|
|
|
|
</location>
|
|
|
|
|
|
|
|
<!-- This will discard GPS coordinates of 0 0 but I suppose that
|
|
|
|
is better than all non-gps dives to be in that location -->
|
|
|
|
<xsl:if test="sitelat != 0">
|
|
|
|
<gps>
|
|
|
|
<xsl:value-of select="concat(sitelat, ' ', sitelon)"/>
|
|
|
|
</gps>
|
|
|
|
</xsl:if>
|
|
|
|
<xsl:if test="siteLat != 0">
|
|
|
|
<gps>
|
|
|
|
<xsl:value-of select="concat(siteLat, ' ', siteLon)"/>
|
|
|
|
</gps>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-02-06 19:31:40 +00:00
|
|
|
|
|
|
|
<notes>
|
|
|
|
<xsl:value-of select="notes"/>
|
|
|
|
</notes>
|
|
|
|
|
|
|
|
<xsl:if test="o2percent != ''">
|
|
|
|
<cylinder>
|
|
|
|
<xsl:attribute name="o2">
|
|
|
|
<xsl:value-of select="concat(o2percent, '%')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</cylinder>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:for-each select="gases/gas">
|
|
|
|
<cylinder>
|
|
|
|
<xsl:if test="oxygen != ''">
|
|
|
|
<xsl:attribute name="o2">
|
|
|
|
<xsl:value-of select="concat(oxygen, '%')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
<xsl:if test="helium != ''">
|
|
|
|
<xsl:attribute name="he">
|
|
|
|
<xsl:value-of select="concat(helium, '%')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-27 16:05:40 +00:00
|
|
|
<xsl:if test="pressureStart > 0">
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:attribute name="start">
|
2013-02-07 19:20:03 +00:00
|
|
|
<xsl:call-template name="pressureConvert">
|
|
|
|
<xsl:with-param name="number" select="pressureStart"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-27 16:05:40 +00:00
|
|
|
<xsl:if test="pressureEnd > 0">
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:attribute name="end">
|
2013-02-07 19:20:03 +00:00
|
|
|
<xsl:call-template name="pressureConvert">
|
|
|
|
<xsl:with-param name="number" select="pressureEnd"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-27 16:05:40 +00:00
|
|
|
<xsl:if test="tankSize > 0">
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:attribute name="size">
|
2013-02-09 05:51:06 +00:00
|
|
|
<xsl:call-template name="sizeConvert">
|
|
|
|
<xsl:with-param name="singleSize" select="tankSize"/>
|
|
|
|
<xsl:with-param name="double" select="double"/>
|
|
|
|
<xsl:with-param name="pressure" select="workingPressure"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-27 16:05:40 +00:00
|
|
|
<xsl:if test="workingPressure > 0">
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:attribute name="workpressure">
|
2013-02-07 19:20:03 +00:00
|
|
|
<xsl:call-template name="pressureConvert">
|
|
|
|
<xsl:with-param name="number" select="workingPressure"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-09 05:51:06 +00:00
|
|
|
<xsl:if test="tankName != ''">
|
|
|
|
<xsl:attribute name="description">
|
|
|
|
<xsl:value-of select="tankName"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-06 19:31:40 +00:00
|
|
|
</cylinder>
|
|
|
|
</xsl:for-each>
|
|
|
|
|
2015-05-06 14:38:44 +00:00
|
|
|
<xsl:for-each select="gases/gas">
|
|
|
|
<event name="gaschange">
|
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:call-template name="sec2time">
|
|
|
|
<xsl:with-param name="timeSec">
|
|
|
|
<xsl:value-of select="sum(preceding-sibling::gas/duration)"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="value">
|
|
|
|
<xsl:value-of select="helium * 65536 + oxygen"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</event>
|
|
|
|
</xsl:for-each>
|
|
|
|
|
2015-05-04 17:03:23 +00:00
|
|
|
<xsl:if test="diveMaster">
|
|
|
|
<divemaster>
|
|
|
|
<xsl:value-of select="diveMaster"/>
|
|
|
|
</divemaster>
|
|
|
|
</xsl:if>
|
|
|
|
<buddy>
|
|
|
|
<xsl:for-each select="buddies/buddy">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="following-sibling::*[1] != ''">
|
|
|
|
<xsl:value-of select="concat(., ', ')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:for-each>
|
|
|
|
</buddy>
|
|
|
|
|
|
|
|
<xsl:if test="weight != ''">
|
|
|
|
<weightsystem>
|
|
|
|
<xsl:attribute name="weight">
|
|
|
|
<xsl:call-template name="weightConvert">
|
|
|
|
<xsl:with-param name="weight" select="translate(weight, ',', '.')"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="description">
|
|
|
|
<xsl:value-of select="'unknown'"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</weightsystem>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<divecomputer deviceid="ffffffff">
|
|
|
|
<xsl:attribute name="model">
|
|
|
|
<xsl:value-of select="computer"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="maxdepth != ''">
|
|
|
|
<depth>
|
|
|
|
<xsl:attribute name="max">
|
|
|
|
<xsl:call-template name="depthConvert">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="maxdepth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="mean">
|
|
|
|
<xsl:call-template name="depthConvert">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="avgdepth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</depth>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<depth>
|
|
|
|
<xsl:attribute name="max">
|
|
|
|
<xsl:call-template name="depthConvert">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="maxDepth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="mean">
|
|
|
|
<xsl:call-template name="depthConvert">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="averageDepth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</depth>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2015-05-04 17:03:23 +00:00
|
|
|
|
2015-05-04 17:03:24 +00:00
|
|
|
<temperature>
|
2013-02-27 16:05:40 +00:00
|
|
|
|
2015-05-04 17:03:24 +00:00
|
|
|
<!-- If we have temperature reading and it is non-zero, we use
|
2013-02-27 16:05:40 +00:00
|
|
|
it. If the temperature is zero, we only use it if we have
|
|
|
|
temperature samples from the dive. -->
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:if test="tempAir != ''">
|
|
|
|
<xsl:variable name="air">
|
|
|
|
<xsl:call-template name="tempConvert">
|
|
|
|
<xsl:with-param name="temp" select="tempAir"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="substring-before($air, ' ') != 0 or $temperatureSamples > 0">
|
|
|
|
<xsl:attribute name="air">
|
|
|
|
<xsl:value-of select="$air"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-27 16:05:40 +00:00
|
|
|
</xsl:if>
|
|
|
|
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:if test="tempLow != ''">
|
|
|
|
<xsl:variable name="water">
|
|
|
|
<xsl:call-template name="tempConvert">
|
|
|
|
<xsl:with-param name="temp" select="tempLow"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="substring-before($water, ' ') != 0 or $temperatureSamples > 0">
|
|
|
|
<xsl:attribute name="water">
|
|
|
|
<xsl:value-of select="$water"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-27 16:05:40 +00:00
|
|
|
</xsl:if>
|
2013-02-06 19:31:40 +00:00
|
|
|
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:if test="tempair != ''">
|
|
|
|
<xsl:variable name="air">
|
|
|
|
<xsl:call-template name="tempConvert">
|
|
|
|
<xsl:with-param name="temp" select="tempair"/>
|
2013-02-09 05:51:06 +00:00
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2015-05-04 17:03:24 +00:00
|
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="substring-before($air, ' ') != 0 or $temperatureSamples > 0">
|
|
|
|
<xsl:attribute name="air">
|
|
|
|
<xsl:value-of select="$air"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:if>
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:if test="templow != ''">
|
|
|
|
<xsl:variable name="water">
|
2013-02-27 05:01:22 +00:00
|
|
|
<xsl:call-template name="tempConvert">
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:with-param name="temp" select="temlow"/>
|
2013-02-27 05:01:22 +00:00
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2015-05-04 17:03:24 +00:00
|
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="substring-before($water, ' ') != 0 or $temperatureSamples > 0">
|
|
|
|
<xsl:attribute name="water">
|
|
|
|
<xsl:value-of select="$water"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:if>
|
2015-05-04 17:03:24 +00:00
|
|
|
</temperature>
|
2013-02-06 19:31:40 +00:00
|
|
|
|
2015-05-04 17:03:26 +00:00
|
|
|
<xsl:if test="current != ''">
|
|
|
|
<extradata key="current" value="{current}"/>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:if test="surfaceConditions != ''">
|
|
|
|
<extradata key="surfaceConditions" value="{surfaceConditions}"/>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:if test="entryType != ''">
|
|
|
|
<extradata key="entryType" value="{entryType}"/>
|
|
|
|
</xsl:if>
|
|
|
|
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:for-each select="samples/sample">
|
|
|
|
<sample>
|
2013-02-06 19:31:40 +00:00
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:call-template name="timeConvert">
|
|
|
|
<xsl:with-param name="timeSec">
|
|
|
|
<xsl:value-of select="time"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:attribute name="depth">
|
|
|
|
<xsl:call-template name="depthConvert">
|
|
|
|
<xsl:with-param name="depth">
|
|
|
|
<xsl:value-of select="depth"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:attribute>
|
2015-05-04 17:03:24 +00:00
|
|
|
<xsl:if test="pressure != '' and $pressureSamples > 0">
|
|
|
|
<xsl:attribute name="pressure">
|
|
|
|
<xsl:call-template name="pressureConvert">
|
|
|
|
<xsl:with-param name="number" select="pressure"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
<xsl:if test="temperature != '' and $temperatureSamples > 0">
|
|
|
|
<xsl:attribute name="temp">
|
|
|
|
<xsl:call-template name="tempConvert">
|
|
|
|
<xsl:with-param name="temp" select="temperature"/>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
</sample>
|
|
|
|
|
2015-05-06 14:38:45 +00:00
|
|
|
<xsl:if test="alarm != '' and alarm != gas_change">
|
2015-05-04 17:03:24 +00:00
|
|
|
<event>
|
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:call-template name="timeConvert">
|
|
|
|
<xsl:with-param name="timeSec">
|
|
|
|
<xsl:value-of select="time"/>
|
|
|
|
</xsl:with-param>
|
|
|
|
<xsl:with-param name="units" select="$units"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="name">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="alarm = 'attention'">
|
|
|
|
<xsl:value-of select="'violation'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="alarm = 'ascent_rate'">
|
|
|
|
<xsl:value-of select="'ascent'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="alarm = 'deep_stop'">
|
|
|
|
<xsl:value-of select="'deepstop'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="alarm = 'deco'">
|
|
|
|
<xsl:value-of select="'deco stop'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="alarm = 'po2_high'">
|
|
|
|
<xsl:value-of select="'PO2'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="alarm = 'tissue_warning'">
|
|
|
|
<xsl:value-of select="'tissue level warning'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="alarm = 'user_depth_alarm'">
|
|
|
|
<xsl:value-of select="'maxdepth'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="alarm"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
</event>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:for-each>
|
|
|
|
</divecomputer>
|
2013-02-06 19:31:40 +00:00
|
|
|
|
|
|
|
</dive>
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-02-07 19:20:03 +00:00
|
|
|
<!-- convert pressure to bars -->
|
|
|
|
<xsl:template name="pressureConvert">
|
|
|
|
<xsl:param name="number"/>
|
|
|
|
<xsl:param name="units"/>
|
|
|
|
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 'Imperial'">
|
2013-03-06 17:11:19 +00:00
|
|
|
<xsl:value-of select="concat(format-number(($number div 14.5037738007), '#.##'), ' bar')"/>
|
2013-02-07 19:20:03 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat($number, ' bar')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert pressure -->
|
|
|
|
|
2013-02-09 05:51:06 +00:00
|
|
|
<!-- convert cuft to litres -->
|
|
|
|
<xsl:template name="sizeConvert">
|
|
|
|
<xsl:param name="singleSize"/>
|
|
|
|
<xsl:param name="double"/>
|
|
|
|
<xsl:param name="pressure"/>
|
|
|
|
<xsl:param name="units"/>
|
|
|
|
|
|
|
|
<xsl:variable name="size">
|
2013-03-06 17:11:19 +00:00
|
|
|
<xsl:value-of select="format-number($singleSize + $singleSize * $double, '#.##')"/>
|
2013-02-09 05:51:06 +00:00
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 'Imperial'">
|
|
|
|
<xsl:if test="$pressure != '0'">
|
2013-03-06 17:11:19 +00:00
|
|
|
<xsl:value-of select="concat(format-number((($size * 14.7 div $pressure) div 0.035315), '#.##'), ' l')"/>
|
2013-02-09 05:51:06 +00:00
|
|
|
</xsl:if>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat($size, ' l')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert pressure -->
|
|
|
|
|
2013-02-27 16:05:40 +00:00
|
|
|
<!-- convert temperature from F to C -->
|
2013-02-27 05:01:22 +00:00
|
|
|
<xsl:template name="tempConvert">
|
|
|
|
<xsl:param name="temp"/>
|
|
|
|
<xsl:param name="units"/>
|
|
|
|
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 'Imperial'">
|
2013-03-07 19:57:21 +00:00
|
|
|
<xsl:if test="$temp != ''">
|
|
|
|
<xsl:value-of select="concat(format-number(($temp - 32) * 5 div 9, '0.0'), ' C')"/>
|
|
|
|
</xsl:if>
|
2013-02-27 05:01:22 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2013-03-07 19:57:21 +00:00
|
|
|
<xsl:if test="$temp != ''">
|
|
|
|
<xsl:value-of select="concat($temp, ' C')"/>
|
|
|
|
</xsl:if>
|
2013-02-27 05:01:22 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert temperature -->
|
|
|
|
|
2013-02-06 19:31:40 +00:00
|
|
|
<!-- convert time in seconds to minutes:seconds -->
|
|
|
|
<xsl:template name="timeConvert">
|
|
|
|
<xsl:param name="timeSec"/>
|
|
|
|
<xsl:param name="units"/>
|
|
|
|
|
|
|
|
<xsl:if test="$timeSec != ''">
|
2013-02-09 05:51:06 +00:00
|
|
|
<xsl:value-of select="concat(floor(number($timeSec) div 60), ':', format-number(floor(number($timeSec) mod 60), '00'), ' min')"/>
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert time -->
|
|
|
|
|
2013-02-09 05:51:06 +00:00
|
|
|
<!-- convert depth to meters -->
|
|
|
|
<xsl:template name="depthConvert">
|
|
|
|
<xsl:param name="depth"/>
|
|
|
|
<xsl:param name="units"/>
|
|
|
|
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 'Imperial'">
|
2013-03-06 17:11:19 +00:00
|
|
|
<xsl:value-of select="concat(format-number(($depth * 0.3048), '#.##'), ' m')"/>
|
2013-02-09 05:51:06 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat($depth, ' m')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert depth -->
|
|
|
|
|
|
|
|
<!-- convert weight to kg -->
|
|
|
|
<xsl:template name="weightConvert">
|
|
|
|
<xsl:param name="weight"/>
|
|
|
|
<xsl:param name="units"/>
|
|
|
|
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$weight > 0">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 'Imperial'">
|
2013-03-06 17:11:19 +00:00
|
|
|
<xsl:value-of select="concat(format-number(($weight * 0.453592), '#.##'), ' kg')"/>
|
2013-02-09 05:51:06 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat($weight, ' kg')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="$weight"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert weight -->
|
|
|
|
|
2013-02-27 16:05:40 +00:00
|
|
|
<xsl:template name="pressureSamples">
|
|
|
|
<xsl:value-of select="count(descendant::pressure[. > 0])"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-02-06 19:31:40 +00:00
|
|
|
</xsl:stylesheet>
|