If you have a tag where by you pass the path as an attribute.

What is the correct way to go about referencing the resource?

stylesheetURL contains a path relative to the applications root context. Is
that any more efficient than using a URL object to reference it via a HTTP
request? Presumably the form totally avoids a roundtrip.

 try {

        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        XSLTInputSource xmlSource = new XSLTInputSource(new
StringReader(xmlin));

        //URL ssURL = new URL(stylesheetURL);
        //styleSheetInputStream = ssURL.openStream();

        styleSheetInputStream =
pageContext.getServletContext().getResourceAsStream(stylesheetURL);

        XSLTInputSource xslStylesheet = new
          XSLTInputSource(styleSheetInputStream);

        StringWriter transformationWriter = new StringWriter();
        XSLTResultTarget xmlOutput = new
XSLTResultTarget(transformationWriter);
        processor.process(xmlSource, xslStylesheet, xmlOutput);
        return transformationWriter.toString();
      }

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to