[jdom-interest] Passing JDOM to JAXP using SAX

Per Norrman pernorrman at telia.com
Fri Apr 30 03:56:55 PDT 2004


Hi,

Daniel Purucker wrote:
> Hi,
> i want to transform an jdom-document with xslt. Because i'm not able to 
> pass JDOM-Output directly to JAXP, i'm using the workaround proposed by 
> Eric Burke, to transform JDOM into SAX.

it is not entirely clear what you want to do. But if you have
a JDOM Document and a stylesheet to transform it, but want to produce
SAX event from that transformation, I think something like this should 
do it:
	
	Document doc = ....
	String xsl = <style sheet URL>

         TransformerFactory factory = TransformerFactory.newInstance();
	Transformer t = factory.newTransformer(new StreamSource(xsl));
         SAXResult result = new SAXResult(...);
         t.transform(new JDOMSource(doc), result);


> What's wrong?
> the "stylesheet" has to be an instance of 
> "javax.xml.transform.Templates", but how do i create this?

Who says it must be Templates instance? Your requirements or an error
message?


/pmn



More information about the jdom-interest mailing list