[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Displaying HTML after transformation

Subject: Displaying HTML after transformation
From: melanie.j.broadhead@xxxxxxxxxxxxx
Date: Tue, 22 Jan 2002 18:22:30 -0600
html after
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();


     SimpleTransform trans = new SimpleTransform();
     trans.CreateOutputFile(op, output);


     public void CreateOutputFile(ServletOutputStream op, StreamResult
    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))
          // XML for this file is stored in file f
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer(new StreamSource
        transformer.transform(new StreamSource(f), output);

         catch (Exception e)


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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.