OutputFormat frmt = new OutputFormat("XHTML", "UTF-8", true);
frmt.setPreserveSpace(true);
frmt.setIndenting(outputIndenting);
frmt.setDoctype("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
frmt.setOmitDocumentType(omitDoctype);
return new CachingXHTMLSerializer(out, frmt);
} else {
// default case is HTML, such as that for netscape and explorer
OutputFormat frmt = new OutputFormat("HTML", "UTF-8", true);
frmt.setPreserveSpace(true);
frmt.setIndenting(outputIndenting);