cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent CAPRANI" <m237...@er.uqam.ca>
Subject RE: Request parameter to a transformer
Date Tue, 15 Jan 2002 21:58:17 GMT
I came up with three different solutions.

1. Using a "request" matcher
I haven't found a matcher which simply creates sitemap variables for all
request parameters. Could that be a useful thing to add to the default
wildcard matcher ?

The "request" matcher(1) selects a pipe-line for a specific parameter and
makes a sitemap variable of it. It is not exactly what I wanted, but I
didn't specify.

2. Using a "request" action
Enclosing the transform within a "request" action(2) works:

   <map:match pattern="application/**.xml">
     <map:generate src="application/{1}.xml"/>
<map:act type="request">
<map:parameter name="parameters" value="true"/>
     <map:transform type="my-transform">
 	<map:parameter name="my-parameter" value="{my-parameter}"/>
     </map:transform>
</map:act>
     <map:transform src="application/xmltohtml.xsl"/>
     <map:serialize/>
    </map:match>

3. Get parameters silently from within the transformer
Request parameters are available through the "objectModel" Map. It is then
possible to use any request parameter without specifying it in the sitemap.
It does not look like the right thing to do. What do you think?

-- Laurent CAPRANI
   Montreal

(1) <map:matcher name="request"
src="org.apache.cocoon.matching.RequestParamMatcher"/>
(2) <map:action name="request"
src="org.apache.cocoon.acting.RequestParamAction"/>

> De : Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> > From: Laurent CAPRANI [mailto:m237636@er.uqam.ca]
> >
> > I need to provide a request parameter to a transformation.
> > Ex: http://.../application/page.xml?my-parameter=value
> >
> > I tried to send a parameter to this transformer this way:
> >
> >    <map:match pattern="application/**.xml">
> >     <map:generate src="application/{1}.xml"/>
> >     <map:transform type="my-transform">
> > 	<map:parameter name="my-parameter" value="{my-parameter}"/>
> >     </map:transform>
> >     <map:transform src="application/xmltohtml.xsl"/>
> >     <map:serialize/>
> >    </map:match>
> > This does not work. The request parameter "my-parameter" is not
> present as a
> > sitemap variable.
>
> Of course. There is no component in your snippet to create this
> parameter.
>
>
> > What is the correct way to do this ?
> > Using another matcher? inserting an action?
>
> Matcher or action. Check (IIRC) RequestParameterMatcher class (it may be
> absent in the Cocoon release, use CVS to get it).
>
> Vadim


---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message