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

unable to pass parameters from jsp

Subject: unable to pass parameters from jsp
From: Aseef Jamaluddin <j_aseef@xxxxxxxxx>
Date: Mon, 1 Apr 2002 02:59:33 -0800 (PST)
jsp pass parameter
I am still doing my beginers in xml. I am trying to
pass a parameter from a jsp page which can be accessed
from my style sheet. Please find below the jsp code,
xml and xsl files i am using. I am not getting the
parameter value as expected. What could be wrong, in
anycase is it possible to pass a parameter as i have
explained. If so please advise on the proper way of
doing it.

<%@ page
import="javax.xml.transform.TransformerFactory,
javax.xml.transform.Transformer,
javax.xml.transform.stream.StreamSource,
javax.xml.transform.stream.StreamResult,
javax.xml.transform.TransformerException,
javax.xml.transform.TransformerConfigurationException,
javax.servlet.jsp.JspWriter,
javax.servlet.jsp.PageContext,

// Imported java classes
java.io.FileOutputStream,
java.io.FileNotFoundException,
java.io.IOException,
java.io.OutputStream,
java.io.InputStream,
java.io.ByteArrayOutputStream,
java.io.ByteArrayInputStream,
org.xml.sax.InputSource" 
%>

<%
String url="c:/tomcat/webapps/examples/jsp/xslt/";
StreamResult sr=new
StreamResult(response.getWriter());
TransformerFactory tFactory =
TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new
StreamSource(url + "atemp1.xsl"));
transformer.setParameter("firstParam","firstParamValue");
transformer.transform(new StreamSource(url +
"atemp1.xml"), sr);
%>
<br/>
hello world

------------------------------------------

<?xml version="1.0" ?>
<custdet>custdettag</custdet>

------------------------------------------
<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="/">
<xsl:param name="firstParam"/>
<xsl:value-of select="firstParam"/>

<xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>

--------------------------------------------
The output i am getting is 

<?xml version="1.0" encoding="UTF-8"?>
custdettag
<br/>
hello world

Thanks in advance
Aseef.J

__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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-2011 All Rights Reserved.