msxsl:script : JS runtime exception

webmasterbeta

New Member
I want to store a javascript variable in an xslt variable. I have a javascript function winName() (using msxsl:script) which has a variable called "winName".
This variable has a harcoded value called popup which I store in an xslt variable called temp. This works fine. But instead of hardcoding the winName in javascript,
I was trying to do: var winName = parent.window.name;
When I do this, I get the exception:
Error : Microsoft JScript runtime error 'document' is undefined line = 5, col = 6
(line is offset from the start of the script block). Error returned from property or method call

Can someone tell me what is wrong with my script?

Here is my code:

Thanks


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace">
<msxsl:script language='JavaScript' implements-prefix='user'>
function winName()
{
var winName = "popup";
return winName;
}
</msxsl:script>
<xsl:template match="/">
<html>
<head>
<title>untitled</title>

</head>
<body>
<xsl:variable name="temp" select="user:winName()"/>
<b>Window Name = <xsl:value-of select="$temp"/></b>

<br/>
</body>

</html>
</xsl:template>
</xsl:stylesheet>
 
Back
Top