Say I have a dynamically-generated XForms instance like the one below
where the number of detail elements varies with every request. <form-model> <detail det-id="1"> <foo>8829292</foo> <target-element/> </detail> <detail det-id ="2"> <foo/>4648749</foo> <target-element/> </detail> ...more detail elements potentially here... </form-model> I am attempting to claculate value of the "target-element" from values of the "foo" element and the value of the detail/@det-id attribute using the "calculate" facility of XForms "bind" element. Let's suppose that the function I want to use is concat(). After the calculation, the instance should then look like this: <form-model> <detail det-id="1"> <foo>8829292</foo> <target-element>88292921</target-element> </detail> <detail det-id ="2"> <foo/>4648749</foo> <target-element>46487492</target-element> </detail> ...more detail elements potentially here... </form-model> The problem I have is that the XPath expression I use in the bind: <xforms:bind nodeset="target-element" calculate="concat(../foo, ../../detail/@det-id)"/> ...returns nodeset of all "detail" nodes as a value of the second operand which concat() does not like. Any ideas as to how to get what I want using xforms? Thanks -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Alexander Zatko wrote:
> Say I have a dynamically-generated XForms instance like the one below > where the number of detail elements varies with every request. > > <form-model> > <detail det-id="1"> > <foo>8829292</foo> > <target-element/> > </detail> > <detail det-id ="2"> > <foo/>4648749</foo> > <target-element/> > </detail> > ...more detail elements potentially here... > </form-model> > > I am attempting to claculate value of the "target-element" from values > of the "foo" element and the value of the detail/@det-id attribute using > the "calculate" facility of XForms "bind" element. Let's suppose that > the function I want to use is concat(). After the calculation, the > instance should then look like this: > > <form-model> > <detail det-id="1"> > <foo>8829292</foo> > <target-element>88292921</target-element> > </detail> > <detail det-id ="2"> > <foo/>4648749</foo> > <target-element>46487492</target-element> > </detail> > ...more detail elements potentially here... > </form-model> > > The problem I have is that the XPath expression I use in the bind: > > <xforms:bind nodeset="target-element" calculate="concat(../foo, > ../../detail/@det-id)"/> > > ...returns nodeset of all "detail" nodes as a value of the second > operand which concat() does not like. Any ideas as to how to get what I > want using xforms? Try: <xforms:bind nodeset="/form-model/detail/target-element" calculate="concat(../foo, ../../@det-id)"/> Your ../../detail/@det-id returned a node-set containing all the det-id attributes, hence your error. -Erik -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Eric,
The path that works is actually "../@det-id", but you pointed me in the right direction. Thank you. A. On Nov 30, 2005, at 5:58 AM, Erik Bruchez wrote: > Alexander Zatko wrote: > > Say I have a dynamically-generated XForms instance like the one below > > where the number of detail elements varies with every request. > > > > <form-model> > > <detail det-id="1"> > > <foo>8829292</foo> > > <target-element/> > > </detail> > > <detail det-id ="2"> > > <foo/>4648749</foo> > > <target-element/> > > </detail> > > ...more detail elements potentially here... > > </form-model> > > > > I am attempting to claculate value of the "target-element" from > values > > of the "foo" element and the value of the detail/@det-id attribute > using > > the "calculate" facility of XForms "bind" element. Let's suppose that > > the function I want to use is concat(). After the calculation, the > > instance should then look like this: > > > > <form-model> > > <detail det-id="1"> > > <foo>8829292</foo> > > <target-element>88292921</target-element> > > </detail> > > <detail det-id ="2"> > > <foo/>4648749</foo> > > <target-element>46487492</target-element> > > </detail> > > ...more detail elements potentially here... > > </form-model> > > > > The problem I have is that the XPath expression I use in the bind: > > > > <xforms:bind nodeset="target-element" calculate="concat(../foo, > > ../../detail/@det-id)"/> > > > > ...returns nodeset of all "detail" nodes as a value of the second > > operand which concat() does not like. Any ideas as to how to get > what I > > want using xforms? > > Try: > > <xforms:bind nodeset="/form-model/detail/target-element" > calculate="concat(../foo, ../../@det-id)"/> > > Your ../../detail/@det-id returned a node-set containing all the > det-id attributes, hence your error. > > -Erik > > > -- > You receive this message as a subscriber of the > [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |