Re: [xsl] Find an xml node from a session variable?

Subject: Re: [xsl] Find an xml node from a session variable?
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Thu, 7 Jun 2007 17:08:25 +0100
----- Original Message ----- From: "Mike" <mikeickes@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, June 07, 2007 4:49 PM
Subject: [xsl] Find an xml node from a session variable?

Can anyone point me to a tutorial or sample on how to find a specific
node in an xml file based on a session variable.

What I want to do is display content to a user based on their user id
that is set or stored in a session variable.

For instance if a user logs in and a session variable gets set to
"joeuser" I want to search an xml document for the node that has
joeuser's data in it and display just the fields under his/her node.

The parser is msxml version 6 I believe but I would like to keep the
code as os/server agnostic as possible.

Also, can I do this with javascript? I would really like to use one of
the nice javascript libraries like yui or mootools or prototype etc...

Thanks for your help?

Kind Regards,


You can almost certainly do what you want. If, for example, you have a list of user elements within a users element with each user having an id attribute then you need the XPath created by:
/users/user[@id = '" + sessionVariable + "']"
to retrieve the relevant element.
If, when you say JavaScript, you mean can you do this client-side then that depends whether you have some means of transferring the session variable's contents to the client and where the XML with the user data is stored.


Current Thread