p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: call javascript function passing parameters


Message #1 by "Aaron Sahlin" <aaronsahlin@y...> on Tue, 17 Sep 2002 16:28:00
> I am trying to call a javascript function from my xsl and 
> getting errors when trying to do so.  Here is what I am doing.
> 
> <!-- this is my call from xsl -->
> 
> <script type="text/javascript">
>   mapActions(number({../../@ID}), {text()});
> </script>
> 
> <!-- here is my java script function -->
> function mapActions(id, actionId)
> {
>   alert("in mapper")
> 
> }
> 

A <script> element does not define script that you can call during the
transformation, it's just an ordinary element that's written to the HTML
output page.

Also, you can only use the {expr} notation in an attribute, not in
element content. In element content, you need <xsl:value-of>.

You want <msxsl:script> or whatever your chosen XSLT processor chooses
to call it.

Michael Kay
Software AG
home: Michael.H.Kay@n...
work: Michael.Kay@s... 


  Return to Index