Is it possible to handle a parameter to a javascript function in XSLT where the script is between tags <script type=text/javascript>....</script>.
If possible could someone give a example. Thanks.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
I think you're getting confused between the two things: XSLT is something that is used (in this case) to generate HTML/javascript - once that generated HTML/javascript is received by the browser then the javascript can be run. I'm unaware of any such concept of the XSLT "passing" a variable to a javascript function.
My guess is you want something like this XSLT...
If you put the main "body" of the javascript within the xsl:text element, it means you won't get caught out using reserved characters (such as < > etc).
The generated HTML/javascript that is set to the browser would end up as something like this, meaning calling myFunc would display "hello world"...
Update
As MichaelKey has highlighted, the <xsl:text> element above is unnecessary. This should produce the same thing...