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>