RE: [xsl] RE:"*NEVER* use for-each"

Subject: RE: [xsl] RE:"*NEVER* use for-each"
From: David Schach <davidsch@xxxxxxxxxxxxx>
Date: Tue, 27 Feb 2001 16:47:27 -0800
I don't see what that has to do with for-each.  Someone can put a // or
//*[@...] into an apply-templates.  With the same xpath expression, for-each
is always faster than apply-templates.  

-----Original Message-----
From: Chris Bayes [mailto:Chris@xxxxxxxxxxx]
Sent: Tuesday, February 27, 2001 4:11 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] RE:"*NEVER* use for-each"


>for-each is part of the xslt specification.  It does not break anything
>about the programming model because it is, by definition, part of the xslt
>programming model. It is no more or less natural than apply-templates. Each
>provides useful functionality. In msxml3, for-each is slight more effecient
>than using apply-templates because apply-templates adds the additional cost
>of xpath matching.

Yup. But before you know it someone is going to put a // or a //*[@...] etc
in your highly efficient <xsl:for-each> thinking they are just drilling down
from the top level or omnipotent and your performance is going to go though
the floor. This is less likely to happen with templates because you know
where you are or more importantly you don't care where you are.

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


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

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


Current Thread