[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: recursion and looping
> Question: is the looping induced by the following stylesheet > casued by a failure to shift context node? If so how can one pass a param > value that cause a shift in context node? Or is this totally wrong-tree barking? > > <xsl:param name="nodeset" select="//w[@n=$listname]"/> > <xsl:param name="nextset" select="//w[@n!=$listname]a"/> The infinite looping is caused by the fact that on each call of the template, you process one element, and then call the template to process all the other elements. There will always be other elements, so this never terminates. You need to process a diminishing set of elements on each call. The usual way is to use. > <xsl:param name="nodeset" select="(//w)[1]"/> > <xsl:param name="nextset" select="(//w)[position() > 1]a"/> Incidentally, using //w repeatedly is probably inefficient: set a global variable to //w before you start. Mike Kay 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
|