Passing map:generate parameters to a XQuery

View: New views
2 Messages — Rating Filter:   Alert me  

Passing map:generate parameters to a XQuery

by thomas.0007 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I have a question about how to pass parammeters to a XQuery when called from
a Cocoon pipeline.

Let see an example how this is done with XSP pages:
<map:match pattern="*/*/*/*/report.html">
   <map:generate type="serverpages" src="docs/getPostcodeData.xsp">
      <parameter name="postcode" value="{1}{2} {3}{4}"/>
   </map:generate>
   <map:transform src="stylesheets/html/report.xsl"/>
   <map:serialize/>
</map:match>

In the XSP page there will
be:<xsp:expr>parameters.getParameter("postcode")</xsp:expr>
 If I use XQuery to generate the data:   <map:generate type="xquery"
src="docs/getData.xq">
        <parameter name="param1" value="{1}"/>        <parameter
name="param2" value="{2}"/>        <parameter name="param3" value="{3}"/>
<parameter name="param4" value="{4}"/>
   </map:generate>
then how do I access the parammeters from getData.xq?Regards,Thomas




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Passing map:generate parameters to a XQuery

by Sebastian Rahtz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas White wrote:

> Dear all,
>
> I have a question about how to pass parammeters to a XQuery when called from
> a Cocoon pipeline.
>
> Let see an example how this is done with XSP pages:
> <map:match pattern="*/*/*/*/report.html">
>    <map:generate type="serverpages" src="docs/getPostcodeData.xsp">
>       <parameter name="postcode" value="{1}{2} {3}{4}"/>
>    </map:generate>
>    <map:transform src="stylesheets/html/report.xsl"/>
>    <map:serialize/>
> </map:match>
>
> In the XSP page there will
> be:<xsp:expr>parameters.getParameter("postcode")</xsp:expr>
>  If I use XQuery to generate the data:   <map:generate type="xquery"
> src="docs/getData.xq">
>         <parameter name="param1" value="{1}"/>        <parameter
> name="param2" value="{2}"/>        <parameter name="param3" value="{3}"/>
> <parameter name="param4" value="{4}"/>
>    </map:generate>
> then how do I access the parammeters from getData.xq?Regards,Thomas
>  
eg

declare namespace request="http://exist-db.org/xquery/request";

let $p:=request:get-parameter("postcode",())

--
Sebastian Rahtz      
Information Manager, Oxford University Computing Services
13 Banbury Road, Oxford OX2 6NN. Phone +44 1865 283431


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open
LightInTheBox - Buy quality products at wholesale price