Re: [xsl] The identity transform and attributes

Subject: Re: [xsl] The identity transform and attributes
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 21 Jan 2008 14:35:43 -0500
At 11:22 AM 1/21/2008, Andrew wrote:
On 21/01/2008, Jesper Tverskov <jesper@xxxxxxxxxxx> wrote:
> The old way even has the power and fascination of being just one
> template, the identity template. This is how the identity template
> looks in two specs, in hundreds of books, in thousands of articles and
> tutorials, and in millions of XSLT stylesheets until this very day.
> Why change things for the worse just to confuse people?

Well the standard identity template is completely non-intuitive in
itself... so I think most new XSLT'ers are confused enough by it.  I
remember in the early days cutting and pasting it the first few times
I needed it just because it seemed so strange and hard to reproduce by
hand.  Having something within xsl:copy was the hardest thing to
comprehend, iirc.

A pedagogical principle I try to follow wherever possible is "only one new thing at a time".

Part of the "power and fascination" of the classic identity template is precisely that it confronts the beginner, in compact form, with so many new things at once, including (at least):

1. The XSLT processing model (recursive descent of the tree by applying and matching templates)
2. Implicit definitions and obscure usages in XPath (what is meant by 'node()', '@', '*')
3. "Shallow copy" of a single node ("having something within xsl:copy")

While this all makes it a marvel to behold once you're in the know, to the uninitiated the identity template can be simply baffling, as it presents too much complexity for an innocent brain to assimilate at once.

Yet, for the same reason, it makes for a particularly informative and entertaining discussion in a classroom setting. I still believe that "XSLT is easy", but this is most true for those who take the time to give themselves, or get, a bit of formal instruction, whereby such knotty perplexities can be patiently disentangled. :-)


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

Current Thread