This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL: For-Each Efficient or Not?
- From: "Vasu Chakkera" <vasucv at hotmail dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 01 Jul 2002 13:42:04 +0000
- Subject: Re: [xsl] XSL: For-Each Efficient or Not?
- Reply-to: xsl-list at lists dot mulberrytech dot com
The use of xsl:apply-templates is considered better approach than
<xsl:for-each>
<xsl:for-each> (also called "pull processing") only works if you know
exactly the structure of the XML that your stylesheet is going to process.
But <xsl:apply-templates> is far more flexible. It defines rules for
processing each kind of element wherever it occurs. This makes the
stylesheet more resilient to changes in the source document structure, and
better able to deal with semi-structured information where elements may
occur in many different places. It also enables you to build up a library of
template rules that can be re-used for many different transformations of
many different document types.
---- This is taken from archives..(Michael Kay's Answer to the question of
<xsl:for-each> or<xsl:appy-templates>??
From: Oleg Tkachenko <olegt@multiconn.com>
Reply-To: xsl-list@lists.mulberrytech.com
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] XSL: For-Each Efficient or Not?
Date: Mon, 01 Jul 2002 16:31:41 +0200
Schrooten, Ben wrote:
We have been trying to determine whether using XSL:For-Each is having an
impact on the speed of our document publishing. Some of my buddies don't
want to use xsl:for-each because they believe it causes the process to
take
a longer amount of time than just doing a template match over and over. Is
this true or no? Is xsl:for-each a performance hog or does it and template
matching take the same amount of time?
I believe that's quite opposite - for-each is only about to evaluate
expression and instantiate instructions within for each selected node, but
using apply-templates it's also nessesary to match appropriate template,
probably to up new stack frame etc. That's usually not much overhead, but
it does exist and depends on the processor implementation.
Anyway that's not a reason to lose templates' virtues. Take a look at the
list archive - there was a big discussion for-each vs templates this year.
--
Oleg Tkachenko
Multiconn International Ltd, Israel
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list