- From: Klotz, Leigh <Leigh.Klotz@xerox.com>
- Date: Wed, 4 Oct 2006 13:56:05 -0700
- To: "Abishek Bellamkonda" <abi.bellamkonda@roadhouse.com.au>, <www-forms@w3.org>
- Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF4024CC77B@usa7061ms01.na.xerox.net>
There are a couple of misspellings and other errors that might or might not have been causing you problems. You can use . instead of current(), and work in processors that don't have current(). Also, I've also shown a way to do this without group or . or curent(), by using a predicate directly on value, though of course you may want to use group for other reasons. I have attached an example that works when tested in Mozilla XForms 0.6. Leigh. -----Original Message----- From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf Of Abishek Bellamkonda Sent: Monday, October 02, 2006 10:25 PM To: www-forms@w3.org Subject: XForms: Bind value of attribute? My scenario is like this, I have a model: <data> <Animals> <Cat appearance="full" name="Cat 1" ><value>Red</value></Cat> <Cat appearance="compact" name="Cat 2"><value>Green</value></Cat> <Cat appearance="minimal" name="Cat 3"><value>Brown</value></Cat> </Animals> </data> Now I want to display the cat colors like this: I want full select1 for Cat1 (appearance = full), compact select1 for Cat 2, and minimal select1 for Cat 3. Does xForms support like xsl:attribute element or something? We can ref any element, but can we do the same for attribute? I am currently doing like this, which works, but I was wondering if there was a better way. <xf:repeat nodeset="Animals/Cat"> <!-Show full --> <xf:group nodeset="current()[@apprearance='full']"> <xf:select1 ref="value" appearance="full"> <xf:label ref="../@name"/> <xf:itemset nodeset="/data/Colors/data"> <xf:label ref="."/> <xf:value ref="."/> </xf:itemset> </xf:select1> </xf:group> <!-Show Minimal --> <xf:group nodeset="current()[@apprearance='compact']"> <xf:select1 ref="value" appearance="compact"> <xf:label ref="../@name"/> <xf:itemset nodeset="/data/Colors/data"> <xf:label ref="."/> <xf:value ref="."/> </xf:itemset> </xf:select1> </xf:group> <!-Show Compact --> <xf:group nodeset="current()[@apprearance='compact']"> <xf:select1 ref="value" appearance="compact"> <xf:label ref="../@name"/> <xf:itemset nodeset="/data/Colors/data"> <xf:label ref="."/> <xf:value ref="."/> </xf:itemset> </xf:select1> </xf:group> </xf:repeat> With Regards, Abi (Abishek Bellamkonda) Senior Architect / Technology Specialist / Tech Lead Roadhouse Technologies PTY. LTD. 9/663 Victoria Street Abbotsford 3067 Australia T+ 61 3 9427 7522 F+ 61 3 9427 7533 E abi@roadhouse.com.au W www.roadhouse.com.au
Attachments
- application/octet-stream attachment: cats.xhtml
Received on Wednesday, 4 October 2006 20:56:39 UTC