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

RE: RE:"*NEVER* use for-each"

Subject: RE: RE:"*NEVER* use for-each"
From: "Ben Robb" <b.robb@xxxxxxxxxx>
Date: Tue, 27 Feb 2001 17:37:25 -0000
asp for each i
Basically, for-each breaks the natural programming model of templates,
which, while slightly odd to most programmers coming in from
html/asp/javascript, makes sense when you actually understand what is
going on in the background of the process.

for-each is only really useful to do things out of the ordinary... for
most cases, where you want to process an XML document once and have
another XML document pop out of the other side, using templates will
mean shorter, more generic code, which keeps the size of your document
down and allows for reuse of code. for-each will produce identical
output, but, while it is easier to read in the first place, it relies
much more on knowing the structure of the input document in detail...
something that is not always an option. Templates, particularly
"catch-all" templates (match="*" for example), allow for unstructured
data to be inputted. 

Also, it is the only way forward if you want to do any kind of recursive
processing.

It is a little harsh to say "never" use for-each - I do sometimes;
however, I tend to stick to templates for most cases.

Does that make sense? I'm in the middle of my 5th server install of the
day, so probably not *grin*

Ben

-----Original Message-----
From: Alexey Gokhberg [mailto:alexei@xxxxxxxxxx]
Sent: 27 February 2001 17:17
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  RE:"*NEVER* use for-each"


FINLEY, Mike wrote:
> 
> As a beginner, who has just used for-each to solve a problem, why
should I
> never use it?
> 

I would also like to know the answer ...

Alexey Gokhberg,
XSLT implementer
Unicorn Enterprises SA

 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

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.