cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Hertz <...@danhertz.com>
Subject Re: use-request-parameters with checkboxes
Date Tue, 03 Oct 2006 16:41:59 GMT
Hi Peter,

You can actually parse checkbox values using xslt2/xpath2 (I've only got 
it to work with get, not post):

Based on: 
http://foo.bar/cgi-bin?field=value&stuff=abc&stuff=def&stuff=ghi&more=bar

1. Add parameter to sitemap:
<map:parameter name="requestQueryString" value="{request:queryString}"/>

2. Add a global parameter as child of <xsl:stylesheet>
<!-- global parameter to hold queryString passed from sitemap -->
<xsl:param name="requestQueryString"/>

2: In your template, add
<!-- tokenize each checkbox choice -->
  <xsl:variable name="queryParams" select="tokenize($requestQueryString, 
'&amp;')"/>
  <xsl:variable name="checkboxValues" select="for $p in 
$queryParams[starts-with(., 'stuff=')] return substring-after($p, 
'stuff=')"/>

Each value can be selected using <xsl:for-each select="$checkboxValues">

(Thanks to Michael Kay for helping me with this)

Dan

=== PETER'S ORIG MESSAGE ===

[SNIP]

If I change the action attribute of the form element to point to my
Cocoon (using a URI defined in my sitemap.xmap with 
use-request-parameters), it appears that Cocoon silently munges these 
into the format

http://foo.bar/cgi-bin?field=value&stuff=abc&stuff=def&stuff=ghi&more=bar

This makes the data unusable, as the XSLT receives only one value for 
the parameter stuff (the first) and drops the othes on the floor.


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


Mime
View raw message