You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Elvira Nieto Carretero <en...@sadiel.es> on 2004/05/11 11:04:21 UTC
to save session:getxml result in a variable
Hello again all!!
I create a session with
<session:setxml context="lastSearch" path="/search">
<session:getxml context="request" path="/querystring" />
</session:setxml>
Once i created it i want to save in a param or variable so i can use anywhere.
If i put in my code directly
<session:getxml context="lastSearch" path="/search" />
, the value of my session print in my page but if i do
<xsl:variable name="mySearch">
<session:getxml context="lastSearch" path="/search" />
</xsl:variable>
...
<xsl:value-of select="$mySearch"/>
It isn't print nothing, it's blank my variable $mySearch.
Why?
thank you very much
Best regards from Seville (Spain)
Re: to save session:getxml result in a variable
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Elvira,
please start such questions on the users list as it is not related to
development of Cocoon itself. Thanks.
Find the answer below.
On 11.05.2004 11:04, Elvira Nieto Carretero wrote:
> Hello again all!!
>
> I create a session with
>
> <session:setxml context="lastSearch" path="/search">
> <session:getxml context="request" path="/querystring" />
> </session:setxml>
>
> Once i created it i want to save in a param or variable so i can use anywhere.
>
> If i put in my code directly
>
> <session:getxml context="lastSearch" path="/search" />
>
> , the value of my session print in my page but if i do
In which way exactly? A string or elements or ...?
> <xsl:variable name="mySearch">
> <session:getxml context="lastSearch" path="/search" />
> </xsl:variable>
You create a result tree fragment here:
http://www.w3.org/TR/xslt#section-Result-Tree-Fragments. It is a mixture
of an XML structure and a string: though the xml nodes are in it, only
string functions can be executed on it.
> <xsl:value-of select="$mySearch"/>
Here you retrieve the string value of this result tree fragment which is
the concatenation of all text nodes in it. If the above session:getxml
results in a element-only XML structure you will see no output, you have
to use copy-of instead then.
Joerg