cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ian.d.stew...@jpmchase.com
Subject Re: Problems with the SessionTransformer and <getxml>
Date Thu, 19 Jan 2006 14:41:02 GMT
Tino,

I notice that you have two different <map:generate> elements (<map:generate
type="jx" src="resources/init.jx"/> and <map:generate
src="resources/navigationitems.xml"/>) under <map:match pattern="init">.
Is that permissable?


Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


                                                                                         
                                             
                      Tino Breddin                                                       
                                             
                      <s9600916@inf.tu-        To:       users@cocoon.apache.org      
                                                
                      dresden.de>              cc:                                    
                                                
                                               Subject:  Problems with the SessionTransformer
and <getxml>                             
                      01/19/2006 08:11                                                   
                                             
                      AM                                                                 
                                             
                      Please respond to                                                  
                                             
                      users                                                              
                                             
                                                                                         
                                             




Hi,

well, i accidently hit the send button :-) Here is the full mail.

I want to store some xml data in the user session and later read it. I
get the following error:

org.apache.cocoon.ProcessingException:
SessionManager.streamContextFragment: Context 'navigationcontext' not
found.


My approach is like this:

sitemap:

<map:pipeline>
            <map:match pattern="init">
                <map:generate type="jx" src="resources/init.jx"/>
                <map:generate src="resources/navigationitems.xml"/>-->
                <map:transform type="session"/>
                <map:transform src="styles/selectNavItems.xsl"/>
                <map:transform type="session"/>
                <map:redirect-to uri="inittwo"/>
             </map:match>
             <map:match pattern="inittwo">
                <map:generate type="jx" src="resources/init2.jx" />
                <map:transform type="session"/>   <--- the error is
thrown here
                <map:serialize type="xml"/>    <--- so i can check the
output at this point
            </map:match>
</map:pipeline>

init.jx:

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
            xmlns:session="http://apache.org/cocoon/session/1.0">

    <root>
        <navigationitems>
            <item>
                <name>name1</name>
                <link>link1</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name2</name>
                <link>link2</link>
                <roles>
                    <role>role2</role>
                </roles>
            </item>
            <item>
                <name>name3</name>
                <link>link3</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name4</name>
                <link>link4</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name5</name>
                <link>link5</link>
                <roles>
                    <role>role1</role>
                    <role>role2</role>
                    <role>role3</role>
                    <role>role4</role>
                    <role>role5</role>
                </roles>
            </item>
        </navigationitems>
        <user>
            <session:getxml context="authentication"
path="/authentication/roles"/>
        </user>
        <session:createcontext name="navigationcontext"/>
    </root>
</jx:template>

init2.jx:

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
            xmlns:session="http://apache.org/cocoon/session/1.0">
    <root>
        <session:getxml context="navigationcontext" path="/"/>
    </root>

</jx:template>

selectNavItems.xsl:

<?xml version="1.0" encoding="iso-8859-1"?>
<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="root">
        <session:setxml context="navigationcontext" path="/">
            <navigation>
                <xsl:apply-templates select="navigationitems/item"/>
            </navigation>
        </session:setxml>
    </xsl:template>

    <xsl:template match="item">

        <xsl:if test="roles/role/node() = /root/user/role/node()">
              <item>
                  <link><xsl:value-of select="link" /></link>
                  <name><xsl:value-of select="name" /></name>
              </item>
          </xsl:if>
    </xsl:template>
</xsl:stylesheet>

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




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


Mime
View raw message