rendered paste body public XsltTransformer(Document doc, String xslFile) throws Exception {
this.xmlSource = convertXMLDoc2StreamSource(doc);
this.xslSource = new StreamSource ( new FileReader( xslFile ) );
}
public String TransformXslt( ) throws Exception {
String res = "";
Transformer transformer = TransformerFactory.newInstance().newTransformer( xslSource );
transformer.transform( xmlSource, new StreamResult( res ) );
return res;
}
--- in the servlet :
try {
commandeXmlImpl cmd = new commandeXmlImpl();
Document doc = cmd.retrieveAll();
String path = getServletContext().getRealPath("/WEB-INF/xsl/liste.xsl");
XsltTransformer xsltt = new XsltTransformer( doc, path );
String result = xsltt.TransformXslt();
out.println(result);
out.close();
} catch (Exception e) {
out.println(e.toString());
}