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

Re: Reading Cookies During XSL Transformation (proble

Subject: Re: Reading Cookies During XSL Transformation (problems)...
From: Michael <msell@xxxxxxxxxxxxxxx>
Date: Sat, 23 Oct 2004 07:17:18 +1000
document is undefined
The document.cookie property returns a string of all cookie values. If two cookie existed, let's say cookie's 'A' and 'B', then the cookie string would read something like 'A=Result; B=AnotherResult' I haven't bothered to cut the returned string up yet, because I can't read the cookie data at all during the XSL transformation.

The official MSXSL error reads as follows:

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.

Note that 'document' is undefined. Doh!

However, your idea of manually returning the result was brilliant though Jim. There have been a few issues in the XSLT list pertaining to type casting problems with JavaScript and XSLT. You just shot that problem down in flames with a quick suggestion. (grin). Well done.

jfuller@xxxxxxxxxxxxxx wrote:

ok....I am not a javascript expert dont u need to return something ? for example......


function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }

note the return c.substring and return null;

currently your examples dont return anything ...also is there instant type conversion...why not just stick a return result; in the below ?

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.