public static String transform ( Source xml , Source xslt ) { if ( xml != null && xslt != null ) { try { StringWriter output = new StringWriter ( ) ; Result result = new StreamResult ( output ) ; javax . xml . transform . TransformerFactory . newInstance ( ) . newTransformer ( xslt ) . transform ( xml , result ) ; return output . toString ( ) ; } catch ( Exception ex ) { LOGGER . warn ( "Failed to apply XSLT transformation: [{}]" , ex . getMessage ( ) ) ; } } return null ; }
Apply an XSLT transformation to a Document .