Hello,
i
don't know how to view my xslt result.
i am
working on a project , where all the data of the software can be saved to
xml...
now i
want to create a pdf report file out of the xml data, and i only provide and xsl
file with FO tags.
so i
have written a java class with the following code:
{
// create XML Tree with project data
Document doc =
DocumentFactory.getInstance().createDocument();
YpiXML ypiXML = new YpiXML(projekt);
YpiXML ypiXML = new YpiXML(projekt);
ypiXML.setFile(outFile);
ypiXML.saveProjektDaten(doc, true);
ypiXML.saveProjektDaten(doc, true);
OutputStream xmlstream = new
ByteArrayOutputStream();
ByteArrayInputStream istream = null;
String s = "";
OutputFormat outFormat = new OutputFormat();
outFormat.setEncoding("windows-1252");
XMLWriter writer = new XMLWriter(xmlstream,outFormat);
writer.write(doc);
writer.flush();
s = xmlstream.toString();
stream = new ByteArrayInputStream(s.getBytes());
String stemp = istream.toString();
istream.close();
Source strSource = new StreamSource(new StringReader(s));
TransformerFactory transformerFactory = TransformerFactory.newInstance ();
Templates template = transformerFactory.newTemplates(new StreamSource(xslFile));
Transformer transformer = template.newTransformer();
Driver driver = new Driver();
driver.setRenderer(driver.RENDER_PDF);
FileOutputStream fo = new FileOutputStream(outFile);
driver.setOutputStream(fo);
Result saxResult = new SAXResult( driver.getContentHandler() );
transformer.transform( strSource, saxResult );
ByteArrayInputStream istream = null;
String s = "";
OutputFormat outFormat = new OutputFormat();
outFormat.setEncoding("windows-1252");
XMLWriter writer = new XMLWriter(xmlstream,outFormat);
writer.write(doc);
writer.flush();
s = xmlstream.toString();
stream = new ByteArrayInputStream(s.getBytes());
String stemp = istream.toString();
istream.close();
Source strSource = new StreamSource(new StringReader(s));
TransformerFactory transformerFactory = TransformerFactory.newInstance ();
Templates template = transformerFactory.newTemplates(new StreamSource(xslFile));
Transformer transformer = template.newTransformer();
Driver driver = new Driver();
driver.setRenderer(driver.RENDER_PDF);
FileOutputStream fo = new FileOutputStream(outFile);
driver.setOutputStream(fo);
Result saxResult = new SAXResult( driver.getContentHandler() );
transformer.transform( strSource, saxResult );
driver.reset();
fo.flush();
fo.close();
}
fo.flush();
fo.close();
}
This works very well, i only have to provide an xsl File that contains the information, which data of the xml file should be shown in the pdf.when a table larger than one pdf (A4) page has to be created, the endless loop appears. otherwise it runs with no problem...As i am really new to FOP, any hints are welcome,regards,T. Kuhn-----Urspr�ngliche Nachricht-----
Von: J.Pietschmann [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 30. September 2002 21:53
An: [EMAIL PROTECTED]
Betreff: Re: AW: large tables loop problemTobias Kuhn wrote:
> This is the part of the code creating the tables which will not fit in
> one page in some cases...I can't reproduce the problem.
Posting snippets form the XSLT is unwise, you should post
the result of the XSL transformation, after trimming it
to the part which actually demonstrates the problem, and
perhaps anonymizing company data.I guess you'll spot the problem yourself when looking
at the XSLT result.J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
