I'm trying to pass a string from XSL to Javascript. I was able to pass integers but it doesn't seem to accept strings. The following is the basic structure of my code. If I delete "Test" from "Test 1" I do get the alertbox with the number 1. But once there's text inside, the alertbox does not come up.
XML:
<TEST>
<TITLE>Test 1</TITLE>
<TEST>
<TEST>
<TITLE>Test 2</TITLE>
<TEST>
XSL:
<xsl:for-each select="//TEST">
<xsl:call-template name="TEST_TEMPLATE"/>
</xsl:for-each>
...
<xsl:template name="TEST_TEMPLATE">
<script type="text/javascript">
<![CDATA[var title = ]]><xsl:value-of select="./TITLE" /><![CDATA[;
alert(title);]]>
</script>
Your help is much appreciated.
Thanks!