• 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

how can I embed javascript in an XSL

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
Whenever I embed javascript inside an XSL via cdata the '<' and '&' signs get changed to < and & spoiling the javascript. Is there a way to stop this?
thanks
Jim
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You couldn't just use escape characters?
eg:- & for &
and < for < (I think)

Originally posted by ROOD:
Hello
Whenever I embed javascript inside an XSL via cdata the '<' and '&' signs get changed to < and & spoiling the javascript. Is there a way to stop this?
thanks
Jim


 
Brendan Kennedy
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh man, it converted my escape characters!
Go look it up!

Originally posted by Brendan Kennedy:
You couldn't just use escape characters?
eg:- & for &
and < for < (I think)


 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"ROOD",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually people put JavaScripts inside CDATA sections, then you do not need to escape & and <.
<script>
<xsl:comment>
<![CDATA[
*** your script here ***
]]>
</xsl:comment>
</script>
Or, if you do not have lots of &s and <s, you can insert them as
&lt; and &amp;
Brendan, here is the trick: replace leadind & with &amp; i.e. to show &lt; type &amp;lt;
reply
    Bookmark Topic Watch Topic
  • New Topic