Re: [xsl] Namespace wildcards

> Also, is *:* allowed? The spec doesn't preclude this but it also is
explicit
> 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
prefix>
"*" 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