473,511 Members | 16,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

From an XSL file, what is the best way to process a cookie?

By clicking a link on a website I set a USERINFO cookie and then I
redirect to a program which ultimately executes an XSL file which
dynamically builds an input form. The input form, while having some non

dynamic hidden INPUT tags, has one hidden INPUT tag that is dynamic. In

the XSL file I attempt to bring this dynamic hidden INPUT tag in via
the following statements:

<xsl:template match="/">
<xsl:value-of select="document('http://localhost/getcookie.jsp')"/>

</xsl:template>

Unfortunately, the XSLT processor produces the following errors:

obhtmlpage.cpp:146: Error: Exception rethrown in
ObHTMLPage::GenerateHTML.
obdgxtxsl.cpp:213: Error: ObDgxtTransform
obdgxtxsl.cpp:153: Error: ObCallDgxtTransform
obdgxtxsl.cpp:32: Error: 0: syntax error at line 1, col 49: syntax
error
obdgxtxsl.cpp:32: Error: 0: xpl_document: error parsing
http://localhost/getcookie.jsp
Below is the getcookie.jsp. I thought I was being straight forward with

this. But I'm confused as to what the processor is talking about; the
XSL above or the JSP below? What does it mean line 1 column 49? Any and

all help is appreciated, thanks.

P.S. - I know I removed " + cookievalue + " below in lieu of the non
dynamic which you see, but even that failed. :-( I also tried
xsl:copy-to and import with this fixed code, but to no avail. Again,
any and all help is appreciated.
<%@ page import="javax.servlet.http.Cookie"
%><%
Cookie info = null;
Cookie[] cookies = request.getCookies();
for (int i=0; i < cookies.length; i++) {
info = cookies[i];
String cookiename = info.getName();
String cookievalue = info.getValue();
if (cookiename.equals("USERINFO")) {
%>
<input type="hidden" name="varuserinfo" id="varuserinfo"
value="cookievalue"></input>
<% }
}
%>

I'm not really fluent in XML/XSL/XSLT but need to come up with a way
of removing
a set of radio buttons on an XSL produced form. I thought, good, I'll
set a cookie and somehow use that value in the value clause of a hidden
HTML INPUT tag. Hence the so
called "dynamically" generated HTML tag which I tought would be
considered well formed because I gave it an ending INPUT tag.

I also thought initially that maybe I could just have a javascript
extract the cookie value via an ONLOAD statement in a BODY tag, but
then I couldn't figure out the XSL like syntax I would need to make use

of this javascript variable. So more poking around on the internet led
me to the XSL:value-of statement below and copy-of and import
statements with the document parameter and I thought, okay, this looks
promising. But no such luck.

Nelson

May 30 '06 #1
2 2593
This is what I had tried the Javascript way which also doesn't seem to
work.
The XSL file has:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oblix="http://www.oblix.com/">

....

<script language="JavaScript" xml:space="preserve"
src="../../common/bin/functions.js"></script>

....

<xsl:variable name="cookie"
select="cookie:getUserInfo()"></xsl:variable>

(The transformer barfs on the above, but loves everything else about
the XSl file if I comment out the above).

....

<xsl:if test="@cookie = 'uservalue'">
<input type="hidden" name="userinfo" id="userinfo" value="uservalue"/>
</xsl:if>

....

and the javascript which returns the cookie looks like this:

function getUserInfo() {
var arrayofcookies = document.cookie.split(";");

var i = 0;
var userinfo = "USERINFO";
var nocookie = 1; // Set for later
//document.write(arrayofcookies.length);
while (i<arrayofcookies.length)
{

//Split the current cookie into name=pairs.
//Index 0 should be the name, and Index 1
//should be the value.

var cookiename = arrayofcookies[i].split("=")[0];
var cookievalue = arrayofcookies[i].split("=")[1];

if (cookiename == userinfo)
{
nocookie = 0;
return(cookievalue);
// userrole.setAttribute("select",""+cookievalue+"");
}
i = i + 1;

}

Any and all help is appreciated.

Nelson

May 31 '06 #2
slacker wrote:
<xsl:variable name="cookie"
select="cookie:getUserInfo()"></xsl:variable>


Did you define the cookie: namespace for that extension function
invocation? Correctly?
May 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3485
by: Dan Stromberg | last post by:
If I wanted to write a python script that performs basic auth, gets a cookie, and then does an http POST using the cookie for authentication, what would be the best python API to write to? Does...
20
3522
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
1
7949
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
2
1425
by: Christopher | last post by:
Hi all, Sorry if this is a silly question but I've been having a heck of a hard time with it and hope somebody here can lend me a hand. I have a site with a news pages and I'd like the...
10
3128
by: EnjoyNews | last post by:
I have a php site I have an include line called "include 'Cookie.php';" In this Cookie.php file I have these codes. <?php $conn = mysql_connect("$db", "$user", "$pass");...
3
2682
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
8
1657
by: slacker | last post by:
By clicking a link on a website I set a USERINFO cookie and then I redirect to a program which ultimately executes an XSL file which dynamically builds an input form. The input form, while having...
6
2383
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am thinking about doing this since I got several cases that some of our internal users open more than one browser at the same time from our server. When one of the transactions was not...
0
1232
by: deneb | last post by:
Hello all? When I restart the page or just logout the page, cookie file is deleted automatically. What's wrong with me?? here is my code. ' If I success in Login process, Save user ID in...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.