I'm trying to implement the code to execute a transformation inside a
servlet. So far I was able to get everything done without any error
message, but the transformation is never done. My HTML file is empty. Here
is some code :
if(requestValue.equalsIgnoreCase(REQUEST_QUERY))
{
String xslInURI = "File:/Program Files/Apache
Group/Apache/htdocs/todo.xsl";
String xmlInURI = "File:/Program Files/Apache
Group/Apache/htdocs/xsltc_todo.xml";
String htmlOutURI = "C:/Program Files/Apache
Group/Apache/htdocs/todo-xsltc.html";
try{
TransformerFactory tFactory = TransformerFactory.newInstance();
// Get the XML input document and the stylesheet.
Source xmlSource = new StreamSource(xmlInURI);
Source xslSource = new StreamSource(xslInURI);
// Generate the transformer.
Transformer transformer = tFactory.newTransformer(xslSource);
// Perform the transformation, sending the output to the response.
Result streamresult = new StreamResult(new
FileOutputStream(htmlOutURI));
transformer.transform(xmlSource,streamresult);
}
catch(TransformerException e2)
{
log(e2.toString());
e2.printStackTrace();
}
ObjectOutputStream outputToApplet;
outputToApplet =
new ObjectOutputStream(response.getOutputStream());
outputToApplet.writeObject("todo-xsltc.html");
outputToApplet.flush();
outputToApplet.close();
Would you have any idea what is happening ? Your help would be appreciated.
Lyne Moreau
Together through stuff & fluff!