Inserting JavaScript into XSLT
March 12th, 2009
| Categories: JavaScript, MOSS, SharePoint, XSLT
When inserting JavaScript code into XSLT dataForm webpart it can sometimes get tricky. Sometimes SharePoint designer messes up our code or we have huge trouble with & signs,… the best way to insert the JavaScript code block into XSLT data view is to enclose it with xsl:text and cdata. Below is the sample:
<xsl:text disable-output-escaping=”yes”>
<![CDATA[
<script type=”text/javascript”>
(your JavaScript code here)
</script>
]]>
</xsl:text>



I tried this, but it failed for ie6. The warning message is "In Internet Explorer 6 the tag <xsl:text> is not permitted". Do you have a fix that will work for both ie6 and ie7?
hi, try this:
<![CDATA[
document.write("foo, bar");
]]>
This works great for me in IE6 and firefox but not in safari. Is there a way to get javascript working for safari in xslt?