public static void transformFile(Source stylesheetFile, File input, File output) throws TransformerException {
    TransformerFactory factory = TransformerFactory.newInstance();
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
    Transformer transformer = factory.newTransformer(stylesheetFile);
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.transform(new StreamSource(input), new StreamResult(output));
  }
public static void transformFile ( Source stylesheetFile , File input , File output ) throws TransformerException { TransformerFactory factory = TransformerFactory . newInstance ( ) ; factory . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; Transformer transformer = factory . newTransformer ( stylesheetFile ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . transform ( new StreamSource ( input ) , new StreamResult ( output ) ) ; }
transformFile

@param stylesheetFile
@param input
@param output
@exception TransformerException