DOCTYPE misunderstood

Richard Light richard at
Fri May 9 08:58:33 BST 1997

In message <199705082132.OAA11351 at>, Jon Bosak
<bosak at atlantic-83.Eng.Sun.COM> writes
>In the meantime, you should NOT use doctypes as a way to switch
>between output formats from the same source file.  The source file is
>conceptually one document type regardless of the output format.

I've been thinking about the issue of what comes at the head of an XML
document.  This may be stating the obvious, but ...

While it would be generally agreed that you can't gratuitously stick any
old <!DOCTYPE header onto a piece of well-formed XML, I think there is a
case for architecting XML so that you _can_ hold the naked XML without
_any_ header information, and prepend both DOCTYPE and style processing
instructions at delivery time.

One reason is that you might want to author a document in chunks, and
either publish/work with the chunks in their own right, or put those
chunks together via a 'master document' containing lots of entity
references to pull the chunks in.  For the first purpose, the free-
standing chunks will require a DOCTYPE header, not least so you can
create them in a structured XML-aware editor.  For the second purpose,
they need to be 'naked', since you can't pull in an entity with a
DOCTYPE at the beginning, and we don't have the SMGL SUBDOC facility in

Another reason is that you might have slightly variant DTDs for the same
conceptual document type, and a production process whereby the documents
start of conforming to say an author-friendly DTD, and then progress to
conform to a stricter 'delivery' DTD.  Again, this can only happen if
you can switch in a DTD at document load time.

However, the reason I started along this line of thought was based
around the much more comfortable area of output formats, i.e. style
sheets.  We certainly need an easy way to prepend instructions to bind a
style sheet to a document at delivery time, so that its style is not
bound into the DTD declaration.  A processing instruction 'up front'
would be the obvious way to do this:

<?XML version="1.0"?>
<?XML-STYLE ...>

Richard Light
SGML and Museum Information Consultancy
richard at
3 Midfields Walk 
Burgess Hill
West Sussex RH15 8JA
tel. (44) 1444 232067

xml-dev: A list for W3C XML Developers
Archived as:
To unsubscribe, send to majordomo at the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at

More information about the Xml-dev mailing list