Subject: [xsl] Displaying HTML after transformation From: melanie.j.broadhead@xxxxxxxxxxxxx Date: Tue, 22 Jan 2002 18:22:30 -0600 |
I am having trouble displaying the output of my translator, does anyone have any experience that could lead me in the right direction? I have tested my stylesheet, and it is working as expected. I am gathering my XML input from a servlet call. I have written JSP to take the XML, write it to a file, that then gets used as input to the Xalan translator. But when I am writing the servlet to the file, it outputs the XML to the browser, instead of the translated HTML. I tried sending the Servlet response to a pre-compiled class file, where the servlet response is written to a file on the server-side, and returning the output of the translation to the browser. I'm finding in either case, only the XML is being dispayed on the browser. The HTML page is being created on the server, but is not displaying. Does anyone have an example of a similar implementation that would help me? Any help would be appreciated - Thanks! Melanie JSP Example: //some servlet call to create XML which returns the XML to the response stream ServletOutputStream op = response.getOutputStream(); StreamResult output = new StreamResult(); response.reset(); SimpleTransform trans = new SimpleTransform(); trans.CreateOutputFile(op, output); SimpleTransform: public void CreateOutputFile(ServletOutputStream op, StreamResult output) throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException { String OSName = System.getProperty("os.name"); String path=null; path = "ContractDetails.xml"; File f = new File(path); byte[] buf = new byte[512]; FileInputStream in = new FileInputStream(f); int length=0; //Read the data from the input stream while ((in != null) && ((length = in.read(buf)) != -1)) { op.write(buf,0,length); } try { // XML for this file is stored in file f TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource ("ContractDetails.xsl")); transformer.transform(new StreamSource(f), output); } catch (Exception e) { System.out.println(e.getMessage()); } } This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How to Create Side Heads , DPawson | Thread | [xsl] query string vaules, alex |
RE: [xsl] [Fwd: %20 in href attribu, Julian Reschke | Date | Re: [xsl] How to Create Side Heads , W. Eliot Kimber |
Month |