- From: Mark Birbeck <mark.birbeck@formsPlayer.com>
- Date: Thu, 18 Oct 2007 15:06:24 +0100
- To: "Frederik Elwert" <felwert@uni-bremen.de>
- Cc: www-forms@w3.org
Hi Frederik, The first thing to do is make your test include a space, since that is the delimiter in a list of items: contains(flavors, 'a ') That stops 'a' getting mixed up with 'ab'. Of course, the problem now is that if the item you're testing for is the last in the list then it won't have a space after it; you will therefore also need to change the item you are testing against: contains(concat(flavors, ' '), 'a ') I haven't tested that, but I recall having to do something along these lines quite a while ago. (It's also much the same as you would do in JavaScript when testing for @class values.) All the best, Mark On 18/10/2007, Frederik Elwert <felwert@uni-bremen.de> wrote: > > Hello! > > I just was wondering how I can test for a specific listItem in a > variable of type xforms:listItems. > > I have a select that offers several options: > > <select ref="flavors" appearance="full"> > <label>Flavors:</label> > <item> > <label>Vanilla</label><value>v</value> > </item> > <item> > <label>Strawberry</label><value>s</value> > </item> > <item> > <label>Chocolate</label><value>c</value> > </item> > </select> > > Now I have another item that should test if "Chocolate" was chosen, e.g. > in a "relevant" property. How can I achieve this? > > Using XPath functions as "contains()" seems a bit strange, since I could > have values like "a" and "ab", so > contains(flavors, 'a') > would match "a" as well as "ab". > > Is there a proper way? I can't use structured markup and itemset, since > I need HTML forms compatibility. > > Thanks, > Frederik > > > -- Mark Birbeck, formsPlayer mark.birbeck@formsPlayer.com | +44 (0) 20 7689 9232 http://www.formsPlayer.com | http://internet-apps.blogspot.com standards. innovation.
Received on Thursday, 18 October 2007 14:06:42 UTC