* @throws SAXException SAX Parsing Error on the style Sheet.
*/
protected void transform(Node root, String xslname, String htmlname) throws SAXException {
try{
final long t0 = System.currentTimeMillis();
XSLTInputSource xsl_source = getXSLStreamSource(xslname);
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
File htmlfile = new File(toDir, htmlname);
// create the directory if it does not exist
File dir = new File(htmlfile.getParent()); // getParentFile is in JDK1.2+
if (!dir.exists()) {
dir.mkdirs();
}
task.log("Applying '" + xslname + "'. Generating '" + htmlfile + "'", Project.MSG_VERBOSE);
processor.process( new XSLTInputSource(root), xsl_source, new XSLTResultTarget(htmlfile.getAbsolutePath()) );
final long dt = System.currentTimeMillis() - t0;
task.log("Transform time for " + xslname + ": " + dt + "ms");
} catch (IOException e){
task.log(e.getMessage(), Project.MSG_ERR);
e.printStackTrace(); //@todo bad, change this