RE: [XPath] 3.2.1 Steps: fn:get-namespace-uri-for-prefix

> If attributes as well as elements had an in scope namespaces property
> and attribute nodes could be supplied to fn:in-scope-prefixes then
> prefixes contained in free standing attribute node values (such as
> Xpath expressions) could be safely preserved. In the original mapping
> from infoset/psvi the in-scope namespaces of an attribute 
> would be that
> of its parent element. On serialisation you (as language 
> designers, not
> the user) would have a choice of whether to just drop in scope
> namespaces from attributes, or whether to make "namespace 
> fixup" ensure
> that an element always had namespaces in scope if they are in scope on
> an attribute.
> 
> You'll probably say that it's too late for new features.
> 

We are discussing proposals along these lines. It comes under the heading of
bug fixes, not new features.

Although solutions along the lines you suggest have been proposed, the WGs'
current preference is for an alternative approach, which is to keep
namespace context information for atomic values of type QName and NOTATION.
This would solve the problem not only for free-standing attribute nodes, but
also for free-standing QName values. This is known as the "triples
proposal", because QName values would contain a (prefix, URI, local-name)
triple, in which the prefix was used only when converting the QName to a
string.

One disadvantage of the proposal you made, where namespace context
information is attached to attribute nodes, is that a lot of quite
unnecessary namespace information would be carried around "just in case".
Logically, it would also be needed for free-standing text nodes.

The advantage of your proposal is that it doesn't rely on a schema, or on
the attribute contents being annotated as xs:QNames (so it works, for
example, if they are XPath expressions). However, the price to pay for this
is very high, and in XSLT at least there are simple workarounds (xsl:copy-of
select="namespace::*").

Michael Kay

Received on Monday, 26 July 2004 07:09:49 UTC