Result result = null;
try {
fop = fopFactory.newFop(outputFormat, new NullOutputStream());
result = new SAXResult(new PlaceholderReplacementHandler(fop.getDefaultHandler(), placeholderLookup));
} catch (FOPException e) {
throw new Docx4JException("Exception setting up result for fo transformation: " + e.getMessage(), e);
}
Transformer transformer;
try {
transformer = XmlUtils.getTransformerFactory().newTransformer();
transformer.transform(foDocumentSrc, result);
} catch (TransformerConfigurationException e) {
throw new Docx4JException("Exception setting up transformer: " + e.getMessage(), e);
} catch (TransformerException e) {
throw new Docx4JException("Exception executing transformer: " + e.getMessage(), e);
}
return fop.getResults();
}