Skip to main content

jaxp xsl jsp ?????????????????????????????

No replies
soulchris
Offline
Joined: 2008-01-16

I have this jsp code (no servlet) that with a xsl file without is ok, but if I insert some in this xsl file, the project don't run...
can I do???????
what do I use?????????

<br />
<%@ page contentType="text/html"<br />
   import="javax.xml.parsers.*,<br />
      org.w3c.dom.*,<br />
      javax.xml.transform.*,<br />
      javax.xml.transform.stream.*,<br />
      java.io.*,<br />
      java.util.*" %></p>
<p>         Prova</p>
<p>           test<br />
           <%<br />
                javax.xml.transform.TransformerFactory tFactory =<br />
                    javax.xml.transform.TransformerFactory.newInstance();<br />
                //get the real path for xml and xsl files.<br />
                String ctx = getServletContext().getRealPath("") + "/";<br />
                // Get the XML input document and the stylesheet, both in the servlet<br />
                // engine document directory.<br />
                javax.xml.transform.Source xmlSource =<br />
                         new javax.xml.transform.stream.StreamSource<br />
                                     (new java.net.URL("file", "", ctx+"listacd.xml").openStream());<br />
                javax.xml.transform.Source xslSource =<br />
                        new javax.xml.transform.stream.StreamSource<br />
                                     (new java.net.URL("file", "", ctx+"listacd.xsl").openStream());<br />
                // Generate the transformer.<br />
                javax.xml.transform.Transformer transformer =<br />
                                     tFactory.newTransformer(xslSource);<br />
                // Perform the transformation, sending the output to the response.<br />
                transformer.transform(xmlSource,<br />
                                   new javax.xml.transform.stream.StreamResult(out));<br />
           %><br />
           test</p>
<p>