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
posted
0
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
posted
0
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