xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Georg Seipler" <gesei...@fht-esslingen.de>
Subject Formatting XML and XSL output ?
Date Mon, 10 Jan 2000 10:24:27 GMT
Dear apache experts,

I've just recently switched from using ProjectX from SUN and XSL:P from
Keith Visco to Xerces and Xalan. Everything is working fine so far, however
I have one problem:

How do I get an indented (pretty-printed) output ?

The code I use so far looks like:

// combine XML document and XSL stylesheet, output resulting HTML
XSLTProcessor processor = XSLTProcessorFactory.getProcessor(new

 XSLTInputSource xmlSource = new XSLTInputSource((Node)xmlDoc);
XSLTInputSource xslSource = new
Document htmlDoc = new DocumentImpl();
XSLTResultTarget xslt = new XSLTResultTarget(htmlDoc);
processor.process(xmlSource, xslSource, xslt);

 FormatterToHTML fth = new FormatterToHTML(out);
TreeWalker tw = new TreeWalker(fth);

with out being a PrintWriter (of the servlet) and getXslSheet a method to
fetch the sheet from a cache.

It works. But the output is unreadable (everything in one line, or close).
Once more: how do I get an indented, readable output of an existing DOM ?
(preferably without writing my own printer for this)

Anybody able to help ?

And Greetings,
Georg Seipler

View raw message