cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: using temporary session-context to share value
Date Mon, 30 Oct 2006 14:21:48 GMT
Kaj Kandler wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Joeren,
> thanks for helping me here. I tried a lot of things, off course. But
> after hours of experimenting and trying to find some decent logging that
> would reveal my problem, I resorted to looking for help.
> 
> According to
> http://cocoon.apache.org/2.1/developing/webapps/contexts.html, there is
> always a temporary context available to do what I want to do (preserve a
> value until the end of the request. "Using the tempory context it is
> possible to store any XML information for processing the current request."
> 
> The attempt to use a path="/key" does no difference.
> 
> <session:createcontext name="temp"></session:createcontext>
> <session:setxml context="temp" path="/key"><xsl:value-of
> select="concat('cu',$rnd)"/></session:setxml>
> 
> Makes no difference either.
...
> Unfortunately I seem not to be able to get the session context in the
> sitemap to log anything meaningful.

When you say "get the session context in the sitemap", what exactly are 
you trying to do?  Trying to access a session attribute in the sitemap 
via the {session-attr:blah} input module or something?  If so, then this 
will not work with the session transformer.  The reason is that the 
sitemap is completely evaluated to set up the pipeline *before* any 
content starts to be fed through the pipeline.  So it's impossible to 
make any choices in the sitemap based on content going through the pipeline.

If you mean something else, could you give details?


> 
> Once again, thanks for helping me out here.
> K<o>
> 
> Jeroen Reijn wrote:
>> Hi Kaj,
>>
>> i do not have a lot of experience with the session-context and session
>> transformer, but i will try as much as I can to help you out.
>>
>>> I have a stylesheet that creates a key
>>> - ---
>>> <xsl:stylesheet
>>>   version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>>                   xmlns:session="http://apache.org/cocoon/session/1.0">
>>>
>>>    <xsl:template match="key">
>>>     <!-- create some random number as base for a confirmation URL -->
>>>     <xsl:variable name="rnd" select="translate(math:random(),'.','x')"
>>>         xmlns:math="xalan://java.lang.Math"/>
>>>       <xsl:copy>
>>>         <xsl:value-of select="concat('cu',$rnd)"/>
>>>       </xsl:copy>
>>>       <session:setxml context="temporary" path="my_key"><xsl:value-of
>>> select="concat('cu',$rnd)"/></session:setxml>
>>>   </xsl:template>
>>> ...
>>
>> Looking at the documentation about the session-context the following
>> issues come to mind:
>>
>> In the example they create their own context first by doing:
>> <session:createcontext name="trackdemo"/>
>>
>> Where trackdemo is the context used somewhere else in the xml body like:
>> <session:mergexml context="trackdemo" path="/context">
>>
>> So my first question: did you set your context? If so did you try to add
>> a / in front of your path?
>>
>> What happens if you do it like this?
>>
>> Regards,
>>
>> Jeroen Reijn
>> Hippo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message