You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bruce Krautbauer <br...@medtronic.com> on 2002/05/23 22:44:44 UTC

Another session transformer question

I've found something else that doesn't work the way I think it should... ;)

I thought this XML:

<?xml version="1.0" ?>
<test xmlns:session="http://cocoon.apache.org/session/1.0">
	<session:createcontext name="sessionTest" />
	<session:setxml context="sessionTest" path="/">
		<root>
			<stem id="1">foo</stem>
			<stem id="2">bar</stem>
		</root>
	</session:setxml>
	<session:mergexml context="sessionTest" path="/root/stem[id='1']">fred</session:mergexml>
	<session:getxml context="sessionTest" path="/" />
</test>

would create this output:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:session="http://cocoon.apache.org/session/1.0">
	<root>
		<stem id="1">fred</stem>
		<stem id="2">bar</stem>
	</root>
</test>

but instead it creates:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:session="http://cocoon.apache.org/session/1.0">
	<root>
		<stem id="1">foo</stem>
		<stem id="2">bar</stem>
		<stem>fred</stem>
	</root>
</test>

The same happens if I use setxml in place of mergexml.

I really like the idea of the session transformer and I am probably expecting too much.  What are the current thoughts for the most Cocoon-ish way to handle the session problem?

Kindest regards,
Bruce



---------------------------------------------------------------------
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: Question: what is {session-id} ? in a sitemap.xmap ?

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 23.May.2002 -- 06:37 PM, John Austin wrote:
> On Thursday 23 May 2002 18:23, you wrote:
> 
> Thanks. It is pretty clear that {name} is a variable. My question 
> should have been: How do I discover the valid values for {name} ?
> The example I was looking at used {session-id} which is intuitively 
> linked to the session-id I would get from <session:get-attribute 
> name="session-id"/>. Is my inference correct? Does it therefore follow 
> that I can use any attribute from the session context ? If I set a 
> session attribute named 'fred' with the value 'flintstone' does {fred}
> evaluate to 'flintstone' in a sitemap ?
> 
> Is the definition of {name} documented anywhere ? Is there any way of 
> enumerating defined names ? 

Since these vars depend on the components that set them, they are
documented in the (java)docs for these components (e.g. matchers,
actions).

If you have a close look at your log files (sitemap.log), you will
discover all present vars with their names and values after every step
that as potential effect on them. E.g.

   Current Sitemap Parameters:
   PARAM: '1' VALUE: 'apps'
   PARAM: '0' VALUE: 'sample-apps'

You have two vars named "1" and "2" available at this stage of the
pipeline.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
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: Question: what is {session-id} ? in a sitemap.xmap ?

Posted by John Austin <jo...@integerservices.no-ip.com>.
On Thursday 23 May 2002 18:23, you wrote:

Thanks. It is pretty clear that {name} is a variable. My question 
should have been: How do I discover the valid values for {name} ?
The example I was looking at used {session-id} which is intuitively 
linked to the session-id I would get from <session:get-attribute 
name="session-id"/>. Is my inference correct? Does it therefore follow 
that I can use any attribute from the session context ? If I set a 
session attribute named 'fred' with the value 'flintstone' does {fred}
evaluate to 'flintstone' in a sitemap ?

Is the definition of {name} documented anywhere ? Is there any way of 
enumerating defined names ? 

>From what I know, basically {name} is a representation of
> a sitemap parameter which are used by sitemap components.
> For example, if your pipeline wants to call another (resource)
> pipeline you with a target parameter you would do it this way
> <map:call resource="simple-page">
>  <map:parameter name="target" value="some/path/to/something"/>
> </map:call>
>
> now in your "simple-page" pipline you can access that target
> paramter with {target} so you can have:
>   <map:resource name="simple-page">
>      <map:generate type="file" src="{target}.xml"/>
>      <map:transform src="stylesheets/page/simple-page2html.xsl">
>         <map:parameter name="view-source" value="{target}.xml"/>
>      </map:transform>
>      <map:serialize/>
>   </map:resource>
>
> Also, if you implement actions the return of the act() method
> is a map that will be added to the session paramters.
> In your action of you do
> sitemapParam.put("session-id", getSessionID()); then
> in your pipeline you can do
> <map:match pattern="something">
>   <map:act type="my-action">
>    <map:generate src="something/{session-id}"/>
>     ...
>  </map:act>
> </map:match>
>

---------------------------------------------------------------------
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: Question: what is {session-id} ? in a sitemap.xmap ?

Posted by Artur Bialecki <ar...@digitalfairway.com>.
>From what I know, basically {name} is a representation of
a sitemap parameter which are used by sitemap components.
For example, if your pipeline wants to call another (resource)
pipeline you with a target parameter you would do it this way
<map:call resource="simple-page">
 <map:parameter name="target" value="some/path/to/something"/>
</map:call>

now in your "simple-page" pipline you can access that target
paramter with {target} so you can have:
  <map:resource name="simple-page">
     <map:generate type="file" src="{target}.xml"/>
     <map:transform src="stylesheets/page/simple-page2html.xsl">
        <map:parameter name="view-source" value="{target}.xml"/>
     </map:transform>
     <map:serialize/>
  </map:resource>

Also, if you implement actions the return of the act() method
is a map that will be added to the session paramters.
In your action of you do
sitemapParam.put("session-id", getSessionID()); then
in your pipeline you can do
<map:match pattern="something">
  <map:act type="my-action">
   <map:generate src="something/{session-id}"/>
    ...
 </map:act>
</map:match>

Hope this helps.

Artur...

> -----Original Message-----
> From: John Austin [mailto:john@integerservices.no-ip.com]
> Sent: Thursday, May 23, 2002 5:44 PM
> To: cocoon-users@xml.apache.org
> Subject: Question: what is {session-id} ? in a sitemap.xmap ?
> 
> 
> I have been using Cocoon 2.0.1 for a few months now and have run into a 
> few brick walls. The most serious limitation is the lack of 
> documentation for just about everything. I have worked through a number 
> of problems in the past but am currently frustrated by a number of 
> questions.
> 
> I have often seen expressions in the sitemap like {session-id} and 
> {target}. it is clear that these are variables substituted from 
> somewhere magical but I cannot for the life of me imagine what.
> 
> Can anyone explain where I can find the documentation for these 
> constructs ? I suspect that I can use these items to transfer 
> information in to parameter lists but need to understand this aspect of 
> Cocoon before I can do it.
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> 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>
> 

---------------------------------------------------------------------
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>


Question: what is {session-id} ? in a sitemap.xmap ?

Posted by John Austin <jo...@integerservices.no-ip.com>.
I have been using Cocoon 2.0.1 for a few months now and have run into a 
few brick walls. The most serious limitation is the lack of 
documentation for just about everything. I have worked through a number 
of problems in the past but am currently frustrated by a number of 
questions.

I have often seen expressions in the sitemap like {session-id} and 
{target}. it is clear that these are variables substituted from 
somewhere magical but I cannot for the life of me imagine what.

Can anyone explain where I can find the documentation for these 
constructs ? I suspect that I can use these items to transfer 
information in to parameter lists but need to understand this aspect of 
Cocoon before I can do it.

Thanks.

---------------------------------------------------------------------
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>