This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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.
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
As David Carlisle points out in Comment #1 there is no error