mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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:
parent
997123c0a4
commit
bf2df951e6
1 changed files with 42 additions and 5 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue