Hi,

Here is an example using Xalan. chars is a char[] containing the xml data.
styleSheet is the name of your xsl stylesheet. This works with the last
version of Xalan.


        private void xslTransform(char[] chars, Writer out, String styleSheet) {

                try {
                        TransformerFactory tFactory = TransformerFactory.newInstance();
                        Transformer transformer
                                        = tFactory.newTransformer(new StreamSource(new 
File(getServletConfig()
                                        .getServletContext()
                                        .getRealPath("/" + styleSheet ))));
                        transformer.transform(new StreamSource(new 
CharArrayReader(chars)), new
StreamResult(out));
                }
                catch(TransformerException te) {
                        System.out.println(te);
                }
        }

Pierre-Yves


-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
Binek Rafal
Envoy� : jeudi 23 ao�t 2001 14:46
� : [EMAIL PROTECTED]
Objet : Is it possible ?


Hello
Is it possible to do this?
- I generate xml as output from servlet
- I need translate this output to html on server side
- I don't want to write file with xml output

Can I dynamicaly generate xml and the translate it using xsl file
(located on filesystem) ?





--
Best regards,
 rbinek                          mailto:[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to