[Wh2fo-devel] Re: WH2FO Servlet
Status: Beta
Brought to you by:
fabgia
From: Carlos N. <cc...@ho...> - 2002-01-14 17:57:30
|
I'll try to explain myself... My intention is to develop a servlet that extends FopServlet, adding all the addicional steps to obtain a pdf from a doc. And ship it with wh2fo as an example of embedding wh2fo (as FopServlet is). I don't want a heavy xml framework as cocoon, only a lightweight Servlet. The other big limitation is not to use the filesystem for temporal intermediate xml files. So, imagine we have the java.xml.transform.stream.StreamSource's from, for example, Tables.xml and Tables.xsl (wh2fo has done its job) and we want the transformation result in a java.xml.transform.stream.StreamResult that later will feed the org.xml.sax.InputSource. Once here we can instantiate org.apache.fop.apps.Driver(org.xml.sax.InputSource, java.io.OutputStream) from FOP 0.20. In order to do such feeding i use a circular buffer: ... PipedInputStream bufferIn= new PipedInputStream(); PipedOutputStream bufferOut= new PipedOutputStream(bufferIn); Transformer transformer = transformerFactory.newTransformer(xslSource); transformer.transform(xmlSource, new StreamResult(bufferOut)); bufferOut.close(); ... Driver driver = new Driver(new InputSource(bufferIn), out); driver.run(); ... Well theoretically this should be ok, but it hangs Xalan. I have found similar problem reported at: http://www.biglist.com/lists/xsl-list/archives/199911/msg00422.html It seems that the stream returned from the PipedInputStream is null-terminated and this hangs the parser. But i don't know how to strip off the null from a PipedInputStream and later convert it to InputSource (my java weakness arrises here). Could any of you help me on this (assuming that any of you have understood me...) ;-( Thanks!!!!! Carlos. >From: "Giannetti, Fabio" <Fab...@hp...> >To: wh2...@li... >Subject: [Wh2fo-devel] WH2FO Servlet >Date: Fri, 11 Jan 2002 09:03:20 -0000 > >Hi Carlos, > let's go straight to the point 4 >I've tried an example made for FOA (MyBank) that uses a lot of >apply-templates with the document function e.g. ><xsl:apply-templates >select="document('accounts.xml')//accounts/account[1]/number" /> >and I haven't found any problem at all. I use the xalan that is coming with >the fop dist (xalan 2.0.0 & xerces 1.2.3) using this command line: >java org.apache.xalan.xslt.Process -IN letter.xml -XSL MyBank.xsl -OUT >MyBank.fo >I send you the MyBank example so you can see some "strange" templates. >Hope this helps, Fabio > > > > -----Original Message----- > > From: Carlos Navarro [mailto:cc...@ho...] > > Sent: 10 January 2002 11:46 > > To: wh2...@li... > > Subject: [Wh2fo-devel] Getting familiarized and more > > > > > > Hi Nachev, Matthias and Fabio > > > > Well, for now, i'm trying to get more and more familiarized > > with the code, > > and trying to develop a servlet like FopServlet that helps > > you to get a pdf > > from a word2000-html file instead of fo file. > > > > The basic steps will be: > > 1) Get a Word2000-Html ready for dynamic data > > 2) Get a xml fed up with the data. > > 3) Get the wh2fo's xml, xsl and AttsXsl with wh2fo from 1) > > 4) Get the fo with xalan from 2) and 3) > > 5) Get the pdf with fop from 4) > ><< MyBank.zip >> _________________________________________________________________ MSN Photos es la manera más sencilla de compartir, editar e imprimir sus fotos favoritas. http://photos.latam.msn.com/Support/WorldWide.aspx |