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
|
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 |
- Re: more on Using apply-templates instead of for-each?, (continued)
- Wendell Piez - Tue, 15 Apr 2003 16:02:31 -0400 (EDT)
- Passin, Tom - Tue, 15 Apr 2003 14:48:06 -0400 (EDT)
- Kathy Burke - Tue, 15 Apr 2003 14:56:31 -0400 (EDT)
- Passin, Tom - Tue, 15 Apr 2003 15:24:47 -0400 (EDT)
- Passin, Tom - Tue, 15 Apr 2003 15:31:30 -0400 (EDT) <=
- Passin, Tom - Tue, 15 Apr 2003 16:38:51 -0400 (EDT)
- Kathy Burke - Tue, 15 Apr 2003 16:50:48 -0400 (EDT)
|
|