You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Hunsberger, Peter" <Pe...@stjude.org> on 2002/09/23 20:33:52 UTC

Passing unknown parameters through a site-map

I've got a situation where I've got to pass a bunch of parameters with
unknown names from a (Cocoon generated) HTML form through an action to a
standard Cocoon pipeline.  There are certain parameters I don't want to pass
on to the stylesheet so I can't use 

               <map:parameter name="use-request-parameters" value="true"/>

However, I can, in my action selectively not copy the unwanted parameters
into the map (since they have well defined names).  The issue is, how do I
then pass these onto the transform from the from the sitemap? Normally, I'd
do something like:

                  <map:parameter name="gunk_data_id"
value="{gunk_data_id}"/>

to pass on individual parameters.  In this case, since I don't know all the
parameter names I can't do that.  I basically want to say, pass all the
parameters in the map returned from the action onto the transform (the
equivalent of use-action-parameters perhaps?)

Peter Hunsberger

Phone: 901-495-5252
E-mail: Peter.Hunsberger@stjude.org


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Passing unknown parameters through a site-map

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Hunsberger, Peter wrote:
> I've got a situation where I've got to pass a bunch of parameters with
> unknown names from a (Cocoon generated) HTML form through an action to a
> standard Cocoon pipeline.  There are certain parameters I don't want to pass
> on to the stylesheet so I can't use 
> 
>                <map:parameter name="use-request-parameters" value="true"/>

Is there some reason which forces you not to copy the
parameters wholesale? Otherwise, use use-request-parameters
and simply ignore the parameters you don't want. You can
also try to override the wholesale parameter import by
passing an empty string for the unwanted parameters
     <map:parameter name="unwanted" value=""/>

> However, I can, in my action selectively not copy the unwanted parameters
> into the map (since they have well defined names).  The issue is, how do I
> then pass these onto the transform from the from the sitemap? Normally, I'd
> do something like:
> 
>                   <map:parameter name="gunk_data_id"
> value="{gunk_data_id}"/>
> 
> to pass on individual parameters.  In this case, since I don't know all the
> parameter names I can't do that.  I basically want to say, pass all the
> parameters in the map returned from the action onto the transform (the
> equivalent of use-action-parameters perhaps?)

You can use an internal pipeline with an request-generator
and an XSLT to filter out unwanted parameters, and aggregate
it to you main source:
  <map:pipeline match="int/req-filtered">
    <map:generator type="request"/>
    <map:transform src="filter.xsl"/>
    <map:serialize type="xsl"/>
  </map:pipeline>
  <map:pipeline match="whatever.xyz">
    <map:action type="my-for-action">
      <map:aggregate (add proper attr here)>
        <map:part src="cocoon://int/req-filtered"/>
        <map:part src="main-src"/>
      </map:aggregate>
      ...
(beware: untested code)

A filter XSLT can be basically the generic copy-through
template and empty templates for the parameters you don't
want:
   <xsl:template match="cr:requestParam[@name='unwanted']"/>
(beware: element and attr names just guessed).

HTH
J.Pietschmann



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>