RE: [XQuery] In-scope vs. statically known namespaces

> 1. Since a namespace binding is always created for "xml" is "xml" 
> always listed among the fn:in-scope-prefixes of any constructed 
> element?

I believe the answer is yes.

> 2. Is "xml" also always listed for the fn:in-scope-prefixes of 
> non-constructed elements; for example those traveled to from 
> fn:doc? If 
> so, perhaps this section should be renamed or a new section added for 
> the namespaces of elements retrieved from external sources. I 
> don't see 
> "xml" listed in the Data Model but it is inconsistent for it to exist 
> for constructed elements but not pre-existing ones.

Again, I believe the answer is yes, and I don't see the problem.
> 
> It's not clear why "xml" was singled out to always have a namespace 
> binding, while the other pre-defined namespaces such as "local" and 
> "xs" don't have one.

"xml" is the only namespace that is predefined in instance documents. The
others you refer to are predefined in a query, but in-scope-prefixes() is
referring to instance documents, not to queries.

> 
> As a "way past last call" request, I suggest:
> fn:namespace-uri-for-prefix($prefix as xs:string) xs:anyURI, which 
> would return the URI for a static prefix, and a new context function:
> fn:static-prefixes(), which returns the prefixes of the statically 
> known namespaces.

I can't see why we need functions to introspect the text of the query. The
person writing the query knows which namespaces they have declared, they
don't need to ask. On this basis we could have functions that give you a
list of all the variables declared in the query, or a list of the functions
that are available (come to think of it, XSLT does have something like the
latter - function-available() - and very troublesome it is, too.)

Michael Kay (personal response)

Received on Friday, 18 February 2005 23:08:25 UTC