Your javascript part is not valid xml because of the ampersand (&
). To avoid interpretation
you can use CDATA and disable-output-escaping to avoid escaping.
<xsl:template match="/">
<script id="template-upload" type="text/x-tmpl">
<xsl:text disable-output-escaping="yes" >
<![CDATA[
...
]]>
</xsl:text>
</script>