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>
This commit is contained in:
Miika Turkia 2016-04-02 14:27:43 +08:00 committed by Dirk Hohndel
parent 19400b8da1
commit 7e47874adb

View file

@ -188,30 +188,8 @@
<!-- dive sample - all the depth and temp readings -->
<xsl:for-each select="SAMPLE">
<xsl:choose>
<xsl:when test="BOOKMARK = ''">
<sample>
<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>
<xsl:attribute name="depth">
<xsl:value-of select="concat(translate(DEPTH, ',', '.'), ' m')"/>
</xsl:attribute>
<xsl:if test="TEMPERATURE &gt; 0">
<xsl:attribute name="temp">
<xsl:value-of select="TEMPERATURE"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="pressure">
<xsl:call-template name="pressure">
<xsl:with-param name="number" select="PRESSURE"/>
<xsl:with-param name="units" select="$units"/>
</xsl:call-template>
</xsl:attribute>
</sample>
</xsl:when>
<xsl:when test="BOOKMARK != ''">
<xsl:choose>
<xsl:when test="substring-before(BOOKMARK, ':') = 'Heading'">
<event name="heading">
<xsl:attribute name="value">
@ -238,6 +216,32 @@
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<sample>
<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>
<xsl:attribute name="depth">
<xsl:value-of select="concat(translate(DEPTH, ',', '.'), ' m')"/>
</xsl:attribute>
<xsl:if test="TEMPERATURE &gt; 0">
<xsl:attribute name="temp">
<xsl:value-of select="TEMPERATURE"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="pressure">
<xsl:call-template name="pressure">
<xsl:with-param name="number" select="PRESSURE"/>
<xsl:with-param name="units" select="$units"/>
</xsl:call-template>
</xsl:attribute>
</sample>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- dive sample -->