I've just converted an app I'm writing from using a simple transformer (as in the UseStylesheetPI example) to using a chain of transformers (as in the Pipe example). Everything works fine, except for one small problem: the DOCTYPE (as specified in the <xsl:output/> element no longer seems to get written out.

Here, trimmed to a minimum, is the relevant code:

        StreamSource xmlSource = new StreamSource(sourcefile);
        xmlSource.setSystemId(sourcefile);
        Source stylesheet =
        tfactory.getAssociatedStylesheet(xmlSource, media, title, charset);
        TransformerHandler mainhandler =
                saxtfactory.newTransformerHandler(stylesheet);

        XMLReader reader = XMLReaderFactory.createXMLReader();
        reader.setContentHandler(mainhandler);
        reader.setProperty("http://xml.org/sax/properties/lexical-handler";,
                           mainhandler);

        Serializer serializer = SerializerFactory.getSerializer
                (OutputProperties.getDefaultMethodProperties("html"));
        serializer.setOutputStream(new FileOutputStream(targetfile));
        mainhandler.setResult(new SAXResult(serializer.asContentHandler()));

Can anyone suggest what needs to be added to get my DOCTYPE back again? (I'd also like to choose the serializer based on the <xsl:output/>, but that's a refinement I can add later).

Thanks in advance

Angus
--
[EMAIL PROTECTED]                             http://pobox.com/~angus

Reply via email to