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 3196 - [Ser] DOCTYPE MUST be HTML or html
Summary: [Ser] DOCTYPE MUST be HTML or html
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Serialization 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Scott Boag
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-04 14:23 UTC by Joanne Tong
Modified: 2006-06-06 22:31 UTC (History)
0 users

See Also:


Attachments

Description Joanne Tong 2006-05-04 14:23:34 UTC
According to the Serialization spec, if the output method is HTML and doctype-system parameter is specified, then
... "the HTML output method MUST output a document type declaration immediately before the first element. The name following <!DOCTYPE MUST be HTML or html. " ...

According to the HTML 4 DTD:

	<!ENTITY % html.content "HEAD, BODY">

	<!ELEMENT HTML O O (%html.content;)    -- document root element -->
	<!ATTLIST HTML
 	 %i18n;                               -- lang, dir --
  	>

The html element is optional (O O).  Thus, an html document can begin with a tag other than <html> or <HTML>.  It should still validate as long as the name following <!DOCTYPE is the same as the top level element in the html document.  Should the Serialization spec allow this for the html output method?  even though this is supposedly allowed in the HTML spec (I assume to accommodate lazy html writers) and users can always use XHTML output method to get the right <!DOCTYPE.
Comment 1 David Carlisle 2006-05-04 15:28:30 UTC
The fact that the html element tag is optional doesn't affect the DOCTYPE
declaration, You can still have a top level html _element_ with its two required children head and body, but just omit the start and end _tags_ This is valid html even though there is not a single top level tag. It would not be correct to replace the "html" in the DOCTYPE with either "head" or "body".


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<title></title>
</head>
<body>
<p></p>
</body>


Of course in html (as in XHTML) You can have any fragment of a document consisting of a single element and specify the top level element in the
DOCTYPE but this is unrelated to the fact that the start tag of html is optional.

<!DOCTYPE p PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<p></p>


is valid html but would be valid XHML if the XHTML DTD were referenced, even though no start or end tags are optional in XML. You can't generate this 
example in XSLT 1 but I don't think this is a great loss. As you say you could in fact generate this example in XSLT2 using xhtml method.

David

Comment 2 Sharon Adler 2006-06-06 22:31:27 UTC
As David Carlisle points out in Comment #1 there is no error