2013-02-24 16:13:26 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
xmlns:u="http://www.streit.cc/uddf/3.2/"
|
2013-03-19 20:41:49 +00:00
|
|
|
xmlns:u1="http://www.streit.cc/uddf/3.1/"
|
2013-02-24 16:13:26 +00:00
|
|
|
exclude-result-prefixes="u"
|
|
|
|
version="1.0">
|
2013-02-27 18:36:34 +00:00
|
|
|
<xsl:import href="commonTemplates.xsl"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:strip-space elements="*"/>
|
|
|
|
<xsl:output method="xml" indent="yes"/>
|
|
|
|
|
|
|
|
<xsl:template match="/">
|
2013-03-08 18:12:38 +00:00
|
|
|
<divelog program="subsurface-import" version="2">
|
2013-03-02 07:22:08 +00:00
|
|
|
<settings>
|
|
|
|
<divecomputerid deviceid="ffffffff">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:apply-templates select="/uddf/generator|/u:uddf/u:generator|/u1:uddf/u1:generator"/>
|
2013-03-02 07:22:08 +00:00
|
|
|
</divecomputerid>
|
|
|
|
</settings>
|
2013-02-24 16:13:26 +00:00
|
|
|
<dives>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:apply-templates select="/uddf/profiledata/repetitiongroup/dive|/u:uddf/u:profiledata/u:repetitiongroup/u:dive|/u1:uddf/u1:profiledata/u1:repetitiongroup/u1:dive"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</dives>
|
|
|
|
</divelog>
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:template match="generator|u:generator|u1:generator">
|
|
|
|
<xsl:if test="manufacturer/name|u:manufacturer/u:name|u1:manufacturer/u1:name != ''">
|
2013-03-02 07:22:08 +00:00
|
|
|
<xsl:attribute name="model">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="name|u:name|u1:name"/>
|
2013-03-02 07:22:08 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="name|u:name|u1:name != ''">
|
2013-03-02 07:22:08 +00:00
|
|
|
<xsl:attribute name="firmware">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="manufacturer/name|/u:manufacturer/u:name|/u1:manufacturer/u1:name"/>
|
2013-03-02 07:22:08 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="version|u:version|u1:version != ''">
|
2013-03-02 07:22:08 +00:00
|
|
|
<xsl:attribute name="serial">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="version|u:version|u1:version"/>
|
2013-03-02 07:22:08 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
2013-02-24 16:13:26 +00:00
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:template match="gasdefinitions|u:gasdefinitions|u1:gasdefinitions">
|
|
|
|
<xsl:for-each select="mix|u:mix|u1:mix">
|
2013-02-24 16:13:26 +00:00
|
|
|
<cylinder>
|
|
|
|
<xsl:attribute name="description">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="name|u:name|u1:name"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
|
|
|
|
<xsl:attribute name="o2">
|
|
|
|
<xsl:call-template name="gasConvert">
|
|
|
|
<xsl:with-param name="mix">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="o2|u:o2|u1:o2"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
|
|
|
<xsl:attribute name="he">
|
|
|
|
<xsl:call-template name="gasConvert">
|
|
|
|
<xsl:with-param name="mix">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="he|u:he|u1:he"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</cylinder>
|
|
|
|
</xsl:for-each>
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:template match="dive|u:dive|u1:dive">
|
2013-02-24 16:13:26 +00:00
|
|
|
<dive>
|
2013-03-19 20:41:49 +00:00
|
|
|
<!-- Count the amount of temeprature samples during the dive -->
|
|
|
|
<xsl:variable name="temperatureSamples">
|
|
|
|
<xsl:call-template name="temperatureSamples" select="samples/waypoint/temperature|u:samples/u:waypoint/u:temperature|u1:samples/u1:waypoint/u1:temperature">
|
|
|
|
<xsl:with-param name="units" select="'Kelvin'"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="date != ''">
|
|
|
|
<xsl:attribute name="date">
|
|
|
|
<xsl:value-of select="concat(date/year,'-',format-number(date/month, '00'), '-', format-number(date/day, '00'))"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:value-of select="concat(format-number(time/hour, '00'), ':', format-number(time/minute, '00'))"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:when>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:when test="informationbeforedive/datetime|u:informationbeforedive/u:datetime|u1:informationbeforedive/u1:datetime != ''">
|
2013-02-27 18:36:34 +00:00
|
|
|
<xsl:call-template name="datetime">
|
|
|
|
<xsl:with-param name="value">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="informationbeforedive/datetime|u:informationbeforedive/u:datetime|u1:informationbeforedive/u1:datetime"/>
|
2013-02-27 18:36:34 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:when>
|
|
|
|
</xsl:choose>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:for-each select="lowesttemperature|informationafterdive/lowesttemperature|u:lowesttemperature|u:informationafterdive/u:lowesttemperature|u1:lowesttemperature|u1:informationafterdive/u1:lowesttemperature">
|
2013-02-24 16:13:26 +00:00
|
|
|
<temperature>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="$temperatureSamples > 0 or . != 273.15">
|
|
|
|
<xsl:attribute name="water">
|
|
|
|
<xsl:value-of select="concat(format-number(.- 273.15, '0.0'), ' C')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-02-24 16:13:26 +00:00
|
|
|
</temperature>
|
|
|
|
</xsl:for-each>
|
|
|
|
|
2013-03-02 11:10:38 +00:00
|
|
|
<divecomputer deviceid="ffffffff">
|
|
|
|
<xsl:attribute name="model">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="/uddf/generator/name|/u:uddf/u:generator/u:name|/u1:uddf/u1:generator/u1:name"/>
|
2013-03-02 11:10:38 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</divecomputer>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:apply-templates select="/uddf/gasdefinitions|/u:uddf/u:gasdefinitions|/u1:uddf/u1:gasdefinitions"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
<depth>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:for-each select="greatestdepth|informationafterdive/greatestdepth|u:greatestdepth|u:informationafterdive/u:greatestdepth|u1:greatestdepth|u1:informationafterdive/u1:greatestdepth">
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:attribute name="max">
|
|
|
|
<xsl:value-of select="concat(., ' m')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:for-each>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:for-each select="averagedepth|informationafterdive/averagedepth|u:averagedepth|u:informationafterdive/u:averagedepth|u1:averagedepth|u1:informationafterdive/u1:averagedepth">
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:attribute name="mean">
|
|
|
|
<xsl:value-of select="concat(., ' m')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:for-each>
|
|
|
|
</depth>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:for-each select="samples/waypoint/switchmix|u:samples/u:waypoint/u:switchmix|u1:samples/u1:waypoint/u1:switchmix">
|
2013-02-24 16:13:26 +00:00
|
|
|
<!-- Index to lookup gas per cent -->
|
|
|
|
<xsl:variable name="idx">
|
|
|
|
<xsl:value-of select="./@ref"/>
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<event name="gaschange" type="11">
|
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:call-template name="timeConvert">
|
|
|
|
<xsl:with-param name="timeSec">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="preceding-sibling::divetime|preceding-sibling::u:divetime|preceding-sibling::u1:divetime"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
|
|
|
<xsl:attribute name="value">
|
|
|
|
<xsl:call-template name="gasConvert">
|
|
|
|
<xsl:with-param name="mix">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="//gasdefinitions/mix[@id=$idx]/o2|//u:gasdefinitions/u:mix[@id=$idx]/u:o2|//u1:gasdefinitions/u1:mix[@id=$idx]/u1:o2"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</event>
|
|
|
|
</xsl:for-each>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:for-each select="samples/waypoint|u:samples/u:waypoint|u1:samples/u1:waypoint">
|
2013-02-24 16:13:26 +00:00
|
|
|
<sample>
|
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:call-template name="timeConvert">
|
|
|
|
<xsl:with-param name="timeSec">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="divetime|u:divetime|u1:divetime"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
|
|
|
<xsl:if test="depth != ''">
|
|
|
|
<xsl:attribute name="depth">
|
|
|
|
<xsl:value-of select="concat(depth, ' m')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="u:depth|u1:depth != ''">
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:attribute name="depth">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="concat(u:depth|u1:depth, ' m')"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="temperature != '' and $temperatureSamples > 0">
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:attribute name="temperature">
|
|
|
|
<xsl:value-of select="concat(format-number(temperature - 273.15, '0.0'), ' C')"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="u:temperature|u1:temperature != '' and $temperatureSamples > 0">
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:attribute name="temperature">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="concat(format-number(u:temperature|u1:temperature - 273.15, '0.0'), ' C')"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="otu|u:otu|u1:otu > 0">
|
2013-03-02 07:22:08 +00:00
|
|
|
<xsl:attribute name="otu">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="otu|u:otu|u1:otu"/>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="cns|u:cns|u1:cns > 0">
|
2013-02-24 16:13:26 +00:00
|
|
|
<xsl:attribute name="cns">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="concat(cns|u:cns|u1:cns, ' C')"/>
|
2013-03-02 07:22:08 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:if test="setpo2|u:setpo2|u1:setpo2 != ''">
|
2013-03-02 07:22:08 +00:00
|
|
|
<xsl:attribute name="po2">
|
|
|
|
<xsl:call-template name="convertPascal">
|
|
|
|
<xsl:with-param name="value">
|
2013-03-19 20:41:49 +00:00
|
|
|
<xsl:value-of select="setpo2|u:setpo2|u1:setpo2"/>
|
2013-03-02 07:22:08 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
2013-02-24 16:13:26 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
</sample>
|
|
|
|
</xsl:for-each>
|
|
|
|
</dive>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<!-- convert time in seconds to minutes:seconds -->
|
|
|
|
<xsl:template name="timeConvert">
|
|
|
|
<xsl:param name="timeSec"/>
|
|
|
|
<xsl:if test="$timeSec != ''">
|
|
|
|
<xsl:value-of select="concat(floor(number($timeSec) div 60), ':', format-number(floor(number($timeSec) mod 60), '00'), ' min')"/>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert time -->
|
|
|
|
|
|
|
|
<!-- convert gas -->
|
|
|
|
<xsl:template name="gasConvert">
|
|
|
|
<xsl:param name="mix"/>
|
|
|
|
<xsl:if test="$mix != ''">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$mix >= 0">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$mix > 1">
|
|
|
|
<xsl:value-of select="concat($mix, '%')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat($mix * 100, '%')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="$mix"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
<!-- end convert time -->
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|