RE: [xsl] dealing with doctype dtd's

Subject: RE: [xsl] dealing with doctype dtd's
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 30 Jan 2001 21:26:27 -0000
> But I would like to be able to identify the existing doctype
> in the original
> xml, and output it in the new XML without changing it, or
> omit it altogether if it does not exist.

A reasonable request, but I'm afraid it can't be done directly: the DOCTYPE
declaration is not part of the tree model of the document used by XPath and

My suggestion would be to add a SAX2 filter in front of the XSLT processing.
This filter can detect the DOCTYPE declaration and wrap it up as something
else, for example a processing instruction. For symmetry you could then put
another SAX2 filter after the XSLT processing to handle the reverse

Mike Kay

 XSL-List info and archive:

Current Thread