• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML, XSL, JavaScript, JSP

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How and where can we embed Clientside-JavaScript for validation purposes when working with XML-XSL-JSP combination?
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic