I am using xalan-j_2_0_1
And this is the code that I have in my servlet:
XSLTInputSource xmlSource = null;

xmlSource = new XSLTInputSource(new FileReader((String)
"webpages/prods.xml"));

XSLTInputSource xslSource = null;

xslSource = new XSLTInputSource(new FileReader((String)
"webpages/prods.xsl"));
res.setContentType("text/html");
XSLTResultTarget target = new XSLTResultTarget(res.getWriter());

try
{
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        processor.process(xmlSource, xslSource, target);
}
catch (SAXException exc)
{}

The system ID error you say is a DTD error, is this because I have not used
a DTD??
How do I read the file from the server and send it back???

>From: Nic Ferrier <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: XML from servlets (was Re: Question??)
>Date: Fri, 20 Apr 2001 19:27:08 +0100
>
> >>> Nik DAMPIER <[EMAIL PROTECTED]> 20-Apr-01 6:00:37 PM >>>
>
> >How to do I return an XML document back to the
> >client from a servlet?? I have had no luck using XSLT
> >in my servlet to transform an XSL and XML document
> >to a target which is my response.getWriter()
>
>The easiest way to return XML:
>
>   public void doGet(HttpServletRequest ....)
>   throws ...
>   {
>      response.setContentType("text/xml");
>      PrintWriter o=response.getWriter();
>      o.println("<?xml version="1.0"?>");
>      o.println("<myxml>");
>      o.println("<myname>Nic</myname>");
>      o.println("</myxml>");
>      o.close();
>    }
>
>Alternately, read the file from the server and send it back.
>
>Alternataely give your response write (in the example above "o") to
>the XSLT process... remember to set the content type firsrt.
>
>
> >I get a  systemID error what are they??
>
>Some sort of DTD exception?
>
>What XSLT are you using?
>
>
>Nic Ferrier
>
>___________________________________________________________________________
>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

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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