Re: [Xsltforms-support] Binding to optional element
Brought to you by:
alain-couthures
|
From: Klotz, L. <Lei...@xe...> - 2010-01-19 21:34:53
|
Another option, though with UI ramifications. It uses a select1 for the named cases and a button for the default case. And the new insert/delete attributes in XForms 1.1. I've not tested this, but it's from http://www.w3.org/TR/xforms/#data-mutation-patterns <instance id="data"> <data xmlns=""><format>XML</format></data> </instance> <instance id="prototypes"> <data xmlns=""><format>XML</format></data> </instance> <group ref="/root/format"> <select1 ref="."> <label>Format: </label> <item><label>XML</label><value>xml</value></item> <item><label>Text</label><value>text</value></item> <item><label>Binary</label><value>binary</value></item> <item><label>Default</label><value /></item> <delete ev:event="xforms-value-changed" if=". = ''" nodeset="." /> </select1> </group> <trigger ref="/root[not(format)]"> <label>Set Format</label> <insert ev:event="DOMActivate" context="/root" nodeset="format" origin="instance('prototypes')/format" /> </trigger> -----Original Message----- From: Micah Dubinko [mailto:Mic...@ma...] Sent: Tuesday, January 19, 2010 11:58 AM To: xsl...@li... Subject: [Xsltforms-support] Binding to optional element Hey everyone, This was difficult to do in XForms 1.0. What's the latest state of the art? Say I have an XML instance like this: <root> <format>xml</format> </root> Possible values for the format element are "xml", "text", "binary", or a default setting, indicated by a complete absence of the <format> element. I'd like this to attach to a select1 with four choices: <xf:select1 ref="format">... * xml * text * binary * default Where the first three set the value of the <format> element, and the fourth omits the element altogether. In XForms 1.0, the difficulty comes from binding to a nonexistent element. Are there features from 1.1, 1.2, or XSLTForms that make this case easier? Anyone have an example? Thanks! -m ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support |