summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-05-04 20:03:22 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-04 10:55:20 -0700
commit6cd71882f259d00501e4af66b1238e61978787d5 (patch)
tree2046c4ddde0e49f003fc7515144a9b29bb165c40
parent4c588c1f00393bf7ecb8aa69e50f677a4074538d (diff)
downloadsubsurface-6cd71882f259d00501e4af66b1238e61978787d5.tar.gz
Support for new data format for MacDive
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--xslt/MacDive.xslt79
1 files changed, 54 insertions, 25 deletions
diff --git a/xslt/MacDive.xslt b/xslt/MacDive.xslt
index 4d83006d5..c2c3ba187 100644
--- a/xslt/MacDive.xslt
+++ b/xslt/MacDive.xslt
@@ -113,34 +113,63 @@
<xsl:value-of select="sampleInterval"/>
</xsl:variable>
- <location>
- <xsl:for-each select="country|location|site">
- <xsl:choose>
- <xsl:when test="following-sibling::location[1] != ''">
- <xsl:value-of select="concat(., ' / ')"/>
- </xsl:when>
- <xsl:when test="following-sibling::site[1] != ''">
- <xsl:value-of select="concat(., ' / ')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </location>
+ <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>
+ <xsl:when test="following-sibling::location[1] != ''">
+ <xsl:value-of select="concat(., ' / ')"/>
+ </xsl:when>
+ <xsl:when test="following-sibling::name[1] != ''">
+ <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: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>
+ <xsl:when test="following-sibling::location[1] != ''">
+ <xsl:value-of select="concat(., ' / ')"/>
+ </xsl:when>
+ <xsl:when test="following-sibling::site[1] != ''">
+ <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>
<notes>
<xsl:value-of select="notes"/>