First of all, when you use <%@ page include...%>, it tells the JSP to include 
it at *compile* time, not run time.  At compile time, output.xml has not yet 
been created.  You would want to use <jsp:include .../> I believe (I don't 
remember the syntax off the top of my head, but you can find it on any JSP 
reference site).

However, I believe that StreamResult is capable of using a java.io.Writer as 
its output, so the better way to do it is to simply pass JSP's "out" object 
to the StreamResult:

transformer.transform(new StreamSource("10_3.xml"), new 
StreamResult(out));

On Thursday 08 November 2001 03:15 am, you wrote:
> Hi all,
>
> I've got a small problem. I'm testing a jsp-page which looks like this:
>
> <%@ page import="javax.xml.transform.TransformerFactory" %>
> <%@ page import="javax.xml.transform.Transformer" %>
> <%@ page import="javax.xml.transform.stream.StreamSource" %>
> <%@ page import="javax.xml.transform.stream.StreamResult" %>
> <%@ page import="javax.xml.transform.TransformerException" %>
> <%@ page import="javax.xml.transform.TransformerConfigurationException" %>
>
> <%@ page import="java.io.FileOutputStream" %>
>
> <%
>
> TransformerFactory tFactory = TransformerFactory.newInstance();
>
> Transformer transformer = tFactory.newTransformer(new
> StreamSource("10_4.xsl"));
>
> transformer.transform(new StreamSource("10_3.xml"), new
> StreamResult("C:\\Program Files\\Apache Tomcat
> 4.0\\webapps\\examples\\jsp\\output.jsp"));
>
> %>
>
> <%@ include file="output.jsp" %>
>
> But I don't wanna write the output of the transformation to a file. I want
> it to be displayed in a browser immediatly without including the file. Now
> when I replace the file name by System.out no errors occur but I nothing
> appears in the browser either. How can I solve this?
>
> Greetings,
> Raf
>
>
>
> ----------
> Get a free, personalised email address at http://another.com
> TXT ALRT! Stop wasting money now. Send FREE, personalised txt
> from http://another.com

-- 
Furthermore, I believe bacon prevents hair loss.

Peter Davis
Developer, Speaklink Inc.
[EMAIL PROTECTED]

Reply via email to