Here you can find the source of getTransformer(StreamSource streamSource)
public static Transformer getTransformer(StreamSource streamSource)
//package com.java2s; //License from project: Apache License import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; public class Main { public static Transformer getTransformer(StreamSource streamSource) { // setup the xslt transformer System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl"); //net.sf.saxon.TransformerFactoryImpl impl = new net.sf.saxon.TransformerFactoryImpl(); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = null; try {/*from w w w .j av a 2 s .c om*/ if (streamSource != null) { transformer = tFactory.newTransformer(streamSource); } else { transformer = tFactory.newTransformer(); } //return impl.newTransformer(streamSource); return transformer; } catch (TransformerConfigurationException e) { e.printStackTrace(); } return null; } }