I have a need to insert blocks of xml into a repeated set. I have used an action while which should do the job, however it only seems to add the xml into the first repeated element:
<xforms:setvalue ev:event="DOMActivate" ref="instance('tmpLoops')/Loop" value="1"/> <xforms:action while="instance('tmpLoops')/Loop <= instance('instance_model_SeaManifest')/ManifestInformation/Header/ShipmentQuantity"> <xforms:insert ev:event="DOMActivate" context="instance('instance_model_SeaManifest')/ManifestInformation/Shipment[instance('tmpLoops')/Loop]/Header" position="after" nodeset="CustomsProcedure" at="last()" origin="instance('TransportDocumentNumber')" if = "((instance('instance_model_SeaManifest')/UserInformation/RecipientID=1) and (instance('instance_model_SeaManifest')/ManifestInformation/Header/ManifestType = 4))"/> <xforms:delete ev:event="DOMActivate" nodeset="instance('instance_model_SeaManifest')/ManifestInformation/Shipment/Header/TransportDocumentNumber[1]" at="1" if = "instance('instance_model_SeaManifest')/UserInformation/RecipientID != 1" /> <xforms:setvalue ref="instance('tmpLoops')/Loop" value=". + 1"/> </xforms:action> There are 2 shipment(s) in the instance, and the xml is added, but it doesn't appear to use the index correctly? |
Administrator
|
Chris,
On 6/8/07, ChrisSpeare <[hidden email]> wrote: > I have a need to insert blocks of xml into a repeated set. I have used an > action while which should do the job, however it only seems to add the xml > into the first repeated element: > [...] A simpler and stand-alone example that we can run in the sandbox would help to understand what the problem is. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 |
One thing that'll work in the sandbox :-)
xForm.xhtml 2 Shipments, loop goes through twice which it should do. Only adds to the first Shipment?
|
In reply to this post by Alessandro Vernet
One thing that'll work in the sandbox :-)
xForm.xhtml 2 Shipments, loop goes through twice which it should do. Only adds to the first Shipment?
|
In reply to this post by ChrisSpeare
OK, what!!
If I add [(0 + instance('tmpLoops')/Loop)] it now works. Me thinks a bug is present. I did try and bind the tmpLoops/Loop as an integer but this did nothing for me. |
Administrator
|
Hi Chris,
On 6/13/07, ChrisSpeare <[hidden email]> wrote: > If I add [(0 + instance('tmpLoops')/Loop)] it now works. Me thinks a bug is > present. I did try and bind the tmpLoops/Loop as an integer but this did > nothing for me. When you have a predicate of the form [E], if E is of a numeric type, then this is called a numeric predicate. Otherwise, E is converted to a boolean. Here instance('tmpLoops')/Loop returns an element, so this is not a numeric type. The element is converted to a boolean, and you don't get the result you expected. So instead, write: [number(instance('tmpLoops')/Loop)] You get the same result by doing 0 + E, but I think that using number(E) is more elegant. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- 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 |