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>
This commit is contained in:
Miika Turkia 2020-05-31 14:45:42 +03:00 committed by Dirk Hohndel
parent 108b30e8b5
commit 3dc5ac219d

View file

@ -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>