[EMAIL PROTECTED] wrote:
> When the XQuery generator is called for in a <map:part>, it is
> impossible to pass the request parameters:
>
> <map:aggregate element="root">
> <!-- get XML representation of request -->
> <map:part src="cocoon:/requestAsXML"/>
> <!-- get XQuery result -->
> <map:part src="cocoon:/{1}.xq"/>
> </map:aggregate>
>
> (with a separate match for the .xq part in the pipeline:)
>
> <map:match pattern="*.xq">
> <map:generate src="xquery/simpleSearch.xq" type="xquery">
> <map:parameter name="use-request-parameters" value="true"/>
> </map:generate>
> <map:serialize type="xml"/>
> </map:match>
I would store the request *parameters* you need in request *attributes*.
Pipeline, part 1:
<act type="set-request-attr">
<parameter name="foo" value="{request-param:foo}"/>
<parameter name="bar" value="{request-param:bar}"/>
<map:aggregate element="root">
<!-- get XML representation of request -->
<map:part src="cocoon:/requestAsXML"/>
<!-- get XQuery result -->
<map:part src="cocoon:/{../1}.xq"/>
</map:aggregate>
</act>
(Don't forget that {1} becomes {../1}.)
Part 2:
<map:match pattern="*.xq">
<map:generate src="xquery/simpleSearch.xq" type="xquery">
<map:parameter name="foo" value="{request-attr:foo}"/>
<map:parameter name="bar" value="{request-attr:bar}"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
This has the added benefit of avoiding use-request-parameters, which is
generally frowned upon for various reasons.
You will need this component:
<action name="set-request-attr"
src="org.apache.cocoon.acting.PropagatorAction">
<output-module name="request-attr"/>
<store-empty-parameters>false</store-empty-parameters>
</action>
(store-empty-parameters is a matter of preference.)
And this change in cocoon.xconf (adding an empty key-prefix option to
the request-attr *output* module):
<output-modules>
- <component-instance ... name="request-attr"/>
+ <component-instance ... name="request-attr">
+ <key-prefix/>
+ </component-instance>
...
</output-modules>
Take it all with a grain of salt, I am not a Cocoon expert :-)
Tobia
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]