You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Franosch, Heike" <fr...@bms.de> on 2002/04/12 18:12:30 UTC

accessing session context from stylesheet

Hi all,

I want to insert the session id to my URLs from within the stlyesheet and
don't know
how to access the context. I have seen a hint about the
SessionValidationAction, but I just 
can't get it run.
Has someone a nice tip or maybe some sample code how to achieve this?

Thanks, Heike

p.s. Sorry for repeating this question, but I didn't find a sufficient
answer for this problem in the
archives.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: accessing session context from stylesheet

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "Andrew Savory" <an...@luminas.co.uk>

> On Fri, 12 Apr 2002, Franosch, Heike wrote:
>
> > I want to insert the session id to my URLs from within the stlyesheet
and
> > don't know
> > how to access the context. I have seen a hint about the
> > SessionValidationAction, but I just
> > can't get it run.
> > Has someone a nice tip or maybe some sample code how to achieve this?
>
> Quite possibly the wrong way of doing things, but I use an XSP to grab the
> relevant session details then aggregate them so they are available to use
> in the stylesheet.
>
> I'd be interested in hearing if there's a better way of doing it...

This is the easiest approach, and not wrong per se.

But when this kind of problem arises, I usually ask myself:

1. "Why do I need it in the stylesheet?"
2. "Is my stylesheet for -style- or am I programming with it?"
3. "Can't I resolve this problem once and for all during Generation?"
4. "Isn't this better solved with a Transformer, since it requires coding?"

There is not one and only answer, as in Cocoon you can do the same thing in
different ways.

But a simple hint is to try to do all in Generation, add the absolute
necessary with Transformers and use stylesheets only to change format-style,
not to code.
It will make your system more manageable and reusable, since it removes the
dependencies between Components.

If you need a specific thing to happen in Generation for the Transformation
to work, you are making code reuse much harder.

--
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: accessing session context from stylesheet

Posted by Andrew Savory <an...@luminas.co.uk>.
On Fri, 12 Apr 2002, Franosch, Heike wrote:

> I want to insert the session id to my URLs from within the stlyesheet and
> don't know
> how to access the context. I have seen a hint about the
> SessionValidationAction, but I just
> can't get it run.
> Has someone a nice tip or maybe some sample code how to achieve this?

Quite possibly the wrong way of doing things, but I use an XSP to grab the
relevant session details then aggregate them so they are available to use
in the stylesheet.

I'd be interested in hearing if there's a better way of doing it...


Andrew.

-- 
All views are my own .... who else would want them?




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>