[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: more on Using apply-templates instead of for-each?

Subject: RE: more on Using apply-templates instead of for-each?
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 15 Apr 2003 15:35:36 -0400
call templates apply templates
I wrote -
>  In other cases, the fact that the context is a single node (in
> for-each) vs. a node-set (in apply-templates and call-templates) can
> make quite a difference.
> 

Well, that was a little too simplified, I think - it ended up a bit
incorrect.  The context node is always a single node, but
apply-templates operates on an entire node-set (which might happen to
contain one node or many - or none).  The results get assembled into the
right order but may or may not have been processed in that order.  The
context node for call-templates is the same one as from where it was
called.

For-each does operate on each node in a node-set, but they are operated
on separately, as if they were single, unrelated nodes.  With for-each,
for example, you can only get a position() of 1 on any one iteration,
whereas with apply-templates, position() can give other values (you
might be processing node #3 in a set of nodes).

Cheers,

Tom P

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.