Java XML Document Transform transform(Source xsl, Document doc)

Here you can find the source of transform(Source xsl, Document doc)

Description

transform

License

Open Source License

Declaration

public static String transform(Source xsl, Document doc) 

Method Source Code


//package com.java2s;
import java.io.StringWriter;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;

public class Main {
    public static String transform(Source xsl, Document doc) {
        StringWriter writer = new StringWriter();
        try {/*from  w  w  w  . j a  v a 2  s .c  om*/
            TransformerFactory.newInstance().newTransformer(xsl).transform(new DOMSource(doc),
                    new StreamResult(writer));
        } catch (Exception e) {
        }
        return writer.toString();
    }
}

Related

  1. transform(Document doc, Result result)
  2. transform(Document doc, StreamSource xslInput, String systemid)
  3. transform(Document document, Properties outputProperties, StreamResult streamResult)
  4. transform(Document dom, Document xslt)
  5. transform(final Document document, final StreamResult streamResult, final boolean xmlDeclaration)
  6. transformDoc(Document doc)
  7. transformDocToFile(Document doc, File file)
  8. transformDocument(Document doc, String xsl, String targetFile)
  9. transformDocument(Document xmlDocument, String xsltFilename)