Subject: Re: Re: Comparing two xml documents
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 12 Mar 2003 21:05:21 -0700 (MST)
|
Robert P. J. Day wrote:
> On Wed, 12 Mar 2003, Ragulf Pickaxe wrote:
>
> > What is the differenct between:
> > <xsl:template match="*">
> >
> > and
> >
> > <xsl:template match="node()">
>
> i went through this grief recently. as i read it, "*" will
> match any element, while node() will match any of
>
> 1) elements
> 2) comments
> 3) processing instructions
> 4) text nodes
>
> is this about right?
Yes.
To be pedantic, '*' matches any node that is of the 'principal node type' for
the given axis. The default axis is 'child', so match="*" really means
match="child::*". The principal node type for the child axis is element, so
yes, "*" matches any element node.
The attribute and namespace axes have a different principal node type, so for
example "attribute::*" or its shorthand "@*" both match any attribute node.
node() matches any node at all, but match="node()" means
match="child::node()", so it only matches nodes that can be children, which is
all node types other than attribute, namespace, and root. So yeah, you got it.
Mike
--
Mike J. Brown | http://skew.org/~mike/resume/
Denver, CO, USA | http://skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|