xsl-list
[Top] [All Lists]

RE: thoroughly confused about node() matching

2003-03-03 17:55:02




As a pattern, match="node()" is short for match="child::node()", which
matches any node that is a child of anything - which means elements,
text nodes, comments, and PIs, but not root nodes, attributes or
namespaces.

What's probably confusing you is that as a node-test, node() matches any
node. So if it's used with a different axis, e.g.
match="attribute::node()" or match="ancestor::node()", it will match
other node types than these.

Actually, the only axis specifiers allowed in patterns are "child,"
"attribute," and "@," so "ancestor::node()" is not a valid pattern.

Doesn't this imply a template can never match a namespace node?  If so,
then the select attribute of xsl:apply-templates can select namespace
nodes, but no template will ever match them.

My feeling is this was done intentionally, but I'm not sure.  Does anyone
know the history?

Dave


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