Hi,
        as far as I know, the xsl sourcefile has to be in the same directory as
your java classes, then you just referenece it like this:

        String xslInURI = "todo.xsl";

and that should work ok.

Seems strange that you are not getting any errors though.

-----Original Message-----
From: Lyne Moreau [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 7:59 PM
To: [EMAIL PROTECTED]
Subject: Servlet example



I'm trying to implement the code to execute a transformation inside a
servlet.  So far I was able to get everything done without any error
message, but the transformation is never done.  My HTML file is empty.  Here
is some code :

if(requestValue.equalsIgnoreCase(REQUEST_QUERY))
        {
             String xslInURI = "File:/Program Files/Apache
Group/Apache/htdocs/todo.xsl";
             String xmlInURI = "File:/Program Files/Apache
Group/Apache/htdocs/xsltc_todo.xml";
             String htmlOutURI = "C:/Program Files/Apache
Group/Apache/htdocs/todo-xsltc.html";

            try{
              TransformerFactory tFactory = TransformerFactory.newInstance();

                // Get the XML input document and the stylesheet.
                Source xmlSource = new StreamSource(xmlInURI);

                Source xslSource = new StreamSource(xslInURI);

                // Generate the transformer.
                Transformer transformer = tFactory.newTransformer(xslSource);

                // Perform the transformation, sending the output to the response.
                Result streamresult = new StreamResult(new 
FileOutputStream(htmlOutURI));
                transformer.transform(xmlSource,streamresult);
            }
            catch(TransformerException e2)
            {
                log(e2.toString());
                e2.printStackTrace();
            }

            ObjectOutputStream outputToApplet;
             outputToApplet =
             new ObjectOutputStream(response.getOutputStream());
             outputToApplet.writeObject("todo-xsltc.html");
             outputToApplet.flush();
             outputToApplet.close();

Would you have any idea what is happening ?  Your help would be appreciated.

Lyne Moreau

Together through stuff & fluff!


Reply via email to