W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2002

Re: [xsl] Namespace wildcards

From: Jonas Sicking <sicking@bigfoot.com>
Date: Tue, 5 Feb 2002 19:48:06 +0100
Message-ID: <006201c1ae75$a6da1000$b3e0d0d9@telia.com>
To: <www-xpath-comments@w3.org>
> Also, is *:* allowed? The spec doesn't preclude this but it also is
> about allowing NCName:* and *:NCName so this might suggest that it's not?
> Seems like it may as well be allowed to me.

Unfortunately * means *:*, i.e. all named nodes in all namespaces. This is
IMHO very bad for two reasons:

1. It's inconsistent in that that it has an other meaning then other
unprefixed NameTests:

"foo" means: localName="foo" namespace=<somedefault>
"bar:foo" means: localName="foo" namespace=<namespace bound to bar prefix>
"bar:*" means: localName=<anything> namespace=<namespace bound to bar
"*" would logically mean: localName=<anything> namespace=<somedefault>
    but in reality means: localName=<anything> namespace=<anything>

it would IMHO have been better to use a "*:*" or "element()" pattern for a
NodeTest to match all elements. (A NodeTest that matches all attributes
isn't really needed since you are usually (always?) walking the attribute
axis when filtering attributes, so you can simply use the node() NodeTest)

2. It's impossible (in XSLT, and I would expect most other XPath clients) to
create a NameTest that matches all named nodes in the null namespace. Not
that *[namespace-uri() = ""] strictly speaking also selects the nodes in the
"" namespace, which is different from the null namespace. And even
disregarding that it's a rather cumbersome (and sub-optimal) way to perform
an operation which is rather common.

Unfortunately I don't see any way to solve this problem without causing big
compability problems with XPath1.0

/ Jonas Sicking
Received on Tuesday, 5 February 2002 13:43:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:42 UTC