xsl-list
[Top] [All Lists]

Re: [xsl] Pattern "node()" and document nodes

2010-02-25 14:55:57
On 25/02/2010 19:09, Dimitre Novatchev wrote:
Well, I wanted to simplify things too much :)

However, the spec says this exactly:

" node() matches any node other than an attribute node, namespace
node, or document node."

http://www.w3.org/TR/xslt20/#pattern-examples (the 12th bullet).


And David Carlisle provided the precise explanation why this is so.


well actually I gave the precise reason why the pattern node doesn't match in xslt 1 but in xslt2 the situation is a little bit more complicated because in xslt2 a pattern with no explicit axis doesn't default to the child:: axis because they wanted match="foo" to match all foo elements even if the foo element is the root of the tree (which can't happen in xslt 1).

The spec says:


The pattern node() matches all nodes selected by the expression root(.)//(child-or-top::node()), that is, all element, text, comment, and processing instruction nodes, whether or not they have a parent. It does not match attribute or namespace nodes because the expression does not select nodes using the attribute or namespace axes. It does not match document nodes because for backwards compatibility reasons the child-or-top axis does not match a document node.

David


--~------------------------------------------------------------------
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>
--~--