Divelogs.de export: split location on slash

As we join LOCATION with SITE on divelogs.de import using slash (/) as a
separator, we might as well split on last slash on export.

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-10-24 08:18:48 +03:00 committed by Dirk Hohndel
parent 997123c0a4
commit bf2df951e6

View file

@ -34,12 +34,34 @@
<DIVETIMESEC>
<xsl:value-of select="$duration"/>
</DIVETIMESEC>
<xsl:variable name="uuid">
<xsl:value-of select="@divesiteid"/>
</xsl:variable>
<LOCATION>
<xsl:variable name="uuid">
<xsl:value-of select="@divesiteid"/>
</xsl:variable>
<xsl:variable name="location">
<xsl:value-of select="//site[@uuid = $uuid]/@name"/>
</LOCATION>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($location, '/')">
<xsl:variable name="site">
<xsl:call-template name="basename">
<xsl:with-param name="value" select="$location"/>
</xsl:call-template>
</xsl:variable>
<SITE>
<xsl:value-of select="$site"/>
</SITE>
<LOCATION>
<xsl:value-of select="substring($location, 0, string-length($location) - string-length($site))"/>
</LOCATION>
</xsl:when>
<xsl:otherwise>
<SITE>
<xsl:value-of select="$location"/>
</SITE>
</xsl:otherwise>
</xsl:choose>
<WATERVIZIBILITY>
<xsl:value-of select="@visibility"/>
</WATERVIZIBILITY>
@ -412,4 +434,19 @@
</xsl:template>
<xsl:template name="basename">
<xsl:param name="value" />
<xsl:choose>
<xsl:when test="contains($value, '/')">
<xsl:call-template name="basename">
<xsl:with-param name="value" select="substring-after($value, '/')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>