Subject: Re: The identity transform and attributes
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 21 Jan 2008 17:00:41 +0000
|
On 21/01/2008, Abel Braaksma <abel.online@xxxxxxxxx> 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/
|