With XForms 2.0, the switch control can have a new attribute named caseref. It can be very useful for authors in common situations: many forms require conditional parts according to a expression value. With this new attribute, the XForms switch control is more similar to the Java/C switch statement
Authors with XForms usually use a workaround based on as many group controls and XPath predicates as necessary, as in <group ref=”mycontext[mycondition_1]“>…</group><group ref=”mycontext[mycondition_2]…</group>…
There is still a restriction because of the use of the id attribute: a case as to be unique in a form because it is identified with its id attribute value.
For big forms, for subforms, for switchs, the id attribute is too restrictive. The new var element is using the name attribute instead. Next version of XForms could benefit in getting ride of the id attribute and replacing it with the name attribute. XSLTForms is already generating missing ids according to the position of the element in the tree and ids could be generated from names with a similar approach without a big effort.
What do you think?