W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > September 2007

Namespace Fixup Proposal

From: Alex Milowski <alex@milowski.org>
Date: Wed, 5 Sep 2007 08:39:14 -0700
Message-ID: <28d56ece0709050839r3c0536a0r5e5a9563a7a3ea0@mail.gmail.com>
To: "XProc WG" <public-xml-processing-model-wg@w3.org>

Since XSLT 2.0/XQuery Serialization does not define or require namespace
fixup, serialization cannot handle documents with missing namespace
declarations.  We must require namespace fixup before serialization or
fail on documents with missing namespace declarations.

XSLT 2.0 and XQuery do not produce documents that have missing
namespace declarations but XSLT 1.0 does when you use element
or attribute constructors (e.g. xsl:element or xsl:attribute) in certain
ways.

This means a valid XSLT 1.0 transformation could fail in certain XProc
implementations if they choose not to do namespace fixup and use a
serialization engine that requires it.

In the spirit of interoperability, I believe we should require that our step
library produce documents with a minimal and complete set of
namespace declarations.

This means we need to do the following:

1. p:add-attribute needs to retain the sentence:

   "A namespace binding is added if necessary, using the prefix
    from the QName if possible, otherwise the prefix is
    implementation-determined."

2. p:insert, p:replace should copy all in-scope namespaces from the
    inserted element to the inserted element.

3. p:rename, p:wrap, and p:wrap-sequence must have a sentence
    similar to p:add-attribute added to its description for generating
    a namespace declaration as needed.

4. p:set-attributes must ensure, similar to p:add-attribute, that the
    namespaces used by the attributes are declared.

5. p:xslt (XSLT 1.0) must state that namespace fixup must be guaranteed.
    If the XSLT processor does not do it, the step must do it.  Implementors
    beware:  use one that doesn't cause problems if you do want the penalty!

6. We also need to state that when we generate documents as results
    (e.g. p:equal) we will generate infosets with complete namespace
    declarations.

Since custom steps can output infosets without namespace declarations, we may
want to add a step to our library to perform namespace fixup.  While a
custom step
will most likely be tied to an implementation, it may be the case that a user of
XProc is attempting to use a custom step written by someone else and runs into
a problem with missing namespace declarations.  As such, it would be good to
have a way for them to perform namespace fixup and guarantee serialization.


--
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics
Received on Wednesday, 5 September 2007 15:39:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:54 GMT