JavaでXSLT

そういや、Antからしかやってなかったなーということで。
XMLXSLTは、ちょうど手元にあったCheckstyleのもの。


Source xml = new StreamSource(new File("checkstyle.xml"));
Source xslt = new StreamSource(new File("checkstyle-simple.xsl"));
Result output = new StreamResult(new File("result.html"));

Transformer tf = TransformerFactory.newInstance().newTransformer(xslt);
tf.transform(xml, output);


なるへそ。