Multi cylinder support for CSV export

Fixes #2830

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2020-05-18 18:29:37 +03:00 committed by Dirk Hohndel
parent 19cdab52b3
commit 889f36a57c

View file

@ -38,17 +38,19 @@
$fs)"/> $fs)"/>
<!-- Print cylinder info according to the amount of cylinders in dive --> <!-- Print cylinder info according to the amount of cylinders in dive -->
<xsl:value-of select="concat( <xsl:for-each select="dive/cylinder">
'&quot;cylinder size (cuft)&quot;', <xsl:value-of select="concat(
$fs, '&quot;cylinder size (cuft)&quot;',
'&quot;startpressure (psi)&quot;', $fs,
$fs, '&quot;startpressure (psi)&quot;',
'&quot;endpressure (psi)&quot;', $fs,
$fs, '&quot;endpressure (psi)&quot;',
'&quot;o2 (%)&quot;', $fs,
$fs, '&quot;o2 (%)&quot;',
'&quot;he (%)&quot;', $fs,
$fs)"/> '&quot;he (%)&quot;',
$fs)"/>
</xsl:for-each>
<!-- Print rest of the header --> <!-- Print rest of the header -->
<xsl:value-of select="concat( <xsl:value-of select="concat(
@ -98,17 +100,19 @@
$fs)"/> $fs)"/>
<!-- Print cylinder info according to the amount of cylinders in dive --> <!-- Print cylinder info according to the amount of cylinders in dive -->
<xsl:value-of select="concat( <xsl:for-each select="dive/cylinder">
'&quot;cylinder size (l)&quot;', <xsl:value-of select="concat(
$fs, '&quot;cylinder size (l)&quot;',
'&quot;startpressure (bar)&quot;', $fs,
$fs, '&quot;startpressure (bar)&quot;',
'&quot;endpressure (bar)&quot;', $fs,
$fs, '&quot;endpressure (bar)&quot;',
'&quot;o2 (%)&quot;', $fs,
$fs, '&quot;o2 (%)&quot;',
'&quot;he (%)&quot;', $fs,
$fs)"/> '&quot;he (%)&quot;',
$fs)"/>
</xsl:for-each>
<!-- Print rest of the header --> <!-- Print rest of the header -->
<xsl:value-of select="concat( <xsl:value-of select="concat(
@ -225,68 +229,71 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:for-each select="cylinder">
<xsl:when test="cylinder[1]/@start|cylinder[1]/@end != ''"> <xsl:choose>
<xsl:apply-templates select="cylinder[1]"/> <xsl:when test="@start|@end != ''">
</xsl:when> <xsl:apply-templates select="."/>
<xsl:otherwise> </xsl:when>
<xsl:value-of select="$fs"/> <xsl:otherwise>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="$fs"/>
<xsl:choose> <xsl:text>&quot;</xsl:text>
<xsl:when test="$units = 1"> <xsl:choose>
<xsl:value-of select="concat(format-number((substring-before(cylinder[1]/@size, ' ') div 14.7 * 3000) * 0.035315, '#.#'), '')"/> <xsl:when test="$units = 1">
</xsl:when> <xsl:value-of select="concat(format-number((substring-before(@size, ' ') div 14.7 * 3000) * 0.035315, '#.#'), '')"/>
<xsl:otherwise> </xsl:when>
<xsl:value-of select="substring-before(cylinder[1]/@size, ' ')"/> <xsl:otherwise>
</xsl:otherwise> <xsl:value-of select="substring-before(@size, ' ')"/>
</xsl:choose> </xsl:otherwise>
<xsl:text>&quot;</xsl:text> </xsl:choose>
<xsl:value-of select="$fs"/> <xsl:text>&quot;</xsl:text>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="$fs"/>
<xsl:choose> <xsl:text>&quot;</xsl:text>
<xsl:when test="$units = 1"> <xsl:choose>
<xsl:choose> <xsl:when test="$units = 1">
<xsl:when test="substring-before(divecomputer[1]/sample[@pressure]/@pressure, ' ') &gt; 0"> <xsl:choose>
<xsl:value-of select="concat(format-number((substring-before(divecomputer[1]/sample[@pressure]/@pressure, ' ') * 14.5037738007), '#'), '')"/> <xsl:when test="substring-before(../divecomputer[1]/sample[@pressure]/@pressure, ' ') &gt; 0">
</xsl:when> <xsl:value-of select="concat(format-number((substring-before(../divecomputer[1]/sample[@pressure]/@pressure, ' ') * 14.5037738007), '#'), '')"/>
<xsl:otherwise> </xsl:when>
<xsl:value-of select="''"/> <xsl:otherwise>
</xsl:otherwise> <xsl:value-of select="''"/>
</xsl:choose> </xsl:otherwise>
</xsl:when> </xsl:choose>
<xsl:otherwise> </xsl:when>
<xsl:value-of select="substring-before(divecomputer[1]/sample[@pressure]/@pressure, ' ')"/> <xsl:otherwise>
</xsl:otherwise> <xsl:value-of select="substring-before(../divecomputer[1]/sample[@pressure]/@pressure, ' ')"/>
</xsl:choose> </xsl:otherwise>
<xsl:text>&quot;</xsl:text> </xsl:choose>
<xsl:value-of select="$fs"/> <xsl:text>&quot;</xsl:text>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="$fs"/>
<xsl:choose> <xsl:text>&quot;</xsl:text>
<xsl:when test="$units = 1"> <xsl:choose>
<xsl:choose> <xsl:when test="$units = 1">
<xsl:when test="substring-before(divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') &gt; 0"> <xsl:choose>
<xsl:value-of select="concat(format-number((substring-before(divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') * 14.5037738007), '#'), '')"/> <xsl:when test="substring-before(../divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') &gt; 0">
</xsl:when> <xsl:value-of select="concat(format-number((substring-before(../divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') * 14.5037738007), '#'), '')"/>
<xsl:otherwise> </xsl:when>
<xsl:value-of select="''"/> <xsl:otherwise>
</xsl:otherwise> <xsl:value-of select="''"/>
</xsl:choose> </xsl:otherwise>
</xsl:when> </xsl:choose>
<xsl:otherwise> </xsl:when>
<xsl:value-of select="substring-before(divecomputer[1]/sample[@pressure][last()]/@pressure, ' ')"/> <xsl:otherwise>
</xsl:otherwise> <xsl:value-of select="substring-before(../divecomputer[1]/sample[@pressure][last()]/@pressure, ' ')"/>
</xsl:choose> </xsl:otherwise>
<xsl:text>&quot;</xsl:text> </xsl:choose>
<xsl:value-of select="$fs"/> <xsl:text>&quot;</xsl:text>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="$fs"/>
<xsl:value-of select="substring-before(cylinder[1]/@o2, '%')"/> <xsl:text>&quot;</xsl:text>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="substring-before(@o2, '%')"/>
<xsl:value-of select="$fs"/> <xsl:text>&quot;</xsl:text>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="$fs"/>
<xsl:value-of select="substring-before(cylinder[1]/@he, '%')"/> <xsl:text>&quot;</xsl:text>
<xsl:text>&quot;</xsl:text> <xsl:value-of select="substring-before(@he, '%')"/>
</xsl:otherwise> <xsl:text>&quot;</xsl:text>
</xsl:choose> </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:choose> <xsl:choose>
<!-- Old location format --> <!-- Old location format -->
<xsl:when test="location != ''"> <xsl:when test="location != ''">
@ -469,6 +476,7 @@
<xsl:value-of select="substring-before(@he, '%')"/> <xsl:value-of select="substring-before(@he, '%')"/>
<xsl:text>&quot;</xsl:text> <xsl:text>&quot;</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="location"> <xsl:template match="location">
<xsl:value-of select="$fs"/> <xsl:value-of select="$fs"/>
<xsl:text>&quot;</xsl:text> <xsl:text>&quot;</xsl:text>