You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Thorsten <th...@stny.rr.com> on 2002/05/31 04:30:27 UTC

Dynamically creating XML data for XSLT -> FOP

I have been using FOP both within Cocoon and as a servlet, using static XML 
(data) and XSL files as input. 

Now I need to dynamically generate the XML data portion from within the 
servlet (the XSL file would still be static.) What is the best approach for 
this? 

Upon perusing the source of org.apache.fop.apps.XSLTInputHandler, Driver, and 
related classes, it seems I should be able to use Xalan APIs to build an 
org.xml.sax.InputSource from my own org.xml.sax.ContentHandler and the XSL 
file.

Are there any examples on how to integrate this with FOP? (I'd just hate to 
have to reinvent the wheel here. ;-)) 

Also, would it perhaps make sense to extends XSLTInputHandler to support this 
behavior in a convenient way (instead of only using static XML files)?

Thanks,
Thorsten

Re: Dynamically creating XML data for XSLT -> FOP

Posted by Esteban Gonzalez <eg...@outside.com.ar>.
Well...

that´s what i do inside my app...

I use xerces to dinamicallly create the XML with some DB data..
then I dinamically generate the XSLT ( strange requirements from the
client ),
and I do the transformation with fop...

I haven´t been able to get it working yet
 javax.xml.transform.TransformerConfigurationException: stylesheet requires
attribute: version ) but I´ll figure it out soon... hopefully with some help
from someone here... =)

If there´s any help you might need.. then just ask... =)

Best Regards,
ESteban

----- Original Message -----
From: "Bertrand Delacretaz" <bd...@codeconsult.ch>
To: <fo...@xml.apache.org>
Sent: Friday, May 31, 2002 2:44 AM
Subject: Re: Dynamically creating XML data for XSLT -> FOP


> Hi Thorsten,
>
> On Friday 31 May 2002 04:30, Thorsten wrote:
> > I have been using FOP both within Cocoon and as a servlet, using static
XML
> > (data) and XSL files as input.
> >
> > Now I need to dynamically generate the XML data portion from within the
> > servlet (the XSL file would still be static.) What is the best approach
for
> > this?
>
> jdom (http://www.jdom.org) is a very good library for generating XML data
> dynamically, it allows you to manipulate XML documents at a higher level
than
> just DOM.
>
> Also, you might want to have a look at Cocoon
(http://xml.apache.org/cocoon)
> which allows you to easily combine Generators (to produce XML),
Transformers
> (XSL files for example) and Serializers (XML, PDF using FOP, RTF, etc.) to
> create many formats dynamically.
>
> --
>  Bertrand Delacrétaz (codeconsult.ch, jfor.org)
>
>  buzzwords: XML, java, XSLT, cocoon, mentoring/teaching/coding.
>  disclaimer: eternity is very long. mostly towards the end. get ready.
>
>
>
>
>



Re: Dynamically creating XML data for XSLT -> FOP

Posted by Bertrand Delacretaz <bd...@codeconsult.ch>.
Hi Thorsten,

On Friday 31 May 2002 04:30, Thorsten wrote:
> I have been using FOP both within Cocoon and as a servlet, using static XML
> (data) and XSL files as input.
>
> Now I need to dynamically generate the XML data portion from within the
> servlet (the XSL file would still be static.) What is the best approach for
> this?

jdom (http://www.jdom.org) is a very good library for generating XML data 
dynamically, it allows you to manipulate XML documents at a higher level than 
just DOM. 

Also, you might want to have a look at Cocoon (http://xml.apache.org/cocoon) 
which allows you to easily combine Generators (to produce XML), Transformers 
(XSL files for example) and Serializers (XML, PDF using FOP, RTF, etc.) to 
create many formats dynamically.

-- 
 Bertrand Delacrétaz (codeconsult.ch, jfor.org)

 buzzwords: XML, java, XSLT, cocoon, mentoring/teaching/coding.
 disclaimer: eternity is very long. mostly towards the end. get ready.