.DLD generation for uploading to divelogs.de

This generates a .DLD file of selected dives to be uploaded to
divelogs.de. The actual upload functionality along with sensible user
interface is still to be implemented. However, the resulting file from
this patch is tested to work (as far as I can tell) using upload API of
divelogs.de.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2013-03-10 10:24:49 +02:00 committed by Dirk Hohndel
parent 7c6ff9f957
commit 42ea5e3510
4 changed files with 138 additions and 1 deletions

View file

@ -98,4 +98,30 @@
</xsl:choose>
</xsl:template>
<xsl:template name="time2sec">
<xsl:param name="time"/>
<xsl:value-of select="substring-before($time, ':') * 60 + substring-before(substring-after($time, ':'), ' ')"/>
</xsl:template>
<!-- Calculate sum of all parameters, and strip any unit following the
value -->
<xsl:template name="sum">
<xsl:param name="values"/>
<xsl:param name="sum" select="'0'"/>
<xsl:variable name="value" select="substring-before($values[1], ' ')"/>
<xsl:choose>
<xsl:when test="count($values) = 1">
<xsl:value-of select="format-number($value + $sum, '#.#')"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="sum">
<xsl:with-param name="values" select="$values[position() &gt; 1]"/>
<xsl:with-param name="sum" select="$sum + $value"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>