You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Rui Alberto L. Gonçalves" <ru...@ptinovacao.pt> on 2004/07/30 14:09:28 UTC

changing request attributes in map:part

Hi all,

I have this pipeline that dumps a XML file according the parameters
in the request.
<!--
REQUEST PARAMETERS
$folder 
$report_id 
$report_type (system | myReport)
-->
<map:match pattern="dump-report-definition">
 <map:select type="request">
   <map:parameter name="parameter-name" value="report_type"/>
    <map:when test="myReport">
      <map:generate src="" ...
    </map:when>
    <map:otherwise>
      <map:generate src="" ...
    </map:otherwise>
  </map:select>
  <map:serialize type="xml"/>
</map:match>


Then, I have another pipeline that calls the previous:
<!--
REQUEST PARAMETERS
$folder
$report_id
$op_folder
$op_report_id
-->
<map:match pattern="change_report_definition">
 <map:aggregate element="page">
  <map:part src="cocoon:/dump-report-definition">
  ...
 </map:aggregate>
</map:match>

The problem is, I need to call "cocoon:/dump-report-definition"
with the request parameters switched. Like:

cocoon:/dump-report-definition?folder=op_folder&report_id=op_report_id
and not maintain the folder and report_id with the values as they appear
in the original request.

I tryed: 
<map:part

src="cocoon:/dump-report-definition?folder={op_folder}&amp;report_id={op_report_id}">
but without success!

Any idea? Thanks for any help. 

Rui





-- 
Rui Alberto L. Gonçalves <ru...@ptinovacao.pt>
PT Inovação


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


Re: changing request attributes in map:part

Posted by Olivier Billard <ol...@laposte.net>.
Hi Rui,

You have to factorize your first pipeline into a <map:resource> (using sitemap parameters) and use it in stand-alone mode or with your
2nd pipeline :

For your resource, you can use the SimpleSelector instead of the request selector :

<map:resource name="dump-report-definition">
   <map:select type="simple">
     <map:parameter name="reportType" value="{reportType}"/>
      <map:when test="myReport">
        <map:generate src="" ...
      </map:when>
      <map:otherwise>
        <map:generate src="" ...
      </map:otherwise>
    </map:select>
    <map:serialize type="xml"/>
  </map:resource>

And then use can use this by mapping request parameters to the right parameters...

HTH
--
Olivier Billard

Rui Alberto L. Gonçalves wrote:
 > Hi all,
 >
 > I have this pipeline that dumps a XML file according the parameters
 > in the request.
 > <!--
 > REQUEST PARAMETERS
 > $folder
 > $report_id
 > $report_type (system | myReport)
 > -->
 > <map:match pattern="dump-report-definition">
 >  <map:select type="request">
 >    <map:parameter name="parameter-name" value="report_type"/>
 >     <map:when test="myReport">
 >       <map:generate src="" ...
 >     </map:when>
 >     <map:otherwise>
 >       <map:generate src="" ...
 >     </map:otherwise>
 >   </map:select>
 >   <map:serialize type="xml"/>
 > </map:match>
 >
 >
 > Then, I have another pipeline that calls the previous:
 > <!--
 > REQUEST PARAMETERS
 > $folder
 > $report_id
 > $op_folder
 > $op_report_id
 > -->
 > <map:match pattern="change_report_definition">
 >  <map:aggregate element="page">
 >   <map:part src="cocoon:/dump-report-definition">
 >   ...
 >  </map:aggregate>
 > </map:match>
 >
 > The problem is, I need to call "cocoon:/dump-report-definition"
 > with the request parameters switched. Like:
 >
 > cocoon:/dump-report-definition?folder=op_folder&report_id=op_report_id
 > and not maintain the folder and report_id with the values as they appear
 > in the original request.
 >
 > I tryed:
 > <map:part
 >
 > src="cocoon:/dump-report-definition?folder={op_folder}&amp;report_id={op_report_id}">
 > but without success!
 >
 > Any idea? Thanks for any help.
 >
 > Rui


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