I am using an embedded stylesheet into xml document Referring the link. My intension is getting the filename from xml tag through XSLT and validating it with the help of Javascript. I am trying to pass an xsl variable value to a javascript function. My alert is not working. I am sure the browser runs my Javascript.
But I am getting the syntax error 
My XML code
<?xml version="1.0" standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="#id(xyz)"?>
<file>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="xyz">
<xsl:template match="/">
<xsl:variable name="fName" select="filename" />
<xsl:text><xsl:value-of select="$fName"/></xsl:text>
<html>
<head>
<script type="text/javascript">
var fileName = "<xsl:value-of select="$fName"/>";
alert(fileName);
</script>
</head>
<body>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<filename>10052015</filename>
</file>