Hi all friends,

I have some problem with my sevrlet .I want to convert
my xml file into html on the fly for this iam using
lotusxsl-j_2_0_1 package.It complies perfectly but
when I am going to run this file through javawebserver

html file created but in that file no content is there
that means size of the file is 0kb.I already done it
on Dos-prompt It working perfectly.My server also
giving error("servlet failed with Exception<no stack
trace found>").Can any one tell me where I done a
mistake.Any help will be highly appreciated.Below r my
codes.

It is my xml file:-
------------------
<?xml version="1.0"?>
<root>
<doc>Hello</doc>
</root>

It is my xsl file:-
----------------------
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="//root"/>
</xsl:template>
<xsl:template match="root">
<html>
<body bgcolor="#ffffff" text="#000000">
 <b><u><xsl:value-of select="doc"/></u></b>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

It is my servlet:-
-------------------
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import
javax.xml.transform.TransformerConfigurationException;
import java.io.*;


public class Sample6 extends HttpServlet
{
        public void doGet (HttpServletRequest
request,HttpServletResponse response)
    throws IOException,ServletException
  {   response.setContentType("text/html");
      OutputStream out=response.getOutputStream();

     try
        {
        TransformerFactory tFactory =
TransformerFactory.newInstance();




        Transformer transformer = tFactory.newTransformer(new
StreamSource("foo.xsl"));



        transformer.transform(new StreamSource("foo.xml"),
new StreamResult(new FileOutputStream("foo.html")));


          }catch(Exception e){}

        out.close();
  }
}

Thanks in Advance
Bikash

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to