Re: [Xsltforms-support] Binding to optional element
Brought to you by:
alain-couthures
From: Micah D. <Mic...@ma...> - 2010-01-20 08:41:46
|
Thanks Tambet, Looks like a good direction to pursue. In the case where the default selection (no element) gets saved and then the form is reopened, in other words when the instance is <root/> How do you make it work (since the binding to /root/format goes nowhere)? -m On Jan 20, 2010, at 12:34 AM, Tambet Matiisen wrote: > This is the same solution I have used in wsdl2xforms, but I used > xforms-submit event instead. > > <xforms:instance id="temp"> > <temp> > <relevant xsi:type="boolean">true</relevant> > </temp> > </xforms:instance> > <xforms:submission ...> > <xforms:setvalue ref="instance('temp')/relevant" value="false()" > events:event="xforms-submit"/> > <xforms:setvalue ref="instance('temp')/relevant" value="true()" > events:event="xforms-submit-done"/> > <xforms:setvalue ref="instance('temp')/relevant" value="true()" > events:event="xforms-submit-error"/> > </xforms:submission> > <xforms:bind nodeset="/root/format" relevant="(. != '' or > boolean-from-string(instance('temp')/relevant))"/> > > Works well enough in Chiba. OK, name could be more descriptive :). > > Tambet > > Klotz, Leigh wrote: >> You might be able to use the relevance-with-submission-flag hack: >> >> <bind nodeset="/root/format" relevant="instance('state')/aboutToSubmit = 'false' or . != ''" /> >> <instance id="state"><data xmlns=""><aboutToSubmit>false</aboutToSubmit></instance> >> <submit submission="save"> >> <setvalue ev:event="DOMActivate" ref="instance('state')/aboutToSubmit">true</setvalue> >> </submit> >> <submission id="save"> >> <setvalue ev:event="xforms-submit-done" ref="instance('state')/aboutToSubmit">false</setvalue> >> <setvalue ev:event="xforms-submit-error" ref="instance('state')/aboutToSubmit">false</setvalue> >> </submit> >> >> -----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 >> >> ------------------------------------------------------------------------------ >> 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 >> > > > ------------------------------------------------------------------------------ > 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 |