You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kjetil Kjernsmo <Kj...@computas.com> on 2008/03/27 13:45:58 UTC
Getting the request query parameters in the XML
All,
I need to access the query parameters from a GET request in my XSLT, and I
have thought of several ways to do this, but all seems cumbersome, so I'm
supposing I've lost something trivial.
What would have been neat is something ol' AxKit's QueryParam could be done:
http://search.cpan.org/~nachbaur/AxKit-XSP-QueryParam-0.02/lib/AxKit/XSP/QueryParam.pm#<param:enumerate/>
i.e., just say in the JX that I want all query parameters, and there they are.
If there is no way to do that, I could do something like it in a controller we
allready have. We allready do stuff like
bizData.put("result-list", queryResult);
res.sendPage("xml/sparql-result", bizData);
and it would be OK if I could just dump the query parameters here, but it
seems there is no other way than build the XML manually by looping over the
queryparameters, which again seems unnecessarily cumbersome.
What am I missing here?
Kind regards
Kjetil Kjernsmo
--
Senior Knowledge Engineer
Direct: +47 6783 1136 | Mobile: +47 986 48 234
Email: kjetil.kjernsmo@computas.com
Web: http://www.computas.com/
| SHARE YOUR KNOWLEDGE |
Computas AS Vollsveien 9, PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 |
Fax:+47 6783 1001
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Mar 27, 2008, at 11:31 AM, Kjetil Kjernsmo wrote:
> On Thursday 27 March 2008 15:40:39 Reinhard Poetz wrote:
>> You could use JXTemplate here:
>>
>> <jx:forEach var="p" select="${cocoon.request.getParameterNames()}">
>> <p>${p}=${cocoon.request.getParameter(p)}</p>
>> </jx:forEach>
>
> Ah, thanks, I think that's the nearest to what I was looking for,
> even though
> Luca's solution was shorter to write.
>
> I modified it to
> <jx:forEach var="p" select="${cocoon.request.getParameterNames()}">
> <param key="${p}">
> <jx:forEach var="v" select="${cocoon.request.getParameterValues(p)}">
> <value>${v}</value>
> </jx:forEach>
> </param>
> </jx:forEach>
> which seems to do what I want.
Yes it will work, as long as you don't want to cache any responses
from this pipeline.
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Kjetil Kjernsmo <Kj...@computas.com>.
On Thursday 27 March 2008 15:40:39 Reinhard Poetz wrote:
> You could use JXTemplate here:
>
> <jx:forEach var="p" select="${cocoon.request.getParameterNames()}">
> <p>${p}=${cocoon.request.getParameter(p)}</p>
> </jx:forEach>
Ah, thanks, I think that's the nearest to what I was looking for, even though
Luca's solution was shorter to write.
I modified it to
<jx:forEach var="p" select="${cocoon.request.getParameterNames()}">
<param key="${p}">
<jx:forEach var="v" select="${cocoon.request.getParameterValues(p)}">
<value>${v}</value>
</jx:forEach>
</param>
</jx:forEach>
which seems to do what I want.
Kind regards
Kjetil Kjernsmo
--
Senior Knowledge Engineer
Direct: +47 6783 1136 | Mobile: +47 986 48 234
Email: kjetil.kjernsmo@computas.com
Web: http://www.computas.com/
| SHARE YOUR KNOWLEDGE |
Computas AS Vollsveien 9, PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 |
Fax:+47 6783 1001
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Reinhard Poetz <re...@apache.org>.
Kjetil Kjernsmo wrote:
> All,
>
> I need to access the query parameters from a GET request in my XSLT, and I
> have thought of several ways to do this, but all seems cumbersome, so I'm
> supposing I've lost something trivial.
>
> What would have been neat is something ol' AxKit's QueryParam could be done:
> http://search.cpan.org/~nachbaur/AxKit-XSP-QueryParam-0.02/lib/AxKit/XSP/QueryParam.pm#<param:enumerate/>
> i.e., just say in the JX that I want all query parameters, and there they are.
>
> If there is no way to do that, I could do something like it in a controller we
> allready have. We allready do stuff like
> bizData.put("result-list", queryResult);
> res.sendPage("xml/sparql-result", bizData);
> and it would be OK if I could just dump the query parameters here, but it
> seems there is no other way than build the XML manually by looping over the
> queryparameters, which again seems unnecessarily cumbersome.
You could use JXTemplate here:
<jx:forEach var="p" select="${cocoon.request.getParameterNames()}">
<p>${p}=${cocoon.request.getParameter(p)}</p>
</jx:forEach>
HTH
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair reinhard@apache.org
_________________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Luca Morandini <lm...@ieee.org>.
Derek Hohls wrote:
> Luca
>
> Is there a docs page for this - it did not show up in the list of transformers
> accessed via the expanding menu on the http://cocoon.apache.org/2.1/ site.
TraxTransformer is the interface between the sitemap and your XSLT
processor of choice.
Come to think of it, you may set use-request-parameters in the pipeline too:
http://cocoon.apache.org/2.1/userdocs/default/xslt-transformer.html
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Derek Hohls <DH...@csir.co.za>.
Luca
Is there a docs page for this - it did not show up in the list of transformers
accessed via the expanding menu on the http://cocoon.apache.org/2.1/ site.
>>> On 2008/03/27 at 03:21, in message <fs...@ger.gmane.org>, Luca Morandini <lm...@ieee.org> wrote:
Kjetil Kjernsmo wrote:
>
> I need to access the query parameters from a GET request in my XSLT, and I
> have thought of several ways to do this, but all seems cumbersome, so I'm
> supposing I've lost something trivial.
If you set use-request-parameters to true all in the transformer
definition, XSLT would have access to said parameters.
Look at:
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/transformation/TraxTransformer.html
for details.
Regards,
P.S.
I prefer the explicit passing of parameters from the sitemap to the XSLT
via map:parameter, but if you want something quick&dirty...
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Re: Getting the request query parameters in the XML
Posted by Jeroen Reijn <j....@onehippo.com>.
You can use the 'use-request-parameters' parameter, but keep in mind that if you are using caching or eventcaching pipelines,
using this parameter can make your cache grow without controling, because the request parameters will end up in your cachekey.
If a crawler for instance runs by, with a timestamp as request parameter, you could end up with unnecessary cache entries.
This could have an impact on your memory usage.
Regards,
Jeroen
-----Original Message-----
From: news on behalf of Luca Morandini
Sent: Thu 3/27/2008 2:21 PM
To: users@cocoon.apache.org
Subject: Re: Getting the request query parameters in the XML
Kjetil Kjernsmo wrote:
>
> I need to access the query parameters from a GET request in my XSLT, and I
> have thought of several ways to do this, but all seems cumbersome, so I'm
> supposing I've lost something trivial.
If you set use-request-parameters to true all in the transformer
definition, XSLT would have access to said parameters.
Look at:
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/transformation/TraxTransformer.html
for details.
Regards,
P.S.
I prefer the explicit passing of parameters from the sitemap to the XSLT
via map:parameter, but if you want something quick&dirty...
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Luca Morandini <lm...@ieee.org>.
Kjetil Kjernsmo wrote:
>
> I need to access the query parameters from a GET request in my XSLT, and I
> have thought of several ways to do this, but all seems cumbersome, so I'm
> supposing I've lost something trivial.
If you set use-request-parameters to true all in the transformer
definition, XSLT would have access to said parameters.
Look at:
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/transformation/TraxTransformer.html
for details.
Regards,
P.S.
I prefer the explicit passing of parameters from the sitemap to the XSLT
via map:parameter, but if you want something quick&dirty...
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Getting the request query parameters in the XML
Posted by Alexander Daniel <al...@gmx.at>.
On 27.03.2008, at 13:45, Kjetil Kjernsmo wrote:
> I need to access the query parameters from a GET request in my XSLT,
> and I
> have thought of several ways to do this, but all seems cumbersome,
> so I'm
> supposing I've lost something trivial.
You could use the request generator [1]:
<map:generate type="request"/>
<map:transform src="foo.xsl"/>
...
Alex
[1] http://cocoon.apache.org/2.1/userdocs/request-generator.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org