[Bug 4464] [XSLT] Missing rules for misuse of the xmlns namespace

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4464

           Summary: [XSLT] Missing rules for misuse of the xmlns namespace
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


There seem to be some extra rules needed in XSLT to prevent abuse of the name
"xmlns" and the associated URI "http://www.w3.org/2000/xmlns/".

See also bug #4463 which raises similar problems for XQuery. The problems for
XSLT are less serious because XSLT inherits the rules that apply to
namespace-well-formed XML documents, however there are still one or two
omissions.

XML Namespaces 1.1 states: 

<quote>
The prefix xmlns is used only to declare namespace bindings and is by
definition bound to the namespace name http://www.w3.org/2000/xmlns/. It MUST
NOT be declared or undeclared. Other prefixes MUST NOT be bound to this
namespace name, and it MUST NOT be declared as the default namespace. Element
names MUST NOT have the prefix xmlns.
</quote>

1. We should probably make http://www.w3.org/2000/xmlns/ a reserved namespace
in section 3.2. This would ban the use of this namespace (and the prefix xmlns)
in the names of variables, functions, templates, etc. It's not obvious that the
world falls apart if we don't ban it, but we either allow it or we disallow it,
and disallowing it requires fewer test cases...

2. We should disallow use of the namespace http://www.w3.org/2000/xmlns/ in the
name of an element constructed using xsl:element. We should also either
disallow the use of the prefix xmlns, or say that if xmlns is used then a
different prefix will be substituted. This should match what we do for
attributes (see 4 below).

3. We should disallow use of the namespace http://www.w3.org/2000/xmlns/ in the
name of an attribute constructed using xsl:attribute.

4. We currently say, in a non-normative example in 11.3, that it is not an
error to write <xsl:attribute name="xmlns:xsl"
namespace="file://some.namespace">, because namespace fixup will cause a prefix
other than "xmlns" to be used. This relies on the statement "In the event of a
conflict this prefix (or absence of a prefix) may subsequently be changed
during the namespace fixup process" - that is, use of "xmlns" to refer to a
namespace other than http://www.w3.org/2000/xmlns/ is treated as a conflict for
namespace fixup to sort out. I don't see any strong reason to change this
interpretation, though we could make it more explicit rather than relying so
heavily on an example. If this is the rule for attributes, then we should
probably use the same rule for elements (see 2 above).

5. In xsl:namespace, we currently ban the use of the prefix xmlns, but we
should also ban the use of the URI http://www.w3.org/2000/xmlns/

6. Under namespace fixup, we state one of the constraints as "A namespace node
must not have the name xmlns." We should add "... or the string value
http://www.w3.org/2000/xmlns/". (We should also add this rule to XDM.)

Received on Friday, 13 April 2007 09:29:33 UTC