Code example for TransformerFactory

Methods: newTransformer

    public void testSaxonExt() throws Exception { 
        Class clazz = Class.forName("net.sf.saxon.TransformerFactoryImpl");
        TransformerFactory factory = (TransformerFactory)clazz.newInstance();
        Transformer trans = factory.newTransformer(new StreamSource(
                new File(getBaseDir(), "src/saxon8/test/xml/saxon8-test.xsl")));
        Source src = new StreamSource(
                new File(getBaseDir(), "src/test/xml/xslt-test.xml"));
        StringWriter writer = new StringWriter();
        Result res = new StreamResult(writer);
        trans.transform(src, res);
        String output = writer.getBuffer().toString();
        assertTrue(output.indexOf("svg") >= 0);
Connect your IDE to all the code out there  Get Codota for Java