XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
rahul guruSubject: Passing variables from JSP to XSLT ?
Author: rahul guru
Date: 15 Apr 2005 06:43 AM
hi,
I have to search in the text in a tag in xml that would make use of a user entered text in a jsp page.
My Question:
Is there any way I can pass a string (or anything) from a JSP page to an XSLT page ???

Postnext
(Deleted User) Subject: Passing variables from JSP to XSLT ?
Author: (Deleted User)
Date: 15 Apr 2005 07:42 AM
Hi Rahul,
passing the value for an external variable is an implementation-dependent operation; if, as I guess, you are using Xalan-J, have a look at the jspSample.jsp that ships with it (or read online from http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-xalan/java/samples/servlet/jspSample.jsp)

Hope this helps,
Alberto

Postnext
rahul guruSubject: Passing variables from JSP to XSLT (Using JSTL)?
Author: rahul guru
Date: 15 Apr 2005 08:30 AM
HI,
Thanks Alberto for your quick response.

Actually, I am using JSTL for this project for converting RSS feeds to voicexml format. So, I am not using any kind of parsers directly.
The XSL file is doing its job. Now, I want to use a string variable, only that would be looked for in the Title tags of RSS (using XPath). This is working if I am using hard coded text. But, I want to pass it through JSP.
Here's some simple code for JSP:
____________

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>

<!-- <%
//String strRssUrl = request.getParameter("rssurl");
String strRssUrl = "http://rss.cnn.com/rss/cnn_topstories.rss";
%>
-->

<?xml version="1.0"?>
<vxml version="2.0" application="rss_db4.jsp">

<c:set var="xml">

<!DOCTYPE project [
<!ENTITY included SYSTEM "http://rss.cnn.com/rss/cnn_tech.rss">
]>

<root>
&included;
</root>
</c:set>
<form id="rss_db">
<block>
<c:set var="xsl">
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="/xml/WorkingParsing/parse.xsl" />

</xsl:stylesheet>
</c:set>

<x:transform doc="${xml}" docSystemId="foo.xml" xslt="${xsl}"/>

</block>
</form>
</vxml>
______________
Please, also bear with me as I am using XML, XSLT, VoiceXML for the first time.


Thanks,
Rahul.

Posttop
(Deleted User) Subject: Passing variables from JSP to XSLT (Using JSTL)?
Author: (Deleted User)
Date: 15 Apr 2005 09:19 AM
Hi Rahul,
as you are using JSTL, the most suitable place to look for is the JSTL documentation.
You can find here (http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/x/tld-summary.html) the documentation for the XML-related tags.

Given what they say, your JSP should be

<x:transform doc="${xml}" docSystemId="foo.xml" xslt="${xsl}">
<x:param name="param1" value="${jspVar}"/>
</x:transform>

Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.