I am trying to call javascript function that is exist in KS.js file and I have referred that file in XSLT file but it gives me javascript error, please check image below.
Could anyone suggest me where I am doing wrong?
MAIN.xsl
<?xmlversion="1.0"encoding="utf-8"?>
<xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w3="http://www.w3.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:includehref="XSL-JS.xsl"/>
<xsl:templatematch="/">
<htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:w3="http://www.w3.org"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<xsl:call-templatename="headers"></xsl:call-template>
</head>
<body>
<inputtype="button"value="Click"onclick="LoadSource()"style="vertical-align:middle;width:25px;height:25px;" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSL-JS.xsl, xsl file where I have declared js file
<?xmlversion="1.0"encoding="utf-8"?>
<xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w3="http://www.w3.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:templatename="headers">
<scriptsrc="KS.js"type="text/javascript"> </script>
</xsl:template>
</xsl:stylesheet>
KS.js javascript file where function is defined
function LoadSource()
{
alert('Success');
}
Output with javascript error
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:w3="http://www.w3.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<script src="KS.js" type="text/javascript" xmlns=""> </script>
</head>
<body>
<input type="button" value="Click" onclick="LoadSource()" style="vertical-align:middle;width:25px;height:25px;" />
</body>
</html>
Javascript Error Image