Subject: Re: possible to mimic while-like behavior? From: Mike Brown <mike@xxxxxxxx> Date: Thu, 16 Mar 2000 17:47:17 -0700 (MST) |
> On Thu, 16 Mar 2000 sara.mitchell@xxxxxxxxx wrote: > Arnold, Mike: if your solutions(s) DO in fact address "do blah > until you find the first foo where not bar" let me know -- I don't see how > they might do so. I was showing you an example of how to use a named template that calls itself to simulate the perl-style snippet you posted. The "blah" part is somewhat ambiguous but it is pretty obvious that at some point "blah" will result in $foo not being able to pass the test that would result in another iteration. So I think it does in fact address your situation, but like you said, you didn't provide much info, so I kept my answer pretty generic. If you provide specific XML and say what you want to do, it will be easier to tune the example to be more precise. While loops generally involve preservation of state between iterations, ie side-effects, of which XSLT is free. I mean, you give something 'external' like a variable a particular state, and at each iteration of the loop the state of that thing is tested. Presumably either something in the loop will change the state of that thing, or some other concurrent process will alter it, and then the loop will exit. Well, you can't change the value of a variable in XSLT, so that's why I did the 'newfoo' assignment, to simulate the change of state of 'foo' for the next iteration. It is also possible that mimicking a while loop may not be the appropriate solution for whatever it is you want to do. I mean, if you're only wanting to process nodes for which certain conditions are true, that can be accomplished with an XPath expression with predicates, in an xsl:for-each or xsl:apply-templates. - Mike ___________________________________________________________ Mike J. Brown, software engineer, Webb Interactive Services XML/XSL stuff: http://www.skew.org/ http://www.webb.net/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: possible to mimic while-like be, Carole E. Mah | Thread | RE: possible to mimic while-like be, Christopher R. Maden |
Re: possible to mimic while-like be, Nikolai Grigoriev | Date | RE: MSXML abominations happening fo, Arjun Ray |
Month |