We would like to know how to transform two files.
import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; // www .ja va2s . c o m public class Main { public static void main(String[] args) throws Exception { Source xslSource = new StreamSource( Main.class.getResourceAsStream("test.xsl")); Source xmlSource = new StreamSource( Main.class.getResourceAsStream("test.xml")); Transformer transf = TransformerFactory.newInstance().newTransformer( xslSource); StreamResult transformedXml = new StreamResult(System.out); transf.transform(xmlSource, transformedXml); } }