Subject:Recursion Limitations - Need An Iterative Solution Author:Kenny Cudworth Date:30 Sep 2005 04:28 PM
I need an iterative solution to this, but do not know how to write one. All my XSLT resources say that recursion can handle just about anything. I even set my java runtime memory to 512 MB. When I set quantity to 1000 or higher I get:
java.lang.RuntimeException: Maximum recursion depth exceeded
<!-- If the quantity is greater than the quantity per pallet, then create on inventory item pallet, subtract the pallet amount and make
a recursive call with that new quantity
-->
<xsl:if test="number($quantity) > number($quantity-per-pallet)">
<!-- If the quantity is less than or equals to the quantity per pallet, then create on inventory item pallet -->
<xsl:if test="(number($quantity) < number($quantity-per-pallet)) or (number($quantity) = number($quantity-per-pallet))">
<xsl:call-template name="inventory-pallet">
<xsl:with-param name="key" select="$key"/>
<xsl:with-param name="quantity" select="$quantity"/>
<xsl:with-param name="count" select="$count + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Inventory Item Template
quantity - The quantity for inventory pallet
-->
<xsl:template name="inventory-pallet">
<xsl:param name="key"/>
<xsl:param name="quantity"/>
<xsl:param name="count"/>