[xsl] Re: RE: Converting attributes to elements and preserving the hierarchy

Subject: [xsl] Re: RE: Converting attributes to elements and preserving the hierarchy
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 19 Dec 2001 06:45:59 -0800 (PST)
> > How do I decide  when to use <xsl:for-each> or a template ?
> 
> For beginners: always use template rules, until you understand them well
> enough to know their strengths and weaknesses.
> 
> For advanced users: use xsl:for-each only when you are absolutely confident
> that the structure of the source documents handled by your stylesheet is not
> going to change.
> 
> Mike Kay

For beginners and advanced users: using a functional programming style and a
functional programming library in XSLT (one is to become available soon) you'll not
need to use xsl:for-each. 

You'll need to use xsl:call-template once per function-library call and you'd have
to use xsl:apply-templates in your higher-order functions (in case you'd be writing
them). However, if syntax-level support for higher order functions is included in
XPath 2.0 and XSLT 2.0, then most probably you'll not even need to use
xsl:call-template and xsl:apply-templates in these cases.

Even in XSLT 1.0 it would become the rule that the standard FP library functions are
"wrapping" these xslt instructions within their code, so that the user can simply
invoke the functions.

As one person put it here, using a FP library will require "less thinking". I would
slightly correct this statement -- it would require another way of thinking in which
the programmer benefits from having the knowledge that solutions to general problems
are pre-coded and re-usable and interconnectable for solving a vast majority of
problems, which in the absence of this pre-coded knowledge would be "unique" and
very difficult (time-consuming) to solve.

Cheers,
Dimitre Novatchev.



__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

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


Current Thread