[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Difficulty with an msxsl:script function.

Subject: Difficulty with an msxsl:script function.
From: Tomas Olsson <tomas.olsson@xxxxxxxxxxxxx>
Date: Tue, 19 Dec 2000 07:29:49 +0100
msxsl script example
Hi!

I'm having problem with an msxsl:script function of mine.
The function looks like this:

<msxsl:script language="JavaScript" implements-prefix="user">
	function getLanguage()
	{
		var
lang=document.mycombo.example.options[document.mycombo.example.selectedIndex
].value
		return lang;
	}	
</msxsl:script>

I have created a combo box which contains different languages. When my 
function is called it should return the language which is currently
selected.

The function is called by the following line:
<xsl:variable name="Language" select="user:getLanguage()"/>

However, when my function is called I get an error message:
--------------------------------------------------------------------------
Microsoft JScript runtime error 'document' is undefined line = 5, col = 3 
(line is offset from the tag). Error returned from property or method call. 
--------------------------------------------------------------------------

If I "hard code" the variable returned in the function to e.g.
"var lang = "Swedish", the function executes without any problem. 

So my question is: Where can i place my function in order for "document"
to be defined before the function is called? Is this even possible? Or maybe
there is another way of doing this?

Grateful for any answers!

/Tomas Olsson


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.