You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Wendell Piez <wa...@mulberrytech.com> on 2009/02/27 23:42:55 UTC

Request parameters to specify an input file

Hi,

I'd like to use the value of a request parameter to specify a file to 
aggregate with my input.

For example, when the URI is

http:localhost:8888/cocoon/dir/whee.xml?sequence=zoom.xml

I'd like to have the functional equivalent of

<map:aggregate element="goforit">
   <map:part src="{1}/{request-param:sequence}"/>
   <map:part src="{1}/{2}"/>
</map:aggregate>

Except this gives me an error when the parameter is missing, where I 
need fallback behavior (for example, just adding nothing would do).

Thanks for any help you can offer.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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


Re: Request parameters to specify an input file

Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Feb 28, 2009, at 3:09 PM, Luca Morandini wrote:

> Wendell Piez wrote:
>> <map:aggregate element="goforit">
>>  <map:part src="{1}/{request-param:sequence}"/>
>>  <map:part src="{1}/{2}"/>
>> </map:aggregate>
>> Except this gives me an error when the parameter is missing, where  
>> I need fallback behavior (for example, just adding nothing would do).
>
> A selector base on request parameter values should do.
>
> Something like this (off the top of my head, so it may contain  
> errors)...
>
> <map:select type="request-parameter">
>  <map:parameter name="parameter-name" value="sequence"/>
>  <map:when test="">
>    <map:aggregate element="goforit">
>      <map:part src="{1}/default-sequence.xml"/>
>      <map:part src="{1}/{2}"/>
>    </map:aggregate>
>  </map:when>
>  <map:otherwise>
>    <map:aggregate element="goforit">
>      <map:part src="{1}/{request-param:sequence}"/>
>      <map:part src="{1}/{2}"/>
>    </map:aggregate>
>  </map:otherwise>
> </map:select>

Or, depending on what he wants to achieve, resource-exists action/ 
selector might be even better ;-)


Vadim

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


Re: Request parameters to specify an input file

Posted by Luca Morandini <lm...@ieee.org>.
Wendell Piez wrote:
> 
> <map:aggregate element="goforit">
>   <map:part src="{1}/{request-param:sequence}"/>
>   <map:part src="{1}/{2}"/>
> </map:aggregate>
> 
> Except this gives me an error when the parameter is missing, where I 
> need fallback behavior (for example, just adding nothing would do).

A selector base on request parameter values should do.

Something like this (off the top of my head, so it may contain errors)...

<map:select type="request-parameter">
   <map:parameter name="parameter-name" value="sequence"/>
   <map:when test="">
     <map:aggregate element="goforit">
       <map:part src="{1}/default-sequence.xml"/>
       <map:part src="{1}/{2}"/>
     </map:aggregate>
   </map:when>
   <map:otherwise>
     <map:aggregate element="goforit">
       <map:part src="{1}/{request-param:sequence}"/>
       <map:part src="{1}/{2}"/>
     </map:aggregate>
   </map:otherwise>
</map:select>

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


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