Support for new data format for MacDive

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2015-05-04 20:03:22 +03:00 committed by Dirk Hohndel
parent 4c588c1f00
commit 6cd71882f2

View file

@ -113,34 +113,63 @@
<xsl:value-of select="sampleInterval"/> <xsl:value-of select="sampleInterval"/>
</xsl:variable> </xsl:variable>
<location> <xsl:choose>
<xsl:for-each select="country|location|site"> <xsl:when test="site/country|site/location|site/name|site/lat|site/lon">
<xsl:choose> <location debug="true">
<xsl:when test="following-sibling::location[1] != ''"> <xsl:for-each select="site/country|site/location|site/name">
<xsl:value-of select="concat(., ' / ')"/> <xsl:choose>
</xsl:when> <xsl:when test="following-sibling::location[1] != ''">
<xsl:when test="following-sibling::site[1] != ''"> <xsl:value-of select="concat(., ' / ')"/>
<xsl:value-of select="concat(., ' / ')"/> </xsl:when>
</xsl:when> <xsl:when test="following-sibling::name[1] != ''">
<xsl:otherwise> <xsl:value-of select="concat(., ' / ')"/>
<xsl:value-of select="."/> </xsl:when>
</xsl:otherwise> <xsl:otherwise>
</xsl:choose> <xsl:value-of select="."/>
</xsl:for-each> </xsl:otherwise>
</location> </xsl:choose>
</xsl:for-each>
</location>
<!-- This will discard GPS coordinates of 0 0 but I suppose that <!-- This will discard GPS coordinates of 0 0 but I suppose that
is better than all non-gps dives to be in that location --> is better than all non-gps dives to be in that location -->
<xsl:if test="sitelat != 0"> <xsl:if test="site/lat != 0">
<gps> <gps>
<xsl:value-of select="concat(sitelat, ' ', sitelon)"/> <xsl:value-of select="concat(site/lat, ' ', site/lon)"/>
</gps> </gps>
</xsl:if> </xsl:if>
<xsl:if test="siteLat != 0"> </xsl:when>
<gps> <xsl:otherwise>
<xsl:value-of select="concat(siteLat, ' ', siteLon)"/> <location>
</gps> <xsl:for-each select="country|location|site">
</xsl:if> <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> <notes>
<xsl:value-of select="notes"/> <xsl:value-of select="notes"/>