Re: [xsl] XSLT Dead?

Subject: Re: [xsl] XSLT Dead?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 17 Apr 2007 15:12:18 -0400
At 2007-04-17 15:02 -0400, Steve wrote:
This one has me kind of stumped. Maybe I'm one of these people. What
is the difference between for-each and apply-templates? I have a hard
time even mentally comparing the two.

Think "pull" and "push".


One function iterates through a node set and the other matches up a
template with a node based on a given context or passed mode. Is that
the right answer, or close to it?

With for-each one pulls nodes from the source tree and the instruction supplies the one result tree construction rule used for all nodes pulled.


With apply-templates one pushes nodes from the source tree at the stylesheet and the processor finds the template rule with the result tree construction rule for each individual node pushed.

These characterizations seem to be received well by my students.

I hope this helps.

. . . . . . . . Ken

-Steve

On 4/17/07, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:

so think XSLT is trivial.  I always ask them to explain the difference
between xsl:for-each and xsl:apply-templates...


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread