I need that an  XML could be transformed while the XSL is phisically on the web server.
I have already created the xml file as a string but how can i use that string to be 
transformed?
The TransformFactory doesnt work with string, as the following code works for 
tranformation!
I have xml either as a string or document, but I dont know the transformation to use!
Regards
        Roberto


import java.io.*;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
public class Prova extends HttpServlet {
    public void doPost(
            HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
    HttpSession session = request.getSession(true);
       = formHandler.getDocumentArray();

        try {

                         org.w3c.dom.Document doc = (org.w3c.dom.Document) 
xmlres.getContentAsDOM();
                             File stylesheet = new 
File("C:\\jakarta-tomcat-4.1.18\\webapps\\RAI_project\\XslRepository\\TGmediaprof.xsl");


             TransformerFactory tFactory =
                TransformerFactory.newInstance();
            StreamSource stylesource = new StreamSource(stylesheet);
            Transformer transformer = tFactory.newTransformer(stylesource);
            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(out);
            transformer.transform(source, result);
        } catch(Exception e) {
            out.println("XindiceDB exception occured: " + e.getMessage());
        }

    }

}

___________________________________________________________________________
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