RE: [OT] generate HTML file from XML and XSLT
Hi thanx for the responses i was able to make it work with all the help from these mails Ashish --- [EMAIL PROTECTED] wrote: > 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] > __ 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]
RE: [OT] generate HTML file from XML and XSLT
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]
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]
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]
Re: [OT] generate HTML file from XML and XSLT
to get an Html output you can use JAXP's javax.xml.transform.* Package. to mail the same out put you have to generate a String containing all the html output and use the ByteArrayDataSource.java class which u get from java mail examples from sun. i did this in one of my project.let me know if u have any trouble regards srinivas Ashish Kulkarni <[EMAIL PROTECTED]> wrote: 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] - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard