cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: Recursive resources...
Date Sat, 13 Mar 2004 20:22:54 GMT
On 13.02.2004 20:33, Gabriel Egolf wrote:

> Hi all,
> I have what I hope is a simple question.  Is it possible to create a 
> resource that calls itself?  Here's an example of what I'm thinking.
> <map:resource name="foo">
>  <map:act type="resource-exists">
>    <map:parameter name="src" value="{../path}/foo.xml"/>
>    <map:generate src="{../path}/foo.xml"/>
>    <map:serialize type="xml"/>
>  </map:act>
>  <map:call resource="foo">
>    <map:parameter name="path" value="{path}/../"/>
>  </map:call>
> </map:resource>
> ..
> <map:match pattern="**/foo.xml">
>  <map:call resource="navigation">
>    <map:parameter name="path" value="{1}"/>
>  </map:call>
> </map:match>
> What I'm hoping to accomplish is to look for a file "foo.xml" in a given 
> directory passed as the parameter "path".  If the file exists, generate 
> it.  If the file doesn't exist, look in the parent directory for it.

I see no reason why it should not work in general. In the above code 
there is only one mistake: the parameter of the action must be 
{path}/foo.xml instead of {../path}/foo.xml. That's because the 
parameter belongs to the action and is not inside it. The context change 
that makes the ../ necessary is only inside the action.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message