<DIV>
<DIV>
<P>hi guys </P>
<P> </P>
<P> i was able to do the transformation with the following code....</P>
<P> </P>
<P> </P>
<P> </P>
<P> public Document transform(Document sourceDoc, File stylesheetFile)<BR> {<BR></P>
<P>     TransformerFactory transformerFactory = TransformerFactory.newInstance();<BR>   Templates stylesheet = transformerFactory.newTemplates(new StreamSource(stylesheetFile));<BR>     Transformer processor = stylesheet.newTransformer();<BR> </P>
<P>     //A holder for an XML Transformation source: a Document, Element, or list of nodes.<BR>     JDOMSource source = new JDOMSource(sourceDoc);</P>
<P><BR>    // A holder for an XSL Transformation result,<BR>      JDOMResult result = new JDOMResult();</P>
<P>   </P>
<P>     processor.transform(source, result);</P>
<P>     Document newDoc = result.getDocument();</P>
<P>   </P>
<P>     // Display the results<BR>     FileOutputStream resultOut = new FileOutputStream("c:\\out.html");<BR>     XMLOutputter outp = new XMLOutputter();<BR>     outp.output(newDoc, resultOut);</P>
<P>     return(newDoc);<BR> }</P>
<P> </P>
<P>CHANGES from the previous apporach</P>
<P> </P>
<P>-- i used Stream Result in place of JDOM Result</P>
<P>-- outputting the document after processing<BR></P>
<P>i was able to have the new Document because JDOMResult let me do it.</P>
<P>StreamResult does not help me with this.</P>
<P> </P>
<P>PREVIOUS CODE::</P>
<P> </P>
<P>   // Set up the XSLT stylesheet for use with Xalan-J 2<BR>   TransformerFactory transformerFactory = TransformerFactory.newInstance();<BR>   Templates stylesheet = transformerFactory.newTemplates(new StreamSource(stylesheetFile));<BR>   Transformer processor = stylesheet.newTransformer();<BR>  <BR>  //Take input Stream<BR>   FileInputStream sourceIn = new FileInputStream(new File("c:\\javaxml\\contents.xml"));<BR>   StreamSource source = new StreamSource(sourceIn);<BR>   <BR>  //Make Output Stream<BR>   FileOutputStream resultOut = new FileOutputStream(new File("c:\\out.html"));<BR>   StreamResult result = new StreamResult(resultOut);<BR>   processor.transform(source, result);</P>
<P> </P>
<P>Please suggest if someone was able to do it with StreamResult.</P>
<P> </P></DIV></DIV><p>
                <hr size=1>Yahoo! for Good<br> 
<a href="http://store.yahoo.com/redcross-donate3/">Click here to donate</a> to the Hurricane Katrina relief effort.