summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2020-05-31 14:45:42 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-31 08:59:47 -0700
commit3dc5ac219d0544307093e24c55395a61a49f3d79 (patch)
tree059925db94b99f5f3d5b6042ad7cc6b8239c8db6
parent108b30e8b5c279c49a73da6b5058e49d4e219598 (diff)
downloadsubsurface-3dc5ac219d0544307093e24c55395a61a49f3d79.tar.gz
Print empty cylinder, if needed
When the dive that is used to generate the header, we need to print empty cylinders for the dives that had less cylinders than the one used for header printing. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--xslt/xml2manualcsv.xslt33
1 files changed, 33 insertions, 0 deletions
diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt
index 9b09dd03d..727e59a59 100644
--- a/xslt/xml2manualcsv.xslt
+++ b/xslt/xml2manualcsv.xslt
@@ -306,6 +306,12 @@
</xsl:choose>
</xsl:for-each>
+ <xsl:if test="count(cylinder) &lt; $cylinders">
+ <xsl:call-template name="emptyCylinder">
+ <xsl:with-param name="count" select="$cylinders - count(cylinder)"/>
+ </xsl:call-template>
+ </xsl:if>
+
<xsl:choose>
<!-- Old location format -->
<xsl:when test="location != ''">
@@ -568,4 +574,31 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+ <!-- Template to fill in non-existent cylinder info to CSV -->
+ <xsl:template name="emptyCylinder">
+ <xsl:param name="count"/>
+
+ <xsl:if test="$count &gt; 0">
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="$fs"/>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:call-template name="emptyCylinder">
+ <xsl:with-param name="count" select="$count - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
</xsl:stylesheet>