aspose file tools
The moose likes XML and Related Technologies and the fly likes XML, XSL, JavaScript, JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "XML, XSL, JavaScript, JSP" Watch "XML, XSL, JavaScript, JSP" New topic
Author

XML, XSL, JavaScript, JSP

Vijay ChandraSekhar
Greenhorn

Joined: Jan 19, 2001
Posts: 1
How and where can we embed Clientside-JavaScript for validation purposes when working with XML-XSL-JSP combination?
Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
In your JSP page, include the javascript validation funcitons that you want. Then also in your JSP page, do all of the calls necessary to apply a stylesheet to your XML data and print the resulting transformation in your page. Now,in your XSL stylesheet, just include the javascript calls as part of your XSL. For example (remember that all text from your XSL document will be carried over to your result document):
<xml:template match="/"
<TABLE><TR> .. or whatever HTML you want
<INPUT TYPE="IMAGE" SRC="/images/gobtn2.gif" ALT="Go" BORDER="0" ONCLICK="validate()"/></TD>
</xml:template>
So the Style sheet contains the javascript that will be included in the page upon completion of the transformation. Thus when your page loads you have a complete page with javascript code and javascript function calls.
We are doing this a lot where I work and it all works well together.
HTH
Brian
Darryl Andrew
Greenhorn

Joined: Jun 21, 2001
Posts: 12
Hi, can u post the jsp code for using xml and xsl to do the transformation?
There are servlets codes to do the same thing in this forum, but i would like to know how to do it with jsp.
Anyway, i believe the code for servlet and jsp should not be the same. Am i right to say that?
thanx
 
 
subject: XML, XSL, JavaScript, JSP
 
Threads others viewed
set xsl html value
including .htc / .css files
JSP for transforming XML using XSL
hide xml data
JSP + XSL + XML
MyEclipse, The Clear Choice