Bug 20251 - [SER30] DOCTYPE declaration - prefix in name
Summary: [SER30] DOCTYPE declaration - prefix in name
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Henry Zongaro
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2012-12-05 18:02 UTC by Michael Kay
Modified: 2013-01-15 15:35 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kay 2012-12-05 18:02:14 UTC
Section 6.1.7 para 1 states:

The name following <!DOCTYPE MUST be the same as the local part of the name of the element.

However, XML 1.0 requires:

Validity constraint: Root Element Type

The Name in the document type declaration must match the element type of the root element.

and I believe "element type" here means the lexical QName as written, including any prefix, since XML 1.0 is not namespace-aware.
Comment 1 Henry Zongaro 2012-12-05 18:24:11 UTC
That was intentional.  Item 4 in the second bulleted list in section 6 of serialization states, in part, "If the value of the html-version serialization parameter is 5.0, any element node that has a prefix and is in the XHTML namespace, MathML namespace, or SVG namespace MUST be serialized with an unprefixed element name."

That's the "prefix stripping" that the Working Groups requested.  The DOCTYPE for the XHTML output method must strip the prefix from the element name as well.  So if the data model instance was

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"><xhtml:body/></xhtml:html>

and doctype-public and doctype-system are both absent, the serialized result will be

<!DOCTYPE html><html><body></body></html>

But now that you've drawn my attention to it, I see that if either doctype-system or doctype-public is not absent, the behaviour is defined by the XML output method, which will preserve the prefix, resulting in something like the following for the same example:

<!DOCTYPE xhtml:html "about:legacy-compat"><html><body></body></html>

which is clearly incorrect.
Comment 2 Michael Kay 2012-12-05 18:38:12 UTC
Thanks - I missed that.
Comment 3 Henry Zongaro 2013-01-14 11:03:38 UTC
Michael, at their joint teleconference of 18 December 2012,[1] the XSLT and XQuery Working Groups decided to revise the Serialization 3.0 document to address the issue identified in comment #1.  The revised text will appear in the next working draft of Serialization 3.0.

As you were present when this decision was made, I trust you agree with it, and I will mark the bug as CLOSED.

[1] https://lists.w3.org/Archives/Member/w3c-xsl-query/2012Dec/0054.html
Comment 4 Henry Zongaro 2013-01-15 15:35:58 UTC
The changes for this bug have been subsumed by the changes for bug 20261.