Java Transformer API. Unexpected Result
Hello there,
I need to use javax.transform API for a XSLT transformation of mine. My problem is:
the result ist not (as expected) the transformed XML (i.e. the XSLT-template applied to the XML document) but the XSLT-stylesheet itself! After hours of google I've given up now :(
My code below:
[code]
Document xmlTemplate;
Document xslTemplate;
Source xmlTemplateSrc = new DOMSource(xmlTemplate);
Source xslTemplateSrc = new DOMSource(xslTemplate);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = null;
Templates templates = null;
try {
templates = factory.newTemplates(xslTemplateSrc);
transformer = templates.newTransformer();
} catch (TransformerConfigurationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
DOMResult domResult = new DOMResult();
try {
[b]transformer.transform(xmlTemplateSrc, domResult);[/b]
} catch (TransformerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return (Document) domResult.getNode();
[/code]
What I get as Result in the DOMResult object is the XSLT-template I'm using for the transformation.
Really looking forward to some answers,
regards
christian

