|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Looking for an equivalent to recursion within a fo
"Erika Marlow" <EMarlow@xxxxxxxxxxxxxx> wrote in message news:E159FD8A01059F4FBA480CF7A6BC403A6E5B3F@xxxxxxxxx > Dear List Members: > > I have run into a situation where I must increment a counter. This can be > worked around using recursion and calling a template. However, I need to > increment the counter while I iterate through a node-set. This would > normally just be a matter of adding another parameter to the template call, > but I have to increment the counter based on a condition while iterating > through the node-set. > > The pseudo-code for this particular situation would be something like this: > > function process-list-conditionally(list L) > { > if (not-empty(L)) > for-each(L) > if (true) > increment-counter > otherwise > counter > } What about: count($L[yourCondition]) or <xsl:for-each select="$L[yourCondition]"> <xsl:variable name="theCounter" select="position()"/> </xsl:for-each> If the case is more complicated, one will use one of "filter" , "foldl" , "iter, "scanIter" or "scanl" templates from FXSL -- I cannot say which, because I haven't seen your actual problem. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL 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
|

Cart








