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

Converting XML document to HTML from within JSP

Subject: Converting XML document to HTML from within JSP
From: "Andrew Gallo" <andrew.gallo@xxxxxxxxxx>
Date: Fri, 11 Jan 2002 15:36:26 +1100
converting xml to jsp
Hi All,

Has anybody been successfull in Converting an XML document to HTML from
within JSP.
The following code does not produce any results, and there are no
compilation errors. I am using resin (jsp 1.1) as my App server and jdk 1.3.
The Source XML File and XSL File are correct as I have succeeded in the
conversion to HTML via its java class equivalent.

Your help would be greatly appreciated.

<%@page import="javax.xml.transform.stream.*,javax.xml.transform.dom.*,
javax.xml.transform.*,java.io.*" %>


//First create a Source object from  the xml file

StreamSource xmlSource=new StreamSource(new File("D:/stocks.xml"));

//Create a Result object.Associate this Result with a File , URL, or any
OutputStream or a Writer object.The
//constructor has five forms,one default and four taking different
arguments.Check documentation for more details.

StreamResult  htmlResult=new StreamResult(out);

//Create a Source object for the XSL style sheet

StreamSource xslSource=new StreamSource(new File("D:/stocks.xsl"));

//Create a TransformerFactory object

TransformerFactory tf=TransformerFactory.newInstance();

//Create a Transformer Object.Pass the XSL Source object in the constructor.

Transformer transformer=tf.newTransformer(xslSource);

//Complete the transformation


//In this case, since we have associated the Result object with the implicit
out object,
//when the transform() method returns, the output will be written to the

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jennifer
Sent: Friday, 11 January 2002 10:14
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  xsl:variable

Is it possible to set a variable and use it to grab data from another xml

Here's what I attempted with much failure-

 <xsl:template match="/">
<xsl:variable name="expert1id"


<script language="JavaScript">

var expert1layer="<xsl:apply-templates
select="document(/sco/loadexperts/$expert1id/text" />";




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 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.