Thanks, Alex
I understand the logic now, but there is probably something wrong with my
syntax since it is still not working properly. Here's a clip of what I have
(current context is tgroup)
<div>
<xforms:trigger appearance="minimal">
<xforms:label>

Add
Table
Header</xforms:label>
<xforms:insert ev:event="DOMActivate"
context="thead"
origin="instance('row-template')"/>
<xforms:action
xxforms:iterate="for $i in 1 to @cols
return
xxforms:element('dummy')">
<xforms:insert context="thead/row"
origin="instance('entry-template')"/>
</xforms:action>
</xforms:trigger>
</xforms:group>
</div>
<xforms:input ref="@cols">
<xforms:label>Columns</xforms:label>
<xforms:alert>Required</xforms:alert>
<xforms:hint>This must be an integer</xforms:hint>
</xforms:input>
<xforms:group ref="thead/row">
<div class="subsection">
Table Header
<xforms:trigger appearance="minimal">
<xforms:delete ev:event="DOMActivate"
nodeset="."/>
<xforms:label>

</xforms:label>
</xforms:trigger>
<xforms:repeat nodeset="entry">
<div>
<xforms:input ref=".">
<xforms:label>Cell</xforms:label>
</xforms:input>
</div>
</xforms:repeat>
</div>
</xforms:group>
---
What exactly is xxforms:element('dummy')? Why does something need to be
returned?
Thanks,
Ethan
On Mon, Oct 26, 2009 at 9:58 PM, Alessandro Vernet <avernet@orbeon.com>wrote:
> Ethan,
>
> On Mon, Oct 26, 2009 at 11:40 AM, Ethan Gruber <ewg4xuva@gmail.com> wrote:
> > For example, I would like to create an "Add Row" trigger that inserts a
> > <row> into . If I define @cols as 4, I'd like "Add Row" to insert
> > <row><entry/><entry/><entry/><entry/></row>, with an input for each
> <entry/>
>
> It looks like you need a way to execute an action a given number of
> times. In pseudo-code, you could do something like:
>
> <xforms:action xxforms:iterate="for $i in 1 to tgroup/@cols return
> xxforms:element('dummy')">
> <xforms:insert context="row" origin="xxforms:element('entry')"/>
> </xforms:action>
>
> The 1 to tgroup/@cols returns a sequence of (1, 2, 3, 4) if you have 4
> columns, and the xxforms:element() creates an element for each one, as
> the context for XPath evaluation is expected to be a node.
>
> Alex
> --
> Orbeon Forms - Web forms, open-source, for the Enterprise
> Orbeon's Blog:
http://www.orbeon.com/blog/> My Twitter:
http://twitter.com/avernet>
>
> --
> You receive this message as a subscriber of the ops-users@ow2.org mailing
> list.
> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
> For general help: mailto:sympa@ow2.org?subject=help
> OW2 mailing lists service home page:
http://www.ow2.org/wws>
>
--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws