"&&" in a jQuery JavaScript messes with XSLT processing
This is an open discussion with 7 replies, filed under General.
Search
It's not exactly a namespacing-problem but ampersands are used to delimit entities. You need to replace them by &
or put it in a CDATA block.
doh! why didn't I think of that... Thanks... Problem solved....
It seems that I was celebrating too early.
When I wrap everything in CDATA then the outcome is following:
var msie6 = $.browser == 'msie' && $.browser.version < 7;
When I write:
var msie6 = $.browser == 'msie' && $.browser.version < 7;
I get the exactly same result
I did some googling and it seems to be a common problem... One way to solve it would be to use xsl:text disable-output-escaping? This is a bit annoying since every time I need to use '&' or '<', I have to declare it... Has anybody got more elegant solution to this?
The best solution is: Don't embed the script code in your template, but use external JavaScript files.
:-)
you can try to use xsl:comment
inside your script
block and then do &
for each ampersand.
If someone have the same issue in the future, i managed to get the && with :
<xsl:text disable-output-escaping = "yes"><![CDATA[&&]]></xsl:text>
Create an account or sign in to comment.
I am trying to embed a jQury javascript in my template and it throws an error:
Line that causes problems is:
Apparently it doesn't like "&& ". Any ideas how to solve this namespace problem?
I am reluctant to put it in a separate .js file since this code is used only on one page.