Here you can find the source of transformar(String xmlOrigen, String xslOrigen)
public static String transformar(String xmlOrigen, String xslOrigen) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class Main { public static String transformar(String xmlOrigen, String xslOrigen) throws Exception { //System.out.println("xmlOrigen:"+xmlOrigen); InputStream is = new ByteArrayInputStream(xmlOrigen.getBytes("UTF-8")); Source xmlSource = new StreamSource(is); Source xsltSource = new StreamSource(new File(xslOrigen)); StringWriter cadenaSalida = new StringWriter(); Result bufferResultado = new StreamResult(cadenaSalida); TransformerFactory factoriaTrans = TransformerFactory.newInstance(); Transformer transformador = factoriaTrans.newTransformer(xsltSource); transformador.transform(xmlSource, bufferResultado); return cadenaSalida.toString(); }//from w ww . java2 s. c o m }