Re: [xsl] match on attribute anywhere

Subject: Re: [xsl] match on attribute anywhere
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Thu, 14 Feb 2002 20:03:36 +0000
Wendell wrote:

>Jeni,
>
>This solution is nice because its layering of stylesheets (using the 
>xsl:import mechanism) mirrors the layering of Andrew's presumed use case, 
>where someone has gone in after the file creation and arbitrarily scattered 
>@mark attributes around.
>
>I don't know if that's deeply significant, but it is interesting, and 
>prompts one to notice a class of problems (namely those where you need two 
>templates to fire on the same node, one to address one layer, another to 
>address a layer "on top") that can be addressed using this feature of 
>xsl:apply-imports. Surprise: it works as intended. And that class turns out 
>to be broader than just customizing standard stylesheets. (Like the class 
>of problems addressed by keys, which is broader than cross-referencing.)
>

This is really a very old pattern but in a new context.  In
object-oriented languages it is common to write a class which inherits
from another, overrides a method (or two), do some new stuff, then
call the base version of the same method to do what the base class
does.

Which is why I've been kicking myself for not thinking of the
apply-imports method first - I've been using OOPLs a lot of years, and
well know the correspondence between XSLT import and inheritance.  Oh
well.

The interesting thing XSLT has over OOPLs in general is that since the
method name is essentially the template match pattern you get to
overide many "methods" (templates) at once, as in the *[@mark] trick.
A new feature for Java 3 maybe...

Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

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


Current Thread