[PATCH] Fix XSLT when no weight system is given

Miika Turkia miika.turkia at gmail.com
Sun Mar 10 12:32:10 PDT 2013


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 at gmail.com>
---
 xslt/commonTemplates.xsl |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xslt/commonTemplates.xsl b/xslt/commonTemplates.xsl
index cd4ee99..ba64997 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() > 1]"/>
-- 
1.7.9.5



More information about the subsurface mailing list