This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 30128 - POLYGLOT namespace declarations
Summary: POLYGLOT namespace declarations
Status: RESOLVED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.1 (show other bugs)
Version: Recommendation
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-15 15:23 UTC by Alejandro Rojas Cepeda
Modified: 2017-07-11 15:22 UTC (History)
2 users (show)

See Also:


Attachments

Description Alejandro Rojas Cepeda 2017-06-15 15:23:31 UTC
Test with this problem:
Serialization-xhtml-2
Serialization-xhtml-21
Serialization-xhtml-22
Serialization-xhtml-38
Serialization-xhtml-40

In the tests from the above list, the expected ouput match for the first element <html> is &lt;html&gt; but I think
it should also allow to match a namespace declaration for XHTML namespace like this: &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
This to allow implementations to create quirk-compatible documents.

This because the spec says:

... If the value of the html-version serialization parameter is 5.0, the serializer SHOULD output namespace 
declarations in a way that is consistent with the requirements of [POLYGLOT]. ...

From POLYGLOT[https://www.w3.org/TR/html-polyglot/] :

4.4.1 Element-level namespaces

[HTML5] introduces undeclared (native) default namespaces for the root HTML element, html, the root SVG element, svg, 
and the root MathML element, math. Polyglot markup declares the following default namespaces, when the markup languages 
are included in the document, to maintain XML compatibility [XML10]:

    <html xmlns="http://www.w3.org/1999/xhtml"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <svg xmlns="http://www.w3.org/2000/svg"> 

Polyglot markup declares the default namespaces on the root HTML element, html, the root SVG element, svg, and the root
 MathML element math, and on any HTML elements used as children of SVG or MathML elements. Polyglot markup does not 
declare any other default or prefixed element namespace, because [HTML5] does not natively support the declaring of 
any other default or prefixed element namespace.
Comment 1 Michael Kay 2017-06-15 22:59:13 UTC
I disagree. The spec says

The serializer MUST output namespace declarations that are consistent with the namespace nodes present in the result tree, 

I don't think the serializer is entitled to move elements into a different namespace. The prefix normalization process defined for XHTML changes the prefix assigned to an element, and removes unused namespaces, but it never moves an element from one namespace into another.