aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@nixu.fi>2013-11-21 04:02:10 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-21 04:24:20 -0800
commit5b0162d9d46cf4ac247eb65176a376360e3d2904 (patch)
tree35150f21f8dbab1abcec729e805ab43158546e85
parent995192c5fb6bd890741ef2da873da4befd2120c4 (diff)
downloadsubsurface-5b0162d9d46cf4ac247eb65176a376360e3d2904.tar.gz
Improve UDDF import
Some improvements on importing different versions of UDDF logs. Also include rating, gps coordinates and gas mixture in the import. Signed-off-by: Miika Turkia <miika.turkia@nixu.fi> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--xslt/uddf.xslt67
1 files changed, 53 insertions, 14 deletions
diff --git a/xslt/uddf.xslt b/xslt/uddf.xslt
index 274280169..bb7a554d6 100644
--- a/xslt/uddf.xslt
+++ b/xslt/uddf.xslt
@@ -126,19 +126,19 @@
</xsl:attribute>
</xsl:if>
- <xsl:if test="condition/visibility != '' and condition/visibility != 0">
+ <xsl:if test="condition/visibility|informationafterdive/visibility != '' and condition/visibility|informationafterdive/visibility != 0">
<xsl:attribute name="visibility">
<xsl:choose>
- <xsl:when test="condition/visibility &lt; 1">
+ <xsl:when test="condition/visibility|informationafterdive/visibility &lt; 1">
<xsl:value-of select="1"/>
</xsl:when>
- <xsl:when test="condition/visibility &lt;= 3">
+ <xsl:when test="condition/visibility|informationafterdive/visibility &lt;= 3">
<xsl:value-of select="2"/>
</xsl:when>
- <xsl:when test="condition/visibility &lt;= 5">
+ <xsl:when test="condition/visibility|informationafterdive/visibility &lt;= 5">
<xsl:value-of select="3"/>
</xsl:when>
- <xsl:when test="condition/visibility &lt;= 10">
+ <xsl:when test="condition/visibility|informationafterdive/visibility &lt;= 10">
<xsl:value-of select="4"/>
</xsl:when>
<xsl:otherwise>
@@ -148,41 +148,71 @@
</xsl:attribute>
</xsl:if>
- <xsl:if test="condition/air_temp != ''">
+ <xsl:if test="informationafterdive/rating/ratingvalue != '' and informationafterdive/rating/ratingvalue != 0">
+ <xsl:attribute name="rating">
+ <xsl:choose>
+ <xsl:when test="informationafterdive/rating/ratingvalue &lt; 2">
+ <xsl:value-of select="0"/>
+ </xsl:when>
+ <xsl:when test="informationafterdive/rating/ratingvalue &lt;= 2">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="informationafterdive/rating/ratingvalue &lt;= 4">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="informationafterdive/rating/ratingvalue &lt;= 6">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="informationafterdive/rating/ratingvalue &lt;= 8">
+ <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="condition/air_temp|informationbeforedive/airtemperature != ''">
<divetemperature>
<xsl:attribute name="air">
- <xsl:value-of select="concat(format-number(condition/air_temp - 273.15, '0.0'), ' C')"/>
+ <xsl:value-of select="concat(format-number(condition/air_temp|informationbeforedive/airtemperature - 273.15, '0.0'), ' C')"/>
</xsl:attribute>
</divetemperature>
</xsl:if>
- <xsl:if test="dive_site_ref/@ref != ''">
+ <xsl:if test="dive_site_ref/@ref|informationbeforedive/dive_site_ref/@ref != ''">
<location>
<xsl:variable name="ref">
- <xsl:value-of select="dive_site_ref/@ref"/>
+ <xsl:value-of select="dive_site_ref/@ref|informationbeforedive/dive_site_ref/@ref"/>
</xsl:variable>
+ <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>
<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>
+ </xsl:if>
</location>
</xsl:if>
- <xsl:if test="buddy_ref/@ref != ''">
+ <xsl:if test="buddy_ref/@ref|informationbeforedive/buddy_ref/@ref != ''">
<buddy>
<xsl:variable name="ref">
- <xsl:value-of select="buddy_ref/@ref"/>
+ <xsl:value-of select="buddy_ref/@ref|informationbeforedive/buddy_ref/@ref"/>
</xsl:variable>
- <xsl:for-each select="//diver[@id=$ref]/personal/first_name|//diver[@id=$ref]/personal/nick_name|//diver[@id=$ref]/personal/family_name">
+ <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">
<xsl:value-of select="."/>
<xsl:if test=". != '' and (following-sibling::*[1] != '' or following-sibling::*[2] != '')"> / </xsl:if>
</xsl:for-each>
</buddy>
</xsl:if>
- <xsl:if test="note/text != ''">
+ <xsl:if test="note/text|informationafterdive/notes/para != ''">
<notes>
- <xsl:value-of select="note/text"/>
+ <xsl:value-of select="note/text|informationafterdive/notes/para"/>
</notes>
</xsl:if>
@@ -216,12 +246,21 @@
<xsl:variable name="idx">
<xsl:value-of select="./tank_ref/@ref"/>
</xsl:variable>
+ <xsl:variable name="gas">
+ <xsl:value-of select="./gas_ref/@ref"/>
+ </xsl:variable>
<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>
+ <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>
<xsl:attribute name="start">
<xsl:value-of select="concat(substring-before(./pressure_start, '.') div 100000, ' bar')"/>
</xsl:attribute>