summaryrefslogtreecommitdiffstats
path: root/xslt/commonTemplates.xsl
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-03-10 21:32:10 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-10 13:43:02 -0700
commitf22527fdaf0d9e5dd2ad75671106a1327f801b95 (patch)
tree1815bafcc39f8e60827cc59e2a2f0653eeb6a8fa /xslt/commonTemplates.xsl
parent42ea5e351014994980fa0704784906b06a501eec (diff)
downloadsubsurface-f22527fdaf0d9e5dd2ad75671106a1327f801b95.tar.gz
Fix XSLT when no weight system is given
Summing up weights ended only when there was one parameter left. With no parameters we ended up in an infinite loop. Now we end also in case of no parameters. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/commonTemplates.xsl')
-rw-r--r--xslt/commonTemplates.xsl7
1 files changed, 7 insertions, 0 deletions
diff --git a/xslt/commonTemplates.xsl b/xslt/commonTemplates.xsl
index cd4ee993e..ba649970a 100644
--- a/xslt/commonTemplates.xsl
+++ b/xslt/commonTemplates.xsl
@@ -112,9 +112,16 @@
<xsl:variable name="value" select="substring-before($values[1], ' ')"/>
<xsl:choose>
+
+ <!-- No input -->
+ <xsl:when test="count($values) = 0"/>
+
+ <!-- Handling last value -->
<xsl:when test="count($values) = 1">
<xsl:value-of select="format-number($value + $sum, '#.#')"/>
</xsl:when>
+
+ <!-- More than one value to sum -->
<xsl:otherwise>
<xsl:call-template name="sum">
<xsl:with-param name="values" select="$values[position() &gt; 1]"/>