[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: <xsl:apply-templates> or <xsl:for-each> ??
[Laura Jenkins] > I am really very much confused regarding when you make use of > <xsl:apply-templates> and when you make use of <xsl:for-each> > since i come from a programming background, it makes more sence for me to > use <xsl:for-each> as I can imagine each node that is processed in a loop . > But technically <xsl:apply-templates> seems to be doing the same job. > can some one advice me as to when exactly do we make use of > <xsl:apply-templates> and when <xsl:for-each> is best used?? > > and are there any any advantages/disadvantages of using apply-templates or > for-each > Besides what Mike Kay said, xsl:for-each changes the context and xsl:apply-templates does not. Sometimes you have to change the context. For example, suppose you use a second xml file as a lookup table and want to apply a key to it. You have to change the context to be the root of the lookup table so you can apply the key, but you don't want to change the overall context outside the lookup. That's a good place to use xsl:for-each. Cheers, Tom P 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
|