xsl-list
[Top] [All Lists]

Reading Cookies During XSL Transformation (problems)...

2004-10-22 10:41:47
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>



<Prev in Thread] Current Thread [Next in Thread>