Re: [Xsltforms-support] Submitting xf:select with underscores separatedvalues?
Brought to you by:
alain-couthures
From: Grégoire C. <gco...@gm...> - 2011-02-09 10:38:29
|
Le 09/02/2011 01:54, Leigh L Klotz Jr a écrit : > On 05/27/2010 03:09 PM, Grégoire Colbert wrote: >> Hi, >> >> The XForms 1.1 recommentation says that when multiple values from a >> <xf:select> are sent, they are separated with spaces. Is it possible >> to modify this to get underscore instead of spaces? If so, how? >> >> Thank you, >> Grégoire >> > You can use translate, like this, which does a GET of > /path/to/server?properties=a,b,c > <submission id="lookup" method="get" > ref="instance('main')" serialization="none" > replace="instance" instance="results"> > <resource value="concat('/path/to/server?properties=', > translate(instance('main')/properties, ' ', ','))" /> > </submission> > > You could also get value=a;value=b;value=c with select/itemset/copy and > the default serialization for method="get", but XSLTForms doesn't yet > implement select/itemset/copy. > > If you just want to put in underscores but leave the data in XML > instance data submitted, you can bind the select to a separate instance > and use bind/@calculate to use the same XPath translate() function to > place the data format you want into the submitted instance. > > Leigh. Thank you Leigh for answering this, but it was posted in May 2010! :-) For the records, I now use fn:string-join in the "resource" element of the submission element. It gives something like this: <xf:submission id="here-is-a-great-id" method="get" serialization="none" replace="instance" instance="instance-response-id"> <xf:resource value="concat('/some/service/' , fn:string-join(instance('instance-request-id')/someressource/key,'_'))"/> </xf:submission> That's almost the same as using "translate", obviously. Thanks! Grégoire |