We can setup a method that we can use to load the XSLT:
<%! File transformFile; public void jspInit() { ServletConfig config = getServletConfig(); transformFile = new File(config.getServletContext().getRealPath("service.xsl")); } public Transformer loadTransformer() { ServletConfig config = getServletConfig(); try { TransformerFactory tfactory = TransformerFactory.newInstance(); return tfactory.newTransformer(new StreamSource(transformFile)); } catch (Exception ex) { config.getServletContext().log("Cannot load stylesheet.",ex); } return null; } %>