[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Repart generation with XSL Stylesheet


Subject: Re: [xsl] Repart generation with XSL Stylesheet
From: "Denis McCarthy" <dmccarthy@xxxxxxxxxxxxxxxx>
Date: Tue, 2 Jul 2002 11:34:14 +0100

If I unerstand you properly I have tried something similar; I passed an xml
and a corresponding xsl file into a jsp, and got xalan to transform the xml.
Here is the valid code:

<%@ page language="java" contentType="text/html" %>
<%@ page import="javax.xml.transform.*,javax.xml.transform.stream.*"%>

Locale locale =
SessionManager.getUserProfile(request).getLocale().getLocale();
String xmlFile = "http://localhost/static/xml/" + locale.getLanguage() + "_"
+ locale.getCountry() + "/contact_details.xml";

String xslFile    = http://localhost/static/xsl/contactDetailsToHTML.xsl";
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new
StreamSource(xslFile));
transformer.transform(
        new StreamSource(xmlFile), new StreamResult(out));

As you can see the xmlFile is static; I think for your example you would be
better to dynamically generate the xml and pass it to the page as an
InputStream (the StreamSource class can take an InputStream or indeed a
Reader as a constructor as well as a File or URL)
Hope this helps



----- Original Message -----
From: "Ranjith Kodikara" <Ranjith@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, July 02, 2002 10:16 AM
Subject: [xsl] Repart generation with XSL Stylesheet


> We are developing a information selling system for a chamber of commerce
and
> we want to generate reports for user requests. First we let users to
select
> a query criteria. Then I hope to generate an xml document; which is a jsp
> file generated from the database, with xml content type. Then at the
moment
> my idea is to generate an html document by parsing that xml file via an
xsl
> stylesheet.
> Do you think this method is suitable? Then can I write an xsl stylesheet
> with jsp.
> If I generate html's with xml files using Xalan , when users are
generating
> reports doesnt the folder in the web server get filled with html files?
>
> Those are the questions I have. I am considering to do this with xml and
> Xalan parser. Pls advice me.
>
> -Ranjith
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords