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>
This commit is contained in:
Miika Turkia 2013-03-10 21:32:10 +02:00 committed by Dirk Hohndel
parent 42ea5e3510
commit f22527fdaf

View file

@ -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]"/>