[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Match nodes searching for attributes in children

Subject: RE: Match nodes searching for attributes in children
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 18 Jan 2010 09:34:14 -0000
RE:  Match nodes searching for attributes in children
> One curious thing though, I noticed that my xslt 
> processor (xalan 2.7.1 and the one included in java) are not 
> able to match attributes. Other people claim something like 
> this is possible:
> 
> <xsl:template match="@attr">
> or even:
> <xsl:template match="@*">

It is indeed possible.

I once heard a rather nice description of the template matching model. On
one side of a high wall is someone performing an apply-templates
instruction. He selects a node, puts it in a bottle, and throws it over the
wall. On the other side of the wall are a number of match templates. They
each look at each bottle as it comes over, and decide whether they're
interested in that kind of node. If two of them are, they fight over it, and
one of them wins. If no-one is interested, it lands on the floor.

In your case you've got a template waiting for attribute nodes to be thrown
over the wall, but no-one is throwing them, so it never gets a chance to
catch the bottle and do its thing.
> 
> Even the default template will not match them. An empty 
> stylesheet will copy only the text elements. It will be 
> difficult for me to get help if the processors behave differently.
> 
You've only described the behaviour of one processor. What's your evidence
that other processors behave differently?

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.