jandhb
asked on
XSL Session variable check syntax
I have an xsl file that is being used on a web page to display a table that contains menu links. The menu tems are like -
Help Subscribe Return
On certain logins which are stored in a session variable - Session["LoginCheck"] I don't want to show the "return" menu item.
Is there certain syntax to do this or go about this?
Help Subscribe Return
On certain logins which are stored in a session variable - Session["LoginCheck"] I don't want to show the "return" menu item.
Is there certain syntax to do this or go about this?
ASKER
Geert,
When you say "use that parameter in a test as $loginCheck" can you show me how that would be done? In this particular case I just need to check if the value of that is > 1.
How would I pass the value of the session variable to the stylesheet? Right now I'm calling the XSLT with - <asp:Xml Runat="server" ID="xmlMenu" TransformSource="../naviga tion/menu. xslt" />
When you say "use that parameter in a test as $loginCheck" can you show me how that would be done? In this particular case I just need to check if the value of that is > 1.
How would I pass the value of the session variable to the stylesheet? Right now I'm calling the XSLT with - <asp:Xml Runat="server" ID="xmlMenu" TransformSource="../naviga
<xsl:choose>
<xsl:when test="$loginCheck = 1">
output the column here
</xsl:when>
<xsl:otherwise>
don't output the column
</xsl:otherwise>
</xsl:choose>
you can leave the "otherwise" clause out if you don't need it
<xsl:when test="$loginCheck = 1">
output the column here
</xsl:when>
<xsl:otherwise>
don't output the column
</xsl:otherwise>
</xsl:choose>
you can leave the "otherwise" clause out if you don't need it
ASKER
ok, i follow that, but i thought you said i had to pass the session variable to the xslt page first?
yes, that is a bit trickier when you use an XML control
Here is an article that shows you how to do that
http://www.braintrove.com/article/13
cheers
Geert
Here is an article that shows you how to do that
http://www.braintrove.com/article/13
cheers
Geert
ASKER
I took a look at the article and have some quesions.
1. In the XSLT he is using xls:when should I use - <xsl:if test="$loginCheck > 1">
2. In my aspx this is not a query string. It is a session variable. So should I only do this without the request.querystring part?...
Args.AddParam("loginCheck ", "", loginCheck );
1. In the XSLT he is using xls:when should I use - <xsl:if test="$loginCheck > 1">
2. In my aspx this is not a query string. It is a session variable. So should I only do this without the request.querystring part?...
Args.AddParam("loginCheck ", "", loginCheck );
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have this in my page load now...
XsltArgumentList Args = new XsltArgumentList();
Args.AddParam("loginCheck" , "", loginCheck );
xmlMenu.TransformArgumentL ist = Args;
look right?
XsltArgumentList Args = new XsltArgumentList();
Args.AddParam("loginCheck"
xmlMenu.TransformArgumentL
look right?
looks right
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
<xsl:param name="loginCheck"/>
use that parameter in a test as $loginCheck
and pass the value of the ession variable to the stylesheet
I can show you how, if you show how you call the XSLT
Make sure you use a template processor instead of a simple transform
in order to be able to pass parameters
cheers
Geert