RE: [xsl] New W3C Working Drafts (and new Saxon release)

Subject: RE: [xsl] New W3C Working Drafts (and new Saxon release)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 12 Feb 2005 08:48:36 -0000
> <quote>
> It is now a recoverable error to generate nodes in the result tree
> using a namespace name that is not a valid instance of xs:anyURI. XSLT
> 1.0 explicitly stated that this was not an error; however, the XPath
> 2.0 data model assumes that the name of a node is a valid xs:QName,
> and the namespace part of a valid xs:QName, if present, must be a
> valid xs:anyURI. The fact that this error is recoverable, however,
> gives implementations freedom to avoid strict validation of namespace
> names if they wish to do so.
> </quote>
> 
>     May I ask why this change was made? Not that I'm inconvenienced by
> this - it just seems like an odd thing to explicitly change.
> 

This is a cross-W3C problem: the question of whether namespace names must be
valid URIs or not, and indeed, what exactly are the rules for a URI to be
valid.

The namespaces specification talks throughout of a namespace name being a
URI, but then refrains from saying that the document is malformed if the
name isn't a valid URI.

The Infoset, however, says that if the name isn't a valid URI then you can't
build an infoset.

The XPath data model says that element and attribute names are QNames, and
defines QNames by reference to XML Schema, which says that the namespace
part of a QName is an instance of xs:anyURI. xs:anyURI has some notably
vague wording saying that the validation rules impose only "modest
obligations" on processors, and failing to say exactly what those
obligations are.

There are also specs that assume that a namespace name won't contain a space
or a "}", as these are used as syntactic delimiters.

The net result is that if you try and create a namespace whose name isn't a
valid URI, there may be parts of the system that can't handle it. So it's no
longer viable for XSLT to say that you can create elements using any old
string as a namespace name, and expect to get away with it.

Michael Kay
http://www.saxonica.com/

Current Thread