Why will u need to create a temp html file if all that u want is to show it in browser?
Just write it to the outputstream of response...Unless offcourse u need it for some 
other purpose as well.

-----Original Message-----
From: Jimmy Emmanual [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 10:58 AM
To: 'Struts Users Mailing List'
Subject: RE: [OT] generate HTML file from XML and XSLT


Try something similar to this:

import javax.xml.transform.*;

StringBuffer outHTML = new StringBuffer();
StringWriter ouput = new StringWriter();

java.net.URL xslUrl = this.getClass().getResource("test.xsl");
java.net.URL xmlUrl = this.getClass().getResource("test.xml");

String xslFile = xslUrl.toString();
String xmlFile = xmlUrl.toString();

try {
    TransformerFactory tfactory = TransformerFactory.newInstance();

    //get the XML Input file
    Source xmlSource = new StreamSource(xslFile);

    //get the stylesheet
    Source xslSource = new StreamSource(xslFile);

    //generate the transformer
    Transformer transformer = tFactory.newTransformer(xslSource);

    //Perform the transformation
    transformer.transform(xmlSource, new StreamResult(output));
} catch ( TransformerException te) {
    //
}

outHTML.append( output.toString() );

===============================================================

now you have a StringBuffer of the xsl transformation.


-----Original Message-----
From: Paul McCulloch [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 9:42 AM
To: 'Struts Users Mailing List'
Subject: RE: [OT] generate HTML file from XML and XSLT


Hava a look at the sample servlets etc. that come with the Apache Xalan-J
package.

Paul

-----Original Message-----
From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]
Sent: 13 November 2003 19:14
To: [EMAIL PROTECTED]
Subject: [OT] generate HTML file from XML and XSLT


Hi,
I have a XML file and a XSLT file, i need to create a
HTML file in a temp directory then read this file to
get a String so can email this String or print the
String as HTML
is it possible to do it?? and how 
I am using jdk1.4.1 
Ashish


=====
A$HI$H

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not copy or deliver this message to
anyone. In such case, you should destroy this message, and notify us
immediately. If you or your employer does not consent to Internet email
messages of this kind, please advise us immediately. Opinions, conclusions
and other information expressed in this message are not given or endorsed by
my Company or employer unless otherwise indicated by an authorised
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being
transmitted via electronic mail attachments we cannot guarantee that
attachments do not contain computer virus code.  You are therefore strongly
advised to undertake anti virus checks prior to accessing the attachment to
this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for
loss or damage howsoever caused.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to