Very similar code is working for me at the minute (see below), but I'm certain I saw a more elegant way to do it from chriztian - just can't find it now. If <xls:value-of is appearing in your source code it seems that it's still stuck inside a CDATA section
<script type="text/javascript"> //<![CDATA[ var postCode = "]]><xsl:value-of select="Postcode" /><![CDATA["; var street = "]]><xsl:value-of select="Address1" /><![CDATA[";
function doSomething(something) { return something; } //]]> </script>
Inserting string into jquery in XSLT
I thought I was doiing so well to get this far !!!
I have the following XSLT that creates a string like this:
[{latitude:53.049779,longitude:-2.171795,html:Community Drive,popup:true},{latitude:53.069779,longitude:-2.191795,html:Greenbrook Court,popup:true}]
I tried inserting the string into the jquery function with this code:
but its currently giving me an error. Any ideas ??
ian,
I suspect its becuase you have the value-of tag in outer cdata tag. What is the error exactly?
Regards
Ismail
Just this:
Well, your $markers variable is not defined in the scope that you are trying to use it in.
What are you trying to do here? You seem to be assigning the variable multiple times with the for-each, but only using it once?
Hi Ian
Very similar code is working for me at the minute (see below), but I'm certain I saw a more elegant way to do it from chriztian - just can't find it now. If <xls:value-of is appearing in your source code it seems that it's still stuck inside a CDATA section
Dan
I have a number of properties with Latitude and Longitute values. I'm trying to get their values and build a string like the example below:
[{latitude:53.049779,longitude:-2.171795,html:Community Drive,popup:true},{latitude:53.069779,longitude:-2.191795,html:Greenbrook Court,popup:true}]
This string then needs to be inserted into the jquery after markers:
Ok. Variables in XSLT are immutable, so you cannot add something to a variable once it has been defined.
You probably want to do something like this:
Thanks everyone for helping, Morten's answer fixed the issue.
I've now got a working Google map with markers set using 2 fields in the property DocumentType.
is working on a reply...