I'm trying to create something similar to a for-loop with the recursive idiom I've seen across the web. My implementation is with a parameter that tells what to print. I use the Eclipse built-in XSL transformator and I can't for the life of me see why it gives a StackOverflowException:
<!--
Loops recursively to print something the number of times specified with
the max parameter.
The print parameter tells what to print.
-->
<xsl:template name="loop">
<xsl:param name="count" select="1"/>
<xsl:param name="max" />
<xsl:param name="print" />
<xsl:if test="not($count = $max)">
<xsl:value-of select="$print" />
<xsl:call-template name="loop">
<xsl:with-param name="count">
<xsl:value-of select="$count + 1" />
</xsl:with-param>
<xsl:with-param name="max">
<xsl:value-of select="$max"/>
</xsl:with-param>
<xsl:with-param name="print">
<xsl:value-of select="$print" />
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
Also, why does $count < $max
give invalid Xpath expression?
Thanks in advance.