This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: dealing with doctype dtd's
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] dealing with doctype dtd's
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Tue, 30 Jan 2001 21:26:27 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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
XSLT.
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
conversion.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list