All,
I am having some problems in preparing my instance when the page is done loading (on 'xforms-ready' event): Here is what I want to do: ================== For each 'premise' node in the instance 'instance', insert the 'test-expression-template' into the 'test-expression' instance (See attached for example that will run in sandbox): <xforms:instance id="instance"> <aspic:rule> <aspic:premise>First Premise</aspic:premise> <aspic:premise>Second Premise</aspic:premise> </aspic:rule> </xforms:instance> <xforms:instance id="test-expression-template"> <aspic:input> <aspic:expression/> </aspic:input> </xforms:instance> <xforms:instance id="test-expression"> <aspic:inputs> <!-- insert 1 'test-expression-template' for each occurens of aspic:premise in 'instance' here --> <aspic:input> <aspic:expression/> </aspic:input> </aspic:inputs> </xforms:instance> using ev:event="xforms-ready": <xforms:repeat ev:event="xforms-ready" nodeset="instance('rule-instance')/aspic:premise" id="premise-repeat2"> <xforms:insert context="instance('test-expression')" nodeset="aspic:inputs" origin="instance('test-expression-template')"/> </xforms:repeat> Desired output: ================ Insert [1] Insert [2] Actual output: =============== Insert [1] My question is simple (but the answer might not be): How do I do this? Has anyone done this before? Is this even possible, according to the XForms specification / Orbeon implementation? I've allready tried a few ideas, see attachment for details. Thank you for your help, everyone! Sincerely, Henrik Pettersen Advanced Computational Laboratory Cancer Research UK -- 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 test3.xsl (4K) Download Attachment |
Henrik,
an xforms:repeat is only used for displaying items, this won't work. You will need to create a custom action in the model that loops and gets call from your xforms-ready event Something like <xforms:action ev:event="create-instance"> <xforms:insert context="instance('test-expression')" nodeset="aspic:inputs" origin="instance('test-expression-template')" at="last()" position="after"/> <xforms:setvalue ref="instance('control-instance')/counter" value="xs:integer(instance('control-instance')) + 1"/> <xforms:dispatch name="create-instance" target="model-id" if="xs:integer(instance('control-instance')) gt count(instance('rule-instance')/aspic:premise"/> </xforms:action> I have created a control-instance to hold a counter so you know how many it has created, this will need to be 1 when starting, probably best to do that in xforms-ready as well! Also you didn't have the required @at and @position in your xforms:insert previously. There wasn't a rule-instance in your example, only an instance! Ryan Puddephatt Software Engineer Teleflex Group - IT UK 1 Michaelson Square Livingston West Lothian Scotland EH54 7DP e> [hidden email] t> +44(0)1506 407 110 f> +44(0)1506 407 108 >-----Original Message----- >From: Henrik Pettersen [mailto:[hidden email]] >Sent: 09 November 2006 15:17 >To: [hidden email] >Subject: [ops-users] Iterating over inserts on xforms-ready event > >All, > >I am having some problems in preparing my instance when the >page is done loading (on 'xforms-ready' event): > >Here is what I want to do: >================== >For each 'premise' node in the instance 'instance', insert the >'test-expression-template' into the 'test-expression' instance >(See attached for example that will run in sandbox): > > <xforms:instance id="instance"> > <aspic:rule> > <aspic:premise>First Premise</aspic:premise> > <aspic:premise>Second Premise</aspic:premise> > </aspic:rule> > </xforms:instance> > > <xforms:instance id="test-expression-template"> > <aspic:input> > <aspic:expression/> > </aspic:input> > </xforms:instance> > > <xforms:instance id="test-expression"> > <aspic:inputs> > > <!-- insert 1 'test-expression-template' for each >occurens of > aspic:premise in 'instance' here --> > > <aspic:input> > <aspic:expression/> > </aspic:input> > </aspic:inputs> > </xforms:instance> > >using ev:event="xforms-ready": > > <xforms:repeat ev:event="xforms-ready" > >nodeset="instance('rule-instance')/aspic:premise" > id="premise-repeat2"> > <xforms:insert context="instance('test-expression')" > nodeset="aspic:inputs" > >origin="instance('test-expression-template')"/> > </xforms:repeat> > > >Desired output: >================ > Insert [1] > Insert [2] > > > Actual output: > =============== > Insert [1] > > >My question is simple (but the answer might not be): How do I do this? >Has anyone done this before? Is this even possible, according >to the XForms specification / Orbeon implementation? I've >allready tried a few ideas, see attachment for details. > >Thank you for your help, everyone! > >Sincerely, >Henrik Pettersen >Advanced Computational Laboratory >Cancer Research UK > -- 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 |
Ryan,
that's an excellent suggestion! Allow me to paraphrase a little bit: Question: How do I iterate over an activity, inside an <action> element ? Answer: 1. <xforms:repeat> is for display use only, and is not allowed inside <action> elements 2. Instead, use <xforms:dispatch> 2.1 with @name = the @name of the containing action (recursion) 2.2 with @if for the termination test I did not realize that @at and @position were required. Much obliged. Thanks, Ryan! Henrik PS! Sorry, the 'rule-instance' instead of 'instance' slipped in because they were commented out. My mistake. On 11/10/06, Ryan Puddephatt <[hidden email]> wrote: > Henrik, > an xforms:repeat is only used for displaying items, this won't work. > You will need to create a custom action in the model that loops and gets > call from your xforms-ready event > > Something like > > <xforms:action ev:event="create-instance"> > <xforms:insert context="instance('test-expression')" > nodeset="aspic:inputs" origin="instance('test-expression-template')" > at="last()" position="after"/> > <xforms:setvalue ref="instance('control-instance')/counter" > value="xs:integer(instance('control-instance')) + 1"/> > <xforms:dispatch name="create-instance" target="model-id" > if="xs:integer(instance('control-instance')) gt > count(instance('rule-instance')/aspic:premise"/> > </xforms:action> > > I have created a control-instance to hold a counter so you know how many it > has created, this will need to be 1 when starting, probably best to do that > in xforms-ready as well! > > Also you didn't have the required @at and @position in your xforms:insert > previously. There wasn't a rule-instance in your example, only an instance! > > Ryan Puddephatt > Software Engineer > > Teleflex Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotland > EH54 7DP > > e> [hidden email] > t> +44(0)1506 407 110 > f> +44(0)1506 407 108 > > > > >-----Original Message----- > >From: Henrik Pettersen [mailto:[hidden email]] > >Sent: 09 November 2006 15:17 > >To: [hidden email] > >Subject: [ops-users] Iterating over inserts on xforms-ready event > > > >All, > > > >I am having some problems in preparing my instance when the > >page is done loading (on 'xforms-ready' event): > > > >Here is what I want to do: > >================== > >For each 'premise' node in the instance 'instance', insert the > >'test-expression-template' into the 'test-expression' instance > >(See attached for example that will run in sandbox): > > > > <xforms:instance id="instance"> > > <aspic:rule> > > <aspic:premise>First Premise</aspic:premise> > > <aspic:premise>Second Premise</aspic:premise> > > </aspic:rule> > > </xforms:instance> > > > > <xforms:instance id="test-expression-template"> > > <aspic:input> > > <aspic:expression/> > > </aspic:input> > > </xforms:instance> > > > > <xforms:instance id="test-expression"> > > <aspic:inputs> > > > > <!-- insert 1 'test-expression-template' for each > >occurens of > > aspic:premise in 'instance' here --> > > > > <aspic:input> > > <aspic:expression/> > > </aspic:input> > > </aspic:inputs> > > </xforms:instance> > > > >using ev:event="xforms-ready": > > > > <xforms:repeat ev:event="xforms-ready" > > > >nodeset="instance('rule-instance')/aspic:premise" > > id="premise-repeat2"> > > <xforms:insert context="instance('test-expression')" > > nodeset="aspic:inputs" > > > >origin="instance('test-expression-template')"/> > > </xforms:repeat> > > > > > >Desired output: > >================ > > Insert [1] > > Insert [2] > > > > > > Actual output: > > =============== > > Insert [1] > > > > > >My question is simple (but the answer might not be): How do I do this? > >Has anyone done this before? Is this even possible, according > >to the XForms specification / Orbeon implementation? I've > >allready tried a few ideas, see attachment for details. > > > >Thank you for your help, everyone! > > > >Sincerely, > >Henrik Pettersen > >Advanced Computational Laboratory > >Cancer Research UK > > > > > > > > -- > 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 |
Silly formatting. Let's try again:
--------------------------------------------- Ryan, that is an excellent suggestion! Allow me to paraphrase a little bit: Question: How do I iterate over an activity, inside an <action> element ? Answer: 1. <xforms:repeat> is for display use only, and is not allowed inside <action> elements 2. Instead, use <xforms:dispatch> 2.1 with @name = the @name of the containing action 2.2 with @if for the termination test I did not realize that @at and @position were required for <xforms:insert> (OPS throws no exception). Much obliged. Thanks, Ryan! Henrik On 11/10/06, Henrik Pettersen <[hidden email]> wrote:
Ryan, -- 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 |
Henrik,
2. is correct, but the xforms:dispatch will need
a target, which is the id of the control or in this case the model. Use the same
xforms:dispatch in an xforms-ready action to start the
process
Ryan
Ryan
Puddephatt
-- 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
|
In reply to this post by Henrik Pettersen
Henrik Pettersen wrote:
> Silly formatting. Let's try again: > --------------------------------------------- > > Ryan, > > that is an excellent suggestion! Allow me to paraphrase a little bit: > > Question: How do I iterate over an activity, inside an <action> element ? > > Answer: 1. <xforms:repeat> is for display use only, and is not > allowed inside <action> elements > 2. Instead, use <xforms:dispatch> > 2.1 with @name = the @name of the containing action > 2.2 with @if for the termination test > > I did not realize that @at and @position were required for > <xforms:insert> (OPS throws no exception). Much obliged. thrown. They have a default behavior if missing: @at points to the last node of the node-set, and @position is "after". -Erik -- Orbeon Forms - XForms Everywhere http://www.orbeon.com/blog/ -- 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 |
Erik,
My bad :-) Ryan Ryan Puddephatt Software Engineer Teleflex Group - IT UK 1 Michaelson Square Livingston West Lothian Scotland EH54 7DP e> [hidden email] t> +44(0)1506 407 110 f> +44(0)1506 407 108 >-----Original Message----- >From: Erik Bruchez [mailto:[hidden email]] On Behalf Of >Erik Bruchez >Sent: 10 November 2006 11:31 >To: [hidden email] >Subject: Re: [ops-users] Iterating over inserts on xforms-ready event > >Henrik Pettersen wrote: >> Silly formatting. Let's try again: >> --------------------------------------------- >> >> Ryan, >> >> that is an excellent suggestion! Allow me to paraphrase a little bit: >> >> Question: How do I iterate over an activity, inside an ><action> element ? >> >> Answer: 1. <xforms:repeat> is for display use only, and is not >> allowed inside <action> elements >> 2. Instead, use <xforms:dispatch> >> 2.1 with @name = the @name of the >containing action >> 2.2 with @if for the termination test >> >> I did not realize that @at and @position were required for >> <xforms:insert> (OPS throws no exception). Much obliged. > >They are in fact not required, which explains why no exception >is thrown. They have a default behavior if missing: @at points >to the last node of the node-set, and @position is "after". > >-Erik > >-- >Orbeon Forms - XForms Everywhere >http://www.orbeon.com/blog/ > > -- 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
|
In fact, we were both right and wrong: these attributes are required in
XForms 1.0, but optional in 1.1. -Erik Ryan Puddephatt wrote: > Erik, > My bad :-) > > Ryan > > Ryan Puddephatt > Software Engineer > > Teleflex Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotland > EH54 7DP > > e> [hidden email] > t> +44(0)1506 407 110 > f> +44(0)1506 407 108 > > > >> -----Original Message----- >> From: Erik Bruchez [mailto:[hidden email]] On Behalf Of >> Erik Bruchez >> Sent: 10 November 2006 11:31 >> To: [hidden email] >> Subject: Re: [ops-users] Iterating over inserts on xforms-ready event >> >> Henrik Pettersen wrote: >>> Silly formatting. Let's try again: >>> --------------------------------------------- >>> >>> Ryan, >>> >>> that is an excellent suggestion! Allow me to paraphrase a little bit: >>> >>> Question: How do I iterate over an activity, inside an >> <action> element ? >>> Answer: 1. <xforms:repeat> is for display use only, and is not >>> allowed inside <action> elements >>> 2. Instead, use <xforms:dispatch> >>> 2.1 with @name = the @name of the >> containing action >>> 2.2 with @if for the termination test >>> >>> I did not realize that @at and @position were required for >>> <xforms:insert> (OPS throws no exception). Much obliged. >> They are in fact not required, which explains why no exception >> is thrown. They have a default behavior if missing: @at points >> to the last node of the node-set, and @position is "after". >> >> -Erik >> >> -- >> Orbeon Forms - XForms Everywhere >> http://www.orbeon.com/blog/ >> >> > > > > ------------------------------------------------------------------------ > > > -- > 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 -- Orbeon Forms - XForms Everywhere http://www.orbeon.com/blog/ -- 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 |