// prepare Input and Output
Result htmlResult = new StreamResult(
Files.newBufferedWriter(outfile, StandardCharsets.UTF_8));
SAXSource source = new SAXSource(
new InputSource(Files.newInputStream(infile)));
// read XSLT
Transformer transformer =
TransformerFactory.newInstance().newTransformer(
new StreamSource(DEFAULT_XSLT));
// do transformation
transformer.transform(source, htmlResult);