Re: [xsl] Re: _why_ do people use xsl:element and xsl:attribute so much

Subject: Re: [xsl] Re: _why_ do people use xsl:element and xsl:attribute so much
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 05 Sep 2001 15:46:26 -0400
Hi Mike,

At 03:10 PM 9/5/01, you wrote:
Deborah Aleyne Lapeyre wrote:
>         xsl:element, xsl:attribute, etc.
> We decided that they were very useful advanced features,
> but way behind, for example, Named Templates as something
> that a beginner needs to know.

At the risk of having an unpopular opinion...

I would want beginners to have a good foundation for understanding
the XSLT processing model (tree access and construction) and the
relationship between XSLT and XML Namespaces. It seems to me that
teaching people about literal result elements as "text that is
copied through" rather than as "shorthand for instructions to
create nodes -- i.e., xsl:element, xsl:attribute, xsl:text, etc."
undermines their understanding of XSLT's most important concepts.

You're not going to get any argument from me (or, I dare say, Debbie). Downplaying the use of xsl:element etc. is not intended to undermine student's immediate grasp of the tree building model; in fact one of the main outcomes of the work on Day One of the course is an understanding that XSLT template are *not* "text that is copied through". We just do this without xsl:element etc.

I don't necessarily advocate thorough coverage of when & how to
use xsl:element and xsl:attribute, but they should at least be
mentioned in terms of their relationship to literal result
elements and the concept of result tree construction, IMHO.

Mentioning them, sure; but there are ratholes enough as it is. Our general approach is to give students a firm foundation (and plenty of hands-on experience) in the "push" approach to stylesheets on Day One. By the time the course is over, they've mastered template-based processing (including modes), and XPath holds no more mysteries for them. When we have time, we get more into stuff like pulling data, various kinds of dynamic processing (for which xsl:element and xsl:attribute are great), sorting and grouping, and so on.

It's true that in this case as in others, knowing something "advanced" sometimes provides helpful context -- sometimes even the spark for an "aha!" -- to get at something more "basic". XSLT actually has many such places. (Some might argue that you can't really understand what's going on unless you have a complete grasp of the rules of whitespace stripping :-). I guess our aim is to give students a strong enough foundation that they can put the rest together on their own. When teaching, we certainly watch for opportunities for an "aha". But we don't build the course around them, since they're not very dependable (and students are so different).


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

XSL-List info and archive:

Current Thread