Hi all,

I am trying to dynamically creating an XML document with the Java Servlet
and i am trying to style that XML information to the browser(IE5) using
the static xsl document in the same directory where the servlet is there
when i am trying to execute that servlet it is giving error like this
Access is denied.

 Error processing resource
'file://c:\servlets\test.xsl'.

i am developing an xml application with servlets for that it is necessary
to disply the xml document on the fly with static xsl.

i am attaching  my servlet and xsl file

can u please co-operate me or could u please give me any other way to
display this file

regds...jayadev

/*   java servlet    */

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

/*
 * test Servlet sends back a simple, static XML page.
 */
public class test extends HttpServlet
{
  public void doGet
  (
    HttpServletRequest  req,   // This provides information sent by the browser
    HttpServletResponse res    // This is used to send information back to the browser
  ) throws
    ServletException,          // General exception that should be thrown if there
                               // is a unrecoverable error in the Servlet
    IOException

  {
    // Set the MIME type for the information being sent to the browser.
    // In this case, we are going to send back HTML

       res.setContentType( "text/xml" );

    // Get a reference to the output stream.
    // Anything written to this stream is sent directly to the browser
    // (The browser sees this as its input).

       ServletOutputStream out = res.getOutputStream();

    // The following println statements create an HTML page.
    // Notice that the <html></html>, <head></head>, and <body></body>
    // tags are all properly formed HTML syntax.
       out.println("<?xml version=\"1.0\"?>" );
       out.println("<?xml:stylesheet type=\"text/xsl\" 
href=\"file:///c:/servlets/test.xsl\"?>");
       out.println("<persons>");
       
out.println("<person><firstname>Oren</firstname><lastname>Ben-KiKi</lastname></person>");
       out.println("</persons>");

  }

}

/****************xsl file *******************/

<?xml version="1.0"?>
<xsl:stylesheet
       xmlns:xsl="http://www.w3.org/TR/WD-xsl"
       xmlns="http://www.w3.org/TR/REC-html40"
       result-ns="">

         <xsl:template match="/">
         <HTML>
          <HEAD>
           <TITLE>Test</TITLE>
          </HEAD>
          <BODY>
             <xsl:apply-templates/>
          </BODY>
        </HTML>
        </xsl:template>
        <xsl:template match="*">
        <xsl:apply-templates/>
        </xsl:template>

<xsl:template match="persons">
<xsl:for-each select="person[1]">
   <h1><xsl:value-of select="firstname"/></h1>
   <h1><xsl:value-of select="lastname"/></h1>
</xsl:for-each>
        </xsl:template>
        <xsl:template match="textnode()">
        <xsl:value-of select="."/>
        </xsl:template>

</xsl:stylesheet>

___________________________________________________________________________
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