You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Ali Zain Banatwala <az...@yahoo.com> on 2003/03/26 02:26:06 UTC

xslt servlet trouble - nothing outputs

Hi,
  i'm using Tomcat 4.1 and i'm having trouble trying
to get my xml file to output in my servlet. 

i've tried it with JDOM and without. using File and
URL as the StreamSource param, but nothing shows up.
there's no output.

 both "movies.xml" and "movies.xsl" are in my servlet
context root.

somebody pls help!!    
thanx...


here's my code:
      res.setContentType("text/html");
    PrintWriter out = res.getWriter();

    out.println("<html><head><title>Movie
List</title></head><body>");
    out.println("<center><h1>Movie
List</h1></center><br/>");


       Source inXsl = new StreamSource(new
URL("file","",getServletContext()+"movies.xsl").openStream());
       Source inXml = new StreamSource(new
URL("file","",getServletContext()+"movies.xml").openStream());

       TransformerFactory transFact =
TransformerFactory.newInstance();
       Transformer trans =
transFact.newTransformer(inXsl);

     trans.transform(inXml, new StreamResult(out));

        out.println("<body></html>");

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com