[jdom-interest] JDOM + XSLT
himank gupta
h_i_m_a_n_k at yahoo.com
Wed Sep 28 05:49:52 PDT 2005
Hi all..
With the following code for transforming a xml file to html
public Document transform(Document sourceDoc, File stylesheetFile)
{
// Set up the XSLT stylesheet for use with Xalan-J 2
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Templates stylesheet = transformerFactory.newTemplates(new StreamSource(stylesheetFile));
Transformer processor = stylesheet.newTransformer();
//Output the Document to File
FileOutputStream sourceOut = new FileOutputStream(new File("c:\\in.xml"));
XMLOutputter xmlOutputter = new XMLOutputter();
xmlOutputter.output(sourceDoc, sourceOut);
sourceOut.close();
//Take input Stream
FileInputStream sourceIn = new FileInputStream(new File("c:\\in.xml"));
StreamSource source = new StreamSource(sourceIn);
//Make Output Stream
FileOutputStream resultOut = new FileOutputStream("c:\\out.html");
StreamResult result = new StreamResult(resultOut);
// Feed the resultant I/O stream into the XSLT processor
processor.transform(source, result);
resultOut.close();
}
I get this exception
A '(' character or an element type is required in the declaration of element type "JavaXML:Title".
But if i am transforming without jdom that is by using org.apache....Process class from console the transformation works fine.
Regards
Himank Gupta.
---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20050928/499232c4/attachment.htm
More information about the jdom-interest
mailing list