cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Pietschmann" <dev.sen...@gmail.com>
Subject AW: Confused about sitemap query parameters
Date Fri, 16 Dec 2005 08:00:07 GMT
I think this is due to the HttpServletRequest.getParameter() method, which
seems to be used:

"getParameter

Returns the value of a request parameter as a String, or null if the
parameter does not exist...

You should only use this method when you are sure the parameter has only ONE
value. If the parameter might have MORE than one value, use
getParameterValues(String).

If you use this method with a multivalued parameter, the value returned is
equal to the FIRST value in the array returned by getParameterValues."

So you can only use {request-param:...} if there's only one parameter.

If this page (http://wiki.apache.org/cocoon/InputModules) is still right,
the following should work for you:

"If you have multiple parameters with the same name, and want to get one of
them, say the 2nd one, you'll have to use the RequestModule, that has JXPath
features, like in this sample:

<map:parameter name='my-parameter'
value='{request:getParameterValues(.,"myParameter")[2]}'/>"



Stefan

| -----Urspr√ľngliche Nachricht-----
| Von: Daniel Hertz [mailto:danielhertz@shaw.ca]
| Gesendet: Donnerstag, 15. Dezember 2005 18:27
| An: Cocoon-Users List
| Betreff: Confused about sitemap query parameters
| 
| Given a query string:
| 
| approved=1&approved=2&approved=4&foo=bar
| 
| how do you access each 'approved' parameter value and pass it to XSLT?
| 
| If I use:
| 
| <map:transform type="xslt" src="somepage.xslt">
|     <map:parameter name="approved" value="{request-param:approved}"/>
| </map:transform>
| 
| I only get the first value (1).
| 
| I'm wanting to take all the 'approved' parameter values and concatenate
| them to:
| 
| (1,2,4)
| 
| Thanks for any tips you may have!
| 
| Daniel
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
| For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message