Using XSLT to escaping characters for javascript
This is an open discussion with 4 replies, filed under XSLT.
Search
Both blocks of code output look the same
I've edited the comment to show what Stu is trying to achieve.
When you use backslashes in code-blocks on the forum you need to write out two of them otherwise they are stripped out. Basically, you have to escape them with backslashes.
I would use a string-replace template. Replace '
with \'
and ,
with \,
Anyone tried escaping characters for java-script using disable-output-escaping attribute in value-of tag.
Create an account or sign in to comment.
I'm trying to plot a set of pointers on a Google map using inline Javascript.
The pointers use names and addresses in the popup windows and these strings inevitably contain single quotes and commas - both of which stop the javascript working.
Can anyone suggest how I can escape the characters?
My XML:
The existing JS output:
The required JS output: