Re: [xsl] xsl for each

Subject: Re: [xsl] xsl for each
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 8 Mar 2001 10:04:40 -0700 (MST)
Carmelo Montanez wrote:
>     I have another quick question .... The following is just psudo-code
> 
>   Suppose I have a structure like this
> 
>    <xsl:for-each>
>       Create a sub-tree here.
>   </xsl:for-each>
> 
>   Is it possible to save the contents of the "sub-tree" created with each
> pass of the loop?, if so any ideas?

No, you create a new result tree fragment in each pass.

xsl:for-each is essentially just a substitute for xsl:apply-templates,
where you provide the template that will match the selected nodes in the
for-each rather than as a separate xsl:template. It gives you the advantage
of having complex node sleections without having to have an equally complex
match pattern, and it provides an approximation of the kind of iteration
that is familiar territory for procedural programmers.

What are you really trying to accomplish, as far as the XML you have to
work with and the output you want? There is probably a more elegant,
side effect free way of doing it.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at            My XML/XSL resources: 
webb.net in Denver, Colorado, USA              http://skew.org/xml/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread