Assigning value of xsl variable to javascript variable

webmasterbeta

New Member
Hi all,


This is my xml code

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href=http://www.webdeveloper.com/forum/archive/index.php/"Hotels.xsl"?>
<Services>
<SCRIPT_ID>
<XPath name="TBL_SCRIPTID20060318125009281">
</XPath>
</SCRIPT_ID>
</Services>


This is my xsl code

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="scriptid" select="/SCRIPT_ID/XPath/@name"/>

<xsl:template match="/">
<html>
<head>
<script language="javascript">
function showHint1(str)
{
alert("In Show Hint1");
alert("String == "+str);
}

</script>
<body onLoad="showHint1($scriptid);" bgcolor="red">

</body>

</html>
<xsl:apply-templates/>

</xsl:template>
</xsl:stylesheet>


Here i just wants pass the value of the variable scriptid to the javascript function.
Its giving error.Can anyone help me.

thnx,
raj
 
Back
Top