Esteban Gonzalez wrote:
seems like an error in the code?

               // ADDED XML VOUCHER GENERATION
                XMLGenerator xml = new XMLGenerator();
                Document voucher = xml.generateVoucher( voucherGener );
                Document xsl = xml.getXSL();

                // XSL Formatting.
                Driver driver = new Driver();
                driver.setRenderer( Driver.RENDER_PDF );
                //driver.setInputSource( new DocumentInputSource() );
                driver.setOutputStream( outStream );

                //Let's set the input
                Transformer trans =
TransformerFactory.newInstance().newTransformer( new DOMSource( xsl ) );
                trans.transform( new DOMSource( voucher ), new
AXResult( driver.getContentHandler() ));

This is already driving the formatting, everything from here won't have any effect.

                //Let's set all loggin stuff
                Logger log = null;
                Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
                PatternFormatter formatter = new
PatternFormatter("[%{priority}]: %{message}\n%{throwable}");
                LogTarget target = null;
                target = new StreamTarget(System.err, formatter);
                hierarchy.setDefaultLogTarget(target);
                log = hierarchy.getLoggerFor("fop");
                log.setPriority(Priority.DEBUG);
                driver.setLogger(log);

                //Let's try another thing
                //XSLTInputHandler input = new XSLTInputHandler(new
File(xmlParam), new File(xslParam));

                //Let's render the Formatting tree
                driver.render( voucher );

This is particularly superflous, as the document has already been rendered.

Are you sure this:
>                 Document xsl = xml.getXSL();
gets you the correct DOM for the style sheet? Try dumping it
to a file using the identity transformer:
  TransformerFactory.newInstance().newTransformer().transform(
    new DOMSource(xsl), new StreamResult(new File("dump.xsl")));

BTW Unless you have to manipulate the content, use SAX instead
of DOM whereever feasible.

J.Pietschmann



Reply via email to