Here you can find the source of getDocument(String xslName)
private static void getDocument(String xslName)
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.net.URL; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class Main { private static Document xsl = null; private static void getDocument(String xslName) { try {//from w w w. ja v a2s.c om URL xslUri = new URL(xslName); InputStream xslIs = xslUri.openStream(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); xsl = dBuilder.parse(xslIs); xsl.getDocumentElement().normalize(); } catch (ParserConfigurationException ex) { throw new RuntimeException(ex); } catch (SAXException ex) { throw new RuntimeException(ex); } catch (IOException ex) { throw new RuntimeException(ex); } } }