struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric Houbie - ABSIS-GROUP <fhou...@absis-group.be>
Subject JSP used to convert xml to html applying XSL
Date Mon, 12 Nov 2001 14:48:37 GMT
Hi,

I would like to display HTML information from XML Data build on DB Access
using XSL. I found how to use Xalan to define 2 Source (XML & XSL), call
transform et put it in response:

response.setContentType("text/html; charset=UTF-8");
// Output goes in the response stream.
PrintWriter out = response.getWriter();
try
{
  TransformerFactory tFactory = TransformerFactory.newInstance();
  // Get the XML input document and the stylesheet.
  Source xmlSource = new StreamSource(new
URL("http://gateway:8080/Online/xml/CartedebaseJLL.xml").openStream());
  Source xslSource = new StreamSource(new
URL("http://gateway:8080/Online/xml/CartedebaseJLL.xsl").openStream());
  // Generate the transformer.
  Transformer transformer = tFactory.newTransformer(xslSource);
  // Perform the transformation, sending the output to the response.
  transformer.transform(xmlSource, new StreamResult(out));
}
catch (Exception e)
{
  out.write(e.getMessage());
  e.printStackTrace(out);
}
out.close();

return new ActionForward(null);

Now, my problem is to build the XML dynamically. I would like to create JSP
pages that will build XML from collection object put in session by Struts
Action bean. But, I don't know how to call the jsp so that xml will be
created, how to get it as a stream and to put it in Xalan transformation.

Who can help me ?

Frederic



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message