Here you can find the source of xslt(InputStream stylesheet, Document input)
public static Document xslt(InputStream stylesheet, Document input) throws FileNotFoundException, TransformerException, ParserConfigurationException
//package com.java2s; //License from project: Open Source License import java.io.FileNotFoundException; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; import org.w3c.dom.Document; public class Main { public static Document xslt(InputStream stylesheet, Document input) throws FileNotFoundException, TransformerException, ParserConfigurationException { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(stylesheet)); Document result = newDocument(); DOMResult domResult = new DOMResult(result); transformer.transform(new DOMSource(input), domResult); return result; }/*from ww w . j a va2s .c om*/ public static Document newDocument() throws ParserConfigurationException { return getDocumentBuilder().newDocument(); } public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); return dbFactory.newDocumentBuilder(); } }