Balaji Loganathan wrote:
Is it possible to do the same for HTML that is
http://servername/servlet/FopServlet?xml=data.xml&xsl=format.xsl&dummy=test.html
 ,I tried to change the code of FopServlet like
......
response.setContentType("text/html");

Driver driver = new Driver(foFile, out);
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_TXT);
...
 But I'm getting unknown formaating object HTML as
error.
 Have any one tried it? Basically I want to convert
XML to PDF or HTML using servlets.

You'll have to gain some more understanding of the underlying technology. The XSL standard consists of two main parts: - XSLT which defines a language for describing transformations from arbitrary XML to other stuff, mainly other XML, and - XSLFO, which defines a language for describing how to layout stuff, mainly on paged media.

The first part, XSLT, can be used to describe a transformation
of arbitrary XML to (X)HMTL, or, using anther transformation,
to XSLFO. The gadgets actually doing such a transformation
are called XSLT processors, and Xalan (delivered with FOP) is
such a beast (others are Saxon, MSXML, libxslt, there are more).
FOP is a processor for transforming XSLFO into a variety of
other formats, like PDF, Postscript, Text, or direct rendering
into a Java AWT canvas.
Therefore, FOP is not the right tool to transform arbitrary XML
to HTML. Get the Xalan or Saxon distribution and look at the
example servlets delivered there.
As others have mentioned, Cocoon is a nice framework which
takes most of the dirty Java programming from you. Once you
get used to it, your productivity will get a major boost.

J.Pietschmann




Reply via email to