[jdom-interest] DOCTYPE instruction & JDOMSource

sv3n at gmx.at sv3n at gmx.at
Wed Feb 20 10:59:19 PST 2002


Hope this is not too much of a newbie question here:

Having xstl templates containing the following xsl:output element:

<xsl:output method="html" encoding="utf-8"
doctype-public="-//W3C//DTDHTML 4.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/REC-html4/loose.dtd" indent="yes"/>

I was hoping to receive a html file containing the specified doctype instruction.

This seems to work ok when directly transforming with xalan, using some code like this:

JDOMSource source = new JDOMSource(document);
Result result = new StreamResult(out);
transformer.transform(source, result);

When I instead of transforming directly to a StreamResult use a
JDOMResult und print the document using XMLOutputter:

JDOMSource source = new JDOMSource(document);
JDOMResult result = new JDOMResult();
transformer.transform(source, result);
XMLOutputter outputter = new XMLOutptutter("  ", true);
outputter.output(result.getDocument(), out);

Then the DOCTYPE instruction is missing in the resulting html.

Anybody, any clues for me ?



More information about the jdom-interest mailing list