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-06-07 14:45:56 +00:00
exclude-result-prefixes="u u1"
2013-02-24 16:13:26 +00:00
version="1.0">
2013-12-24 15:01:40 +00:00
< xsl:include 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 >
2017-05-04 19:35:39 +00:00
< divecomputerid >
< xsl:attribute name = "deviceid" >
< xsl:value-of select = "/uddf/diver/owner/equipment/divecomputer/@id|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/@id|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/@id" / >
< / xsl:attribute >
2017-05-04 19:44:08 +00:00
< xsl:attribute name = "model" >
< xsl:value-of select = "/uddf/diver/owner/equipment/divecomputer/model|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/u:model|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/u1:model" / >
< / xsl:attribute >
< xsl:attribute name = "nickname" >
< xsl:value-of select = "/uddf/diver/owner/equipment/divecomputer/name|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/u:name|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/u1:name" / >
< / xsl:attribute >
2013-06-07 14:45:56 +00:00
< xsl:choose >
< xsl:when test = "/UDDF/history != ''" >
< xsl:apply-templates select = "/UDDF/history" / >
< / xsl:when >
< xsl:otherwise >
< xsl:apply-templates select = "/uddf/generator|/u:uddf/u:generator|/u1:uddf/u1:generator" / >
< / xsl:otherwise >
< / xsl:choose >
2013-03-02 07:22:08 +00:00
< / divecomputerid >
< / settings >
2013-02-24 16:13:26 +00:00
< dives >
2013-06-07 14:45:56 +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|/UDDF/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-06-07 14:45:56 +00:00
< xsl:template match = "modified" >
< xsl:if test = "application/name != ''" >
< xsl:attribute name = "model" >
< xsl:value-of select = "application/name" / >
< / xsl:attribute >
< / xsl:if >
< xsl:if test = "application/version != ''" >
< xsl:attribute name = "serial" >
< xsl:value-of select = "application/version" / >
< / xsl:attribute >
< / xsl:if >
< / xsl:template >
2013-03-19 20:41:49 +00:00
< xsl:template match = "dive|u:dive|u1:dive" >
2015-11-02 16:35:39 +00:00
< xsl:variable name = "tankdata" >
< xsl:value-of select = "count(//tankdata|//u:tankdata|//u1:tankdata)" / >
< / xsl:variable >
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" >
2013-06-07 14:45:56 +00:00
< xsl:call-template name = "temperatureSamples" select = "samples/waypoint/temperature|u:samples/u:waypoint/u:temperature|u1:samples/u1:waypoint/u1:temperature|samples/t" >
2013-03-19 20:41:49 +00:00
< 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 >
2014-12-13 20:00:27 +00:00
< xsl:if test = "dive_number|u:informationbeforedive/u:divenumber != ''" >
2013-06-07 14:45:56 +00:00
< xsl:attribute name = "number" >
2014-12-13 20:00:27 +00:00
< xsl:value-of select = "dive_number|u:informationbeforedive/u:divenumber" / >
2013-06-07 14:45:56 +00:00
< / xsl:attribute >
< / xsl:if >
2014-12-13 20:00:28 +00:00
< xsl:if test = "(dive_duration != '' and dive_duration != 0) or (u:informationafterdive/u:diveduration != '' and u:informationafterdive/u:diveduration != 0)" >
2013-06-07 14:45:56 +00:00
< xsl:attribute name = "duration" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
2014-12-13 20:00:28 +00:00
< xsl:value-of select = "dive_duration|u:informationafterdive/u:diveduration" / >
2013-06-07 14:45:56 +00:00
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< / xsl:if >
2013-02-24 16:13:26 +00:00
2014-12-13 20:00:30 +00:00
< xsl:if test = "condition/visibility|informationafterdive/visibility|u:informationafterdive/u:visibility != '' and condition/visibility|informationafterdive/visibility|u:informationafterdive/u:visibility != 0" >
2013-06-09 04:02:04 +00:00
< xsl:attribute name = "visibility" >
2013-06-09 04:47:52 +00:00
< xsl:choose >
2014-12-13 20:00:30 +00:00
< xsl:when test = "condition/visibility|informationafterdive/visibility|u:informationafterdive/u:visibility < 1" >
2013-06-09 04:47:52 +00:00
< xsl:value-of select = "1" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "condition/visibility|informationafterdive/visibility|u:informationafterdive/u:visibility <= 3" >
2013-06-09 04:47:52 +00:00
< xsl:value-of select = "2" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "condition/visibility|informationafterdive/visibility|u:informationafterdive/u:visibility <= 5" >
2013-06-09 04:47:52 +00:00
< xsl:value-of select = "3" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "condition/visibility|informationafterdive/visibility|u:informationafterdive/u:visibility <= 10" >
2013-06-09 04:47:52 +00:00
< xsl:value-of select = "4" / >
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = "5" / >
< / xsl:otherwise >
< / xsl:choose >
2013-06-09 04:02:04 +00:00
< / xsl:attribute >
< / xsl:if >
2014-12-13 20:00:30 +00:00
< xsl:if test = "informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue != '' and informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue != 0" >
2013-11-21 02:02:10 +00:00
< xsl:attribute name = "rating" >
< xsl:choose >
2014-12-13 20:00:30 +00:00
< xsl:when test = "informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue < 2" >
2013-11-21 02:02:10 +00:00
< xsl:value-of select = "0" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue <= 2" >
2013-11-21 02:02:10 +00:00
< xsl:value-of select = "1" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue <= 4" >
2013-11-21 02:02:10 +00:00
< xsl:value-of select = "2" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue <= 6" >
2013-11-21 02:02:10 +00:00
< xsl:value-of select = "3" / >
< / xsl:when >
2014-12-13 20:00:30 +00:00
< xsl:when test = "informationafterdive/rating/ratingvalue|u:informationafterdive/u:rating/u:ratingvalue <= 8" >
2013-11-21 02:02:10 +00:00
< xsl:value-of select = "4" / >
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = "5" / >
< / xsl:otherwise >
< / xsl:choose >
< / xsl:attribute >
< / xsl:if >
< xsl:if test = "dive_site_ref/@ref|informationbeforedive/dive_site_ref/@ref != ''" >
2013-06-09 04:02:04 +00:00
< location >
< xsl:variable name = "ref" >
2013-11-21 02:02:10 +00:00
< xsl:value-of select = "dive_site_ref/@ref|informationbeforedive/dive_site_ref/@ref" / >
2013-06-09 04:02:04 +00:00
< / xsl:variable >
2013-11-21 02:02:10 +00:00
< xsl:if test = "//dive_site[@id=$ref]/geography/gps/longitude != ''" >
< xsl:attribute name = "gps" >
< xsl:value-of select = "concat(//dive_site[@id=$ref]/geography/gps/latitude, ' ', //dive_site[@id=$ref]/geography/gps/longitude)" / >
< / xsl:attribute >
2013-06-09 04:02:04 +00:00
< xsl:for-each select = "//dive_site[@id=$ref]/geography/location|//dive_site[@id=$ref]/name" >
< xsl:value-of select = "." / >
< xsl:if test = ". != '' and following-sibling::*[1]/* != ''" > / < / xsl:if >
< / xsl:for-each >
2013-11-21 02:02:10 +00:00
< / xsl:if >
2013-06-09 04:02:04 +00:00
< / location >
< / xsl:if >
2014-12-13 20:00:35 +00:00
< xsl:for-each select = "u:informationbeforedive/u:link" >
< xsl:variable name = "ref" >
< xsl:value-of select = "@ref" / >
< / xsl:variable >
< xsl:if test = "//u:divesite/u:site[@id = $ref]/u:name" >
< location >
2017-05-03 18:56:51 +00:00
< xsl:choose >
2017-05-03 18:59:54 +00:00
< xsl:when test = "//u:divesite/u:site[@id=$ref]/u:geography/u:longitude != ''" >
< xsl:attribute name = "gps" >
< xsl:value-of select = "concat(//u:divesite/u:site[@id=$ref]/u:geography/u:latitude, ' ', //u:divesite/u:site[@id=$ref]/u:geography/u:longitude)" / >
< / xsl:attribute >
< xsl:value-of select = "//u:divesite/u:site[@id=$ref]/u:name" / >
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = "//u:divesite/u:site[@id=$ref]/u:name" / >
< / xsl:otherwise >
2017-05-03 18:56:51 +00:00
< / xsl:choose >
2014-12-13 20:00:35 +00:00
< / location >
< / xsl:if >
< / xsl:for-each >
2014-12-13 20:00:36 +00:00
< xsl:variable name = "buddies" >
< xsl:for-each select = "u:informationbeforedive/u:link" >
< xsl:variable name = "ref" >
< xsl:value-of select = "@ref" / >
< / xsl:variable >
< xsl:for-each select = "//u:diver/u:buddy[@id = $ref]/u:personal/u:firstname|//u:diver/u:buddy[@id = $ref]/u:personal/u:lastname" >
< xsl:value-of select = "." / >
< xsl:if test = "following-sibling::* != ''" >
< xsl:value-of select = "' '" / >
< / xsl:if >
< / xsl:for-each >
< xsl:variable name = "next" >
< xsl:value-of select = "following-sibling::u:link/@ref" / >
< / xsl:variable >
< xsl:if test = "//u:diver/u:buddy[@id = $next]/u:personal/u:firstname != ''" >
< xsl:value-of select = "', '" / >
< / xsl:if >
< / xsl:for-each >
< / xsl:variable >
< xsl:if test = "$buddies != ''" >
< buddy >
< xsl:value-of select = "$buddies" / >
< / buddy >
< / xsl:if >
2017-05-03 18:37:28 +00:00
< xsl:if test = "buddy_ref/@ref|informationbeforedive/buddy_ref/@ref|u:informationbeforedive/u:link/@ref != ''" >
2013-06-09 04:02:04 +00:00
< buddy >
< xsl:variable name = "ref" >
2017-05-03 18:37:28 +00:00
< xsl:value-of select = "buddy_ref/@ref|informationbeforedive/buddy_ref/@ref|u:informationbeforedive/u:link/@ref" / >
2013-06-09 04:02:04 +00:00
< / xsl:variable >
2017-05-03 18:37:28 +00:00
< xsl:for-each select = "//diver[@id=$ref]/personal/first_name|//diver[@id=$ref]/personal/nick_name|//diver[@id=$ref]/personal/family_name|//diver/buddy[@id=$ref]/personal/first_name|//diver/buddy[@id=$ref]/personal/nick_name|//diver/buddy[@id=$ref]/personal/family_name|//u:diver/u:buddy[@id=$ref]/u:personal/u:first_name|//u:diver/u:buddy[@id=$ref]/u:personal/u:nick_name|//u:diver/u:buddy[@id=$ref]/u:personal/u:family_name" >
2013-06-09 04:02:04 +00:00
< xsl:value-of select = "." / >
< xsl:if test = ". != '' and (following-sibling::*[1] != '' or following-sibling::*[2] != '')" > / < / xsl:if >
< / xsl:for-each >
< / buddy >
< / xsl:if >
2014-12-13 20:00:34 +00:00
< xsl:if test = "note/text|informationafterdive/notes/para|u:informationafterdive/u:notes/u:para != ''" >
2013-06-09 04:02:04 +00:00
< notes >
2014-12-13 20:00:34 +00:00
< xsl:value-of select = "note/text|informationafterdive/notes/para|u:informationafterdive/u:notes/u:para" / >
2013-06-09 04:02:04 +00:00
< / notes >
< / xsl:if >
2014-12-13 20:04:37 +00:00
< xsl:if test = "equipment_used/weight_used|u:informationafterdive/u:equipmentused/u:leadquantity > 0" >
2013-06-09 04:02:04 +00:00
< weightsystem description = "unknown" >
< xsl:attribute name = "weight" >
2014-12-13 20:04:37 +00:00
< xsl:value-of select = "concat(format-number(equipment_used/weight_used|u:informationafterdive/u:equipmentused/u:leadquantity, '0.0'), ' kg')" / >
2013-06-09 04:02:04 +00:00
< / xsl:attribute >
< / weightsystem >
< / xsl:if >
2014-12-13 20:00:31 +00:00
< temperature >
< xsl:for-each select = "lowesttemperature|informationafterdive/lowesttemperature|u:lowesttemperature|u:informationafterdive/u:lowesttemperature|u1:lowesttemperature|u1:informationafterdive/u1:lowesttemperature|condition/water_temp" >
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 >
2014-12-13 20:00:31 +00:00
< / xsl:for-each >
< xsl:if test = "condition/air_temp|informationbeforedive/airtemperature|u:informationbeforedive/u:airtemperature != ''" >
< xsl:attribute name = "air" >
< xsl:value-of select = "concat(format-number(condition/air_temp|informationbeforedive/airtemperature|u:informationbeforedive/u:airtemperature - 273.15, '0.0'), ' C')" / >
< / xsl:attribute >
< / xsl:if >
< / temperature >
2013-06-09 04:02:04 +00:00
< xsl:if test = "equipment_used/tank_used != ''" >
< xsl:for-each select = "equipment_used/tank_used" >
< cylinder >
< xsl:variable name = "idx" >
< xsl:value-of select = "./tank_ref/@ref" / >
< / xsl:variable >
2013-11-21 02:02:10 +00:00
< xsl:variable name = "gas" >
< xsl:value-of select = "./gas_ref/@ref" / >
< / xsl:variable >
2013-06-09 04:02:04 +00:00
< xsl:attribute name = "size" >
< xsl:value-of select = "//equipment[@id=$idx]/tank/volume" / >
< / xsl:attribute >
< xsl:attribute name = "description" >
< xsl:value-of select = "//equipment[@id=$idx]/general/name" / >
< / xsl:attribute >
2013-11-21 02:02:10 +00:00
< xsl:attribute name = "o2" >
< xsl:value-of select = "//gas_mix[@id=$gas]/o2" / >
< / xsl:attribute >
< xsl:attribute name = "he" >
< xsl:value-of select = "//gas_mix[@id=$gas]/he" / >
< / xsl:attribute >
2013-06-09 04:02:04 +00:00
< xsl:attribute name = "start" >
< xsl:value-of select = "concat(substring-before(./pressure_start, '.') div 100000, ' bar')" / >
< / xsl:attribute >
< xsl:attribute name = "end" >
< xsl:value-of select = "concat(substring-before(./pressure_end, '.') div 100000, ' bar')" / >
< / xsl:attribute >
< / cylinder >
< / xsl:for-each >
< / xsl:if >
2015-11-02 16:35:39 +00:00
< xsl:if test = "/uddf/gasdefinitions != '' and $tankdata = 0" >
2014-12-17 08:43:59 +00:00
< xsl:for-each select = "/uddf/gasdefinitions/mix" >
2014-12-19 16:07:30 +00:00
< cylinder description = "unknown" >
2014-12-17 08:43:59 +00:00
< xsl:attribute name = "o2" >
< xsl:value-of select = "concat(o2 * 100, '%')" / >
< / xsl:attribute >
< xsl:if test = "he > 0" >
< xsl:attribute name = "he" >
< xsl:value-of select = "concat(he * 100, '%')" / >
< / xsl:attribute >
< / xsl:if >
< / cylinder >
< / xsl:for-each >
< / xsl:if >
2013-12-28 07:05:37 +00:00
< xsl:for-each select = "tankdata|u:tankdata|u1:tankdata" >
< cylinder >
< xsl:variable name = "gas" >
< xsl:value-of select = "link/@ref|u:link/@ref|u1:link/@ref" / >
< / xsl:variable >
< xsl:if test = "tankvolume|u:tankvolume|u1:tankvolume != ''" >
< xsl:attribute name = "size" >
< xsl:value-of select = "tankvolume|u:tankvolume|u1:tankvolume" / >
< / xsl:attribute >
< / xsl:if >
< xsl:attribute name = "o2" >
< xsl:value-of select = "//gasdefinitions/mix[@id=$gas]/o2|//u:gasdefinitions/u:mix[@id=$gas]/u:o2|//u1:gasdefinitions/u1:mix[@id=$gas]/u1:o2" / >
< / xsl:attribute >
< xsl:attribute name = "he" >
< xsl:value-of select = "//gasdefinitions/mix[@id=$gas]/he|//u:gasdefinitions/u:mix[@id=$gas]/u:he|//u1:gasdefinitions/u1:mix[@id=$gas]/u1:he" / >
< / xsl:attribute >
< xsl:if test = "tankpressurebegin|u:tankpressurebegin|u1:tankpressurebegin != ''" >
< xsl:attribute name = "start" >
< xsl:value-of select = "concat(format-number(tankpressurebegin|u:tankpressurebegin|u1:tankpressurebegin div 100000, '#.#'), ' bar')" / >
< / xsl:attribute >
< / xsl:if >
< xsl:if test = "tankpressureend|u:tankpressureend|u1:tankpressureend != ''" >
< xsl:attribute name = "end" >
< xsl:value-of select = "concat(format-number(tankpressureend|u:tankpressureend|u1:tankpressureend div 100000, '#.#'), ' bar')" / >
< / xsl:attribute >
< / xsl:if >
< / cylinder >
< / xsl:for-each >
2014-12-17 05:36:37 +00:00
2017-05-04 19:35:39 +00:00
< divecomputer >
< xsl:attribute name = "deviceid" >
< xsl:value-of select = "/uddf/diver/owner/equipment/divecomputer/@id|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/@id|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/@id" / >
< / xsl:attribute >
2014-12-17 05:36:37 +00:00
< xsl:attribute name = "model" >
< xsl:value-of select = "/uddf/generator/name|/u:uddf/u:generator/u:name|/u1:uddf/u1:generator/u1:name|/UDDF/history/modified/application/name" / >
< / xsl:attribute >
2013-02-24 16:13:26 +00:00
< depth >
2013-06-07 14:45:56 +00:00
< xsl:for-each select = "greatestdepth|informationafterdive/greatestdepth|u:greatestdepth|u:informationafterdive/u:greatestdepth|u1:greatestdepth|u1:informationafterdive/u1:greatestdepth|max_depth" >
2013-02-24 16:13:26 +00:00
< xsl:attribute name = "max" >
2013-06-07 14:45:56 +00:00
< xsl:value-of select = "concat(format-number(., '0.00'), ' m')" / >
2013-02-24 16:13:26 +00:00
< / 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" >
2013-06-07 14:45:56 +00:00
< xsl:value-of select = "concat(format-number(., '0.00'), ' m')" / >
2013-02-24 16:13:26 +00:00
< / xsl:attribute >
< / xsl:for-each >
< / depth >
2013-06-09 04:02:04 +00:00
<!-- Aquadivelog gas switches require more lookups than other UDDF
formats I have seen -->
< xsl:for-each select = "samples/switch" >
< xsl:variable name = "tank_idx" >
< xsl:value-of select = "./@tank" / >
< / xsl:variable >
< xsl:variable name = "idx" >
2014-05-03 05:34:09 +00:00
< xsl:value-of select = "../../equipment_used/tank_used[@id=$tank_idx]/gas_ref/@ref" / >
2013-06-09 04:02:04 +00:00
< / xsl:variable >
2014-07-16 13:53:25 +00:00
< xsl:variable name = "type" >
< xsl:choose >
< xsl:when test = "translate(//gas_def/gas_mix[@id=$idx]/o2, ',', '.') > 0" >
< xsl:value-of select = "25" / > <!-- SAMPLE_EVENT_GASCHANGE2 -->
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = "11" / > <!-- SAMPLE_EVENT_GASCHANGE -->
< / xsl:otherwise >
< / xsl:choose >
< / xsl:variable >
< event name = "gaschange" type = "{$type}" >
2013-06-09 04:02:04 +00:00
< xsl:attribute name = "time" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
< xsl:value-of select = "following-sibling::t" / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< xsl:attribute name = "value" >
< xsl:call-template name = "gasConvert" >
< xsl:with-param name = "mix" >
2014-07-11 19:05:58 +00:00
< xsl:value-of select = "translate(//gas_def/gas_mix[@id=$idx]/o2, ',', '.')" / >
2013-06-09 04:02:04 +00:00
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< / event >
< / xsl:for-each >
<!-- Other gas switches than Aquadivelog -->
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 >
2014-07-16 13:53:25 +00:00
< xsl:variable name = "type" >
< xsl:choose >
< xsl:when test = "translate(//gasdefinitions/mix[@id=$idx]/he|//u:gasdefinitions/u:mix[@id=$idx]/u:he|//u1:gasdefinitions/u1:mix[@id=$idx]/u1:he, ',', '.') > 0" >
< xsl:value-of select = "25" / > <!-- SAMPLE_EVENT_GASCHANGE2 -->
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = "11" / > <!-- SAMPLE_EVENT_GASCHANGE -->
< / xsl:otherwise >
< / xsl:choose >
< / xsl:variable >
< event name = "gaschange" type = "{$type}" >
2013-02-24 16:13:26 +00:00
< xsl:attribute name = "time" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
2013-06-09 04:02:04 +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" >
2014-07-11 19:05:58 +00:00
< xsl:value-of select = "translate(//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-12-28 07:05:31 +00:00
< xsl:for-each select = "samples/waypoint/alarm|u:samples/u:waypoint/u:alarm|u1:samples/u1:waypoint/u1:alarm" >
< event >
< xsl:attribute name = "time" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
2014-12-13 20:00:32 +00:00
< xsl:value-of select = "preceding-sibling::divetime|preceding-sibling::u:divetime|preceding-sibling::u1:divetime|following-sibling::u:divetime" / >
2013-12-28 07:05:31 +00:00
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< xsl:attribute name = "name" >
< xsl:value-of select = "." / >
< / xsl:attribute >
< / event >
< / xsl:for-each >
< xsl:for-each select = "samples/waypoint/heading|u:samples/u:waypoint/u:heading|u1:samples/u1:waypoint/u1:heading" >
< event name = "heading" >
< xsl:attribute name = "time" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
< xsl:value-of select = "preceding-sibling::divetime|preceding-sibling::u:divetime|preceding-sibling::u1:divetime" / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< xsl:attribute name = "value" >
< xsl:value-of select = "." / >
< / xsl:attribute >
< / event >
< / xsl:for-each >
2013-06-07 14:45:56 +00:00
< xsl:for-each select = "samples/waypoint|u:samples/u:waypoint|u1:samples/u1:waypoint|samples/d" >
2015-11-03 16:12:48 +00:00
< xsl:if test = "./depth|./u:depth|./u1:depth != ''" >
2015-11-03 16:14:07 +00:00
< sample >
< xsl:attribute name = "time" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
< xsl:value-of select = "divetime|u:divetime|u1:divetime|preceding-sibling::t[1]" / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
2013-02-24 16:13:26 +00:00
2015-11-03 16:14:07 +00:00
< xsl:choose >
< xsl:when test = "depth != ''" >
< xsl:attribute name = "depth" >
< xsl:value-of select = "concat(format-number(depth, '0.00'), ' m')" / >
< / xsl:attribute >
< / xsl:when >
< xsl:when test = "u:depth|u1:depth != ''" >
< xsl:attribute name = "depth" >
< xsl:value-of select = "concat(format-number(u:depth|u1:depth, '0.00'), ' m')" / >
< / xsl:attribute >
< / xsl:when >
< xsl:when test = ". != 0" >
< xsl:attribute name = "depth" >
< xsl:value-of select = "concat(format-number(., '0.00'), ' m')" / >
< / xsl:attribute >
< / xsl:when >
< / xsl:choose >
< xsl:if test = "temperature != '' and $temperatureSamples > 0" >
< xsl:attribute name = "temp" >
< xsl:value-of select = "concat(format-number(temperature - 273.15, '0.0'), ' C')" / >
2013-06-09 04:02:04 +00:00
< / xsl:attribute >
2015-11-03 16:14:07 +00:00
< / xsl:if >
2013-02-24 16:13:26 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "u:temperature|u1:temperature != '' and $temperatureSamples > 0" >
< xsl:attribute name = "temp" >
< xsl:value-of select = "concat(format-number(u:temperature|u1:temperature - 273.15, '0.0'), ' C')" / >
< / xsl:attribute >
< / xsl:if >
2013-02-24 16:13:26 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "tankpressure|u:tankpressure|u1:tankpressure != ''" >
< xsl:attribute name = "pressure" >
< xsl:value-of select = "concat(format-number(tankpressure|u:tankpressure|u1:tankpressure div 100000, '0.0'), ' bar')" / >
< / xsl:attribute >
< / xsl:if >
2014-04-27 09:56:53 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "otu|u:otu|u1:otu > 0" >
< xsl:attribute name = "otu" >
< xsl:value-of select = "otu|u:otu|u1:otu" / >
< / xsl:attribute >
< / xsl:if >
2013-02-24 16:13:26 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "cns|u:cns|u1:cns > 0" >
< xsl:attribute name = "cns" >
< xsl:value-of select = "cns|u:cns|u1:cns" / >
< / xsl:attribute >
< / xsl:if >
2013-03-02 07:22:08 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "setpo2|u:setpo2|u1:setpo2 != ''" >
< xsl:attribute name = "po2" >
< xsl:call-template name = "convertPascal" >
< xsl:with-param name = "value" >
< xsl:value-of select = "setpo2|u:setpo2|u1:setpo2" / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< / xsl:if >
2014-08-20 21:42:18 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "nodecotime|u:nodecotime|u1:nodecotime > 0" >
< xsl:attribute name = "ndl" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
< xsl:value-of select = "nodecotime|u:nodecotime|u1:nodecotime" / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< / xsl:if >
2014-08-20 21:42:19 +00:00
2015-11-03 16:14:07 +00:00
< xsl:if test = "decostop|u:decostop|u1:decostop" >
< xsl:attribute name = "stoptime" >
< xsl:call-template name = "timeConvert" >
< xsl:with-param name = "timeSec" >
< xsl:value-of select = "decostop/@duration|u:decostop/@duration|u1:decostop/@duration" / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
< xsl:attribute name = "stopdepth" >
< xsl:value-of select = "decostop/@decodepth|u:decostop/@decodepth|u1:decostop/@decodepth" / >
< / xsl:attribute >
< xsl:attribute name = "in_deco" >
< xsl:choose >
< xsl:when test = "decostop/@kind|u:decostop/@kind|u1:decostop/@kind != 'mandatory'" >
< xsl:value-of select = "0" / >
< / xsl:when >
< xsl:otherwise >
< xsl:value-of select = "1" / >
< / xsl:otherwise >
< / xsl:choose >
< / xsl:attribute >
< / xsl:if >
< / sample >
< / xsl:if >
2013-02-24 16:13:26 +00:00
< / xsl:for-each >
2014-12-17 05:36:37 +00:00
< / divecomputer >
2013-02-24 16:13:26 +00:00
< / 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 >