Subject: RE: [xsl] Reading Cookies During XSL Transformation (problems)... From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx> Date: Fri, 22 Oct 2004 16:50:12 -0500 |
Hi Michael, This is not an XSL question, but reading through your comments it seems to me that you'll need to "wait" until the page's object tree is completely built. Your script generated by the XSLT, runs directly. In other words, it means that if you want to access the document object you should wait (for example) until the onLoad event to be able to access the document object with the cookies collection. The way to implement this is to run the Javascript code when the BODY's onLoad event fires. If this doesn't help, try posting on a more specific Javascript (or VBScript) list. Cheers, <prs/> -----Original Message----- From: Michael [mailto:msell@xxxxxxxxxxxxxxx] Sent: Friday, October 22, 2004 12:42 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; jfuller@xxxxxxxxxxxxxx Subject: [xsl] Reading Cookies During XSL Transformation (problems)... When trying to read cookies with both JavaScript or VBScript I end up with errors. I have a suspicion that this is because the "document" object does not get defined until after the transformation of the XSL document. I need to know if there is a way to obtain cookie data without accessing the document object. Additionally, it seems that when using JavaScript, returning string data of any kind through a function returns a data type error. The MSXSL parser displays the following: "Function 'getCookie' did not return a value, or it returned a value that cannot be converted to an XSL data type." Any help solving these problems would be a miracle. Below is the relevant coding snippets in both JavaScript and VBScript... JavaScript: <msxsl:script language="javascript" implements-prefix="js"> function getCookie(cookieName) { result = document.cookie; } </msxsl:script> <script language="javascript"> function setCookie(cookieName, cookieValue) { document.cookie = cookieName + "=" + cookieValue; } </script> <form name="search_by_keyword"> <input type="text" name="keyword" onChange="setCookie('Keyword', search_by_keyword.keyword.value)" /> </form> VBScript: <msxsl:script language="vbscript" implements-prefix="vbs"> <![CDATA[ function topic() topic = document.cookie end function ]]> </msxsl:script> <script language="vbscript"> sub topic_onchange tomorrow = dateadd("d", 1, date()) expiry_date = weekdayname(weekday(tomorrow)) + " , " + cstr(tomorrow) + " " + cstr(time()) + " CST" document.cookie = "topic = " + search_by_topic.topic.value + "; expires = " + expiry_date end sub </script> <div class="test"><xsl:value-of select="vbs:topic()" /></div>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Reading Cookies During XS, Michael | Thread | [xsl] xpath problem, Jan Limpens |
[xsl] Re: Reading Cookies During XS, Michael | Date | Re: [xsl] XSLT 2.0 *and* XSLT 1.0 v, Dimtre Novatchev |
Month |