xsl-list
[Top] [All Lists]

Re: [xsl] The identity transform and attributes

2008-01-21 10:01:09
On 21/01/2008, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
David Carlisle wrote:
attribute::node() and self::node() both select attribute nodes.
node() on its own is short for child::node() which does not select
attribute nodes because there are never any attributes in the child
axis, it is teh child axis that does not include attributes, not the
node() node test.

That's a great insight.

+1 to that.

I guess this explains why the allowed axes in match patterns are child
and attribute.  So when you have:

match="foo"

you really have:

match="child::foo"

...to distinguish between foo being an attribute or element?  The same
logic applies to node() in that:

match="node()"

is really

match="child::node()"

so to get attributes as well you need to explicitly say that:

match="attribute::node()|child::node()"

...so the only way for match="node()" to match all node types
including attributes would be if node() wasn't automatically converted
to child::node(), but some other all encompassing axis.

Assuming this is correct so far, the real mind bender is:

apply-templates select="parent::foo"

being matched by:

template match="child::foo"

Is that clear is anyones mind?  If so, please share :)


thanks
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--