[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with xslt recursion
Hi Roopesh,
At 11:15 AM 2/10/2004, you wrote: Hi.. This is my first doubt with this group..hope i get some help.. Of course I can't speak to the actual functionality not being disclosed, but if all that needs to be done is to concatenate the values, this doesn't require recursion. Can you be a little bit more explicit about why you require recursion here and what it's doing for you? (code reformatted for legibility) <xsl:template name="build"> <xsl:param name="ResourceName"/> <xsl:param name="Index"/> <xsl:param name="Count"/> <xsl:variable name="try"> <xsl:value-of select ="ResourceTypeSet/Type[$In]"/> </xsl:variable> <xsl:if test="$Index < $Count"> <xsl:call-template name="buildResourceName"> The template called here is "buildResourceName", but no template by that name appears in the code sample. <xsl:with-param name="ResourceName"> <xsl:value-of select="concat($ResourceName,$TempResource)"/> It's also not apparent from your code what $ResourceName and $TempResource are.... </xsl:with-param> <xsl:with-param name="Index"> <xsl:value-of select="$Index+1"/> </xsl:with-param> <xsl:with-param name="Count" select="$Count"></xsl:with-param> </xsl:call-template> </xsl:if> </xsl:template> It's difficult to say given just the code you've supplied (no "buildResourceName" template) ... a number of things here are simply mystifying. Without knowing what the template is actually supposed to be doing, it's impossible to diagnose. Maybe the call to "buildResourceName" is supposed to be the recursive call to "build" itself. If this is the case, the role of the $Count variable needs to be clarified -- this is intended to specify the limit of your recursion? How is this determined? It also appears that you mean to bind the variable $try to the values of the Type elements in turn, but it's not clear why since nothing is then done with this variable. If you are only concatenating, you don't need to jump through so many hoops, but can simply copy the nodes' values to output using any of several methods (all easier than recursion). But you've said you aren't really concatenating. Seeing the actual requirement, or failing that something closer to it, would help us determine what the best approach is in your case. Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|