summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-04-02 14:27:43 +0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-02 06:29:25 -0500
commit7e47874adb88bf3ce318fa8331ded19d9f868da4 (patch)
tree3a1ba0fd595682479cf38c0d62f01ad0dcd5e39a /xslt
parent19400b8da19f90365cf3b6a4c9963184cc9e9073 (diff)
downloadsubsurface-7e47874adb88bf3ce318fa8331ded19d9f868da4.tar.gz
SDM import: fix logic for sample import
Seems that testing if BOOKMARK is empty is a bad idea. We end up not getting any samples, but the ones containing a bookmark. So we need to switch the logic to testing if BOOKMARK contains something and do those tasks first and otherwise grab a regular sample. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt')
-rw-r--r--xslt/SuuntoSDM.xslt56
1 files changed, 30 insertions, 26 deletions
diff --git a/xslt/SuuntoSDM.xslt b/xslt/SuuntoSDM.xslt
index 90cc5fdc5..d8d566643 100644
--- a/xslt/SuuntoSDM.xslt
+++ b/xslt/SuuntoSDM.xslt
@@ -188,7 +188,36 @@
<!-- dive sample - all the depth and temp readings -->
<xsl:for-each select="SAMPLE">
<xsl:choose>
- <xsl:when test="BOOKMARK = ''">
+ <xsl:when test="BOOKMARK != ''">
+ <xsl:choose>
+ <xsl:when test="substring-before(BOOKMARK, ':') = 'Heading'">
+ <event name="heading">
+ <xsl:attribute name="value">
+ <xsl:value-of select="substring-before(substring-after(BOOKMARK, ': '), '°')"/>
+ </xsl:attribute>
+ <xsl:attribute name="time">
+ <xsl:call-template name="timeConvert">
+ <xsl:with-param name="timeSec" select="SAMPLETIME"/>
+ <xsl:with-param name="units" select="'si'"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </event>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="BOOKMARK != 'Surface'">
+ <event name="{BOOKMARK}">
+ <xsl:attribute name="time">
+ <xsl:call-template name="timeConvert">
+ <xsl:with-param name="timeSec" select="SAMPLETIME"/>
+ <xsl:with-param name="units" select="'si'"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </event>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
<sample>
<xsl:attribute name="time">
<xsl:call-template name="timeConvert">
@@ -211,31 +240,6 @@
</xsl:call-template>
</xsl:attribute>
</sample>
- </xsl:when>
- <xsl:when test="substring-before(BOOKMARK, ':') = 'Heading'">
- <event name="heading">
- <xsl:attribute name="value">
- <xsl:value-of select="substring-before(substring-after(BOOKMARK, ': '), '°')"/>
- </xsl:attribute>
- <xsl:attribute name="time">
- <xsl:call-template name="timeConvert">
- <xsl:with-param name="timeSec" select="SAMPLETIME"/>
- <xsl:with-param name="units" select="'si'"/>
- </xsl:call-template>
- </xsl:attribute>
- </event>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="BOOKMARK != 'Surface'">
- <event name="{BOOKMARK}">
- <xsl:attribute name="time">
- <xsl:call-template name="timeConvert">
- <xsl:with-param name="timeSec" select="SAMPLETIME"/>
- <xsl:with-param name="units" select="'si'"/>
- </xsl:call-template>
- </xsl:attribute>
- </event>
- </xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>