cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heiko Milke" <heiko.mi...@cosmoblonde.de>
Subject Accessing session variables in the sitemap.xmap
Date Thu, 30 Jan 2003 13:56:33 GMT
Hello,

I want my application to work like the following.


<map:match pattern="xsp/example.xsp">
    <map:generate src="xsp/example.xsp" type="serverpages"/>
    <map:transform src="{selected_stylesheet}"/>
    <map:serialize/>
</map:match>



1. the serverpages generator accesses a script named "xsp/example.xsp"
Withing this script a session variable named "selected_stylesheet" is set.

<xsp-session:set-attribute name="selected_stylesheet">xsp/example.xsl</.....

2. In the next step i want to transform the generated data using the stylesheet whose path
is stored in the session variable.

3. finally i want to serialize and close the pipe.


This one is not working. Cocoon complains about a resource that cannot be found. Actually
it can't find  the stylesheet. Its all about coming to the page for the first time. Im creating
the session in the serverpages - generator. But somehow the sitemap doesnt get it.

-------------------------------

Thats why i did this one right here :

<map:match pattern="xsp/session-test">
    <map:generate src="xsp/example.xsp" type="serverpages"/>
    <map:act type="session-validator">
        <map:parameter name="descriptor" value="descriptors/params.xml"/>
        <map:parameter name="validate" value="selected_stylesheet"/>
        <map:transform src="{selected_stylesheet}"/>
    </map:act>
    <map:serialize/>
</map:match>


the descriptor file looks like this:

<parameters-descriptor>
  <parameter name="selected_stylesheet" type="string" nullable="yes" default="xsp/example.xsl"/>
</parameters-descriptor>


I expected cocoon to find out that, when coming to the page for the first time, even if there
is no "selected_stylesheet", that it can get the default parameter  from the descriptor and
get lucky.


This one aint working too.

What am I supposed to do to make it work ?
Maybe it would be a good idea to create the session earlier, maybe before i enter the pipe
but i dont know how to do that.


Thanks in advance

Heiko.






Mime
View raw message