[jdom-interest] Using XSL with stylesheet coming from a URL

Jason Long jason at supernovasoftware.com
Fri Feb 28 16:35:57 PST 2003

I have been using the following function to do XSL transform with JDOM.
Could someone please point me to an example of how to do this if the XSL is
generaled by JSP and needs to be read from a URL?

   public static Document transform(Document in, String stylesheet)
     throws JDOMException, Exception {
    try {
     Transformer transformer =
TransformerFactory.newInstance().newTransformer(new StreamSource(new
     JDOMResult out = new JDOMResult();
     transformer.transform(new JDOMSource(in), out);
     return out.getDocument();
   } catch (Exception e) {
     throw new JDOMException("XSLT Transformation failed", e);

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

More information about the jdom-interest mailing list