baseURL = xmlFile.getParentFile().toURI().toURL().toExternalForm();
} catch (Exception e) {
logger.error("Error setting base directory");
}
InputHandler inputHandler = null;
if (xsl == null) {
inputHandler = new InputHandler(xmlFile);
} else {
inputHandler = new InputHandler(xmlFile,
new File(baseDir + "/"
+ xsl), null);
}
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setBaseURL(baseURL);
userAgent.getRendererOptions().put("fineDetail", new Boolean(false));
userAgent.getRendererOptions().put("consistentOutput", new Boolean(true));
userAgent.setProducer("Testsuite Converter");
String outname = res;
if (outname.endsWith(".xml") || outname.endsWith(".pdf")) {
outname = outname.substring(0, outname.length() - 4);
}
File outputFile = new File(destdir,
outname + makeResultExtension());
outputFile.getParentFile().mkdirs();
OutputStream outStream = new java.io.BufferedOutputStream(
new java.io.FileOutputStream(outputFile));
logger.debug("ddir:" + destdir + " on:" + outputFile.getName());
inputHandler.renderTo(userAgent, outputFormat, outStream);
outStream.close();
// check difference
if (compare != null) {
File f1 = new File(destdir, outname + ".at.xml");