How to escape single quotes in XSLT
...well, as much as I have figured out, there is no clean built-in solution for escaping single quotes (') in XSLT. You need this if you e.g. want to generate JavaScript function calls within the generated XML file. So I have found a workaround resp. a not really nice hack to solve this problem as you can see in the following:
In this way you can generate the JavaScript function call "javaScript_Function_With_String_Parameter('currentValue')".
<xsl:variable name="apos">'</xsl:variable>
<xsl:value-of select="concat('javaScript_Function_With_String_Parameter (',$apos,.,$apos,')')"/>
In this way you can generate the JavaScript function call "javaScript_Function_With_String_Parameter('currentValue')".
yeah this is coolll
ReplyDeleteHelped me a lot.
ReplyDeleteThanx!
Thanks man, this is realy rare solution! And most importent IT WORKS! :)
ReplyDeleteGreat solution, thanks
ReplyDelete