I need a div to have the following Javascript associated with it:
onclick="resize('Value1', 'Value2', 'Value3', 'Value4')"
In my XSL, var1, var2, var3, var4 hold stringsValue1, Value2, Value3, Value4 for current node. So, using xsl:attribute name='onclick', I would like to associate the JS with the div. The problem I am facing is because of escaping single quotes in XSL to render it in output page (that is what I think).
Any idea how to go about it?
EDIT:
My XSL code to get the javascript onclick function call string is:
<xsl:value-of select="concat('resize(', ''', $var1, ''', ',', ''', $var2, ''', ',', ''', $var3, ''', ',', ''', $var4, ''', ')'"/>
And IE6 [Yes its IE6, my machine has XP with IE6 🙁 ] shows the error:
Expression expected. concat('resize(', ''', $var1, ''', ',', ''', $var2, ''', ',', ''', $var3...
Funny enough there seems to be no real good escape sequence for single quotes inside attribute values. You should be able to go with:
At least IntelliJ likes this. It is a bit long-winded but should be safe to use even with older XSLT processors like IE6. I have no IE6 here to check it, though. Btw. IE6 is somewhat outdated technology, so you should really get rid of it.