import javax.xml.transform.*; import javax.xml.transform.stream.*; public class HelloWorldXSLT { public static void main( String[] args) { try { // TransformerFactoryインスタンスを取得 TransformerFactory factory = TransformerFactory.newInstance(); // XSLファイルからtranceformerを取得 Transformer transformer = factory.newTransformer(new StreamSource("helloworldxslt.xsl")); // 出力するエンコーディングを設定 transformer.setOutputProperty("encoding","Shift_JIS"); // XMLファイルをXSLTで変換して出力 transformer.transform(new StreamSource( "helloworldxslt.xml"), new StreamResult(System.out)); } catch(Exception e) { e.printStackTrace(); } } }