Subject: RE: [xsl] RE:"*NEVER* use for-each" From: "Ben Robb" <b.robb@xxxxxxxxxx> Date: Tue, 27 Feb 2001 17:37:25 -0000 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] RE:"*NEVER* use for-each", Eric van der Vlist | Thread | RE: [xsl] Template rules vs. XQuery, Evan Lenz |
Re: [xsl] XSLT: Xpath: sets: positi, Jeni Tennison | Date | RE: [xsl] how do you redefine a var, Keith |
Month |