Suggestion for supporting recursive XML structures in XForms

Hi,

I'm a big fan of XForms and absolutely love it for the fact that a lot of
functionality can be achieved with a few line of XForms.

But one problem I keep bumbing into is that XForms cannot handle XML
instances
with a recursive structure.
I solve this by generating the XForms in XQuery , but would prefer to do
this
with static XForms.

To clarify what I mean I developed a example (with uses XBL) for proof the
concept.
This example works under Firefox 1.5.0.7 (with the XForms-plugin 0.6)
and is attached to this mail.

I think this would be a great feature for XForms 1.1, but than more neatly
like:

<xf:model>
  <xf:instance xmlns="" id="list">
    <instance>
      <section name="1">
        <paragraph>a</paragraph>
        <paragraph>b</paragraph>
        <section name="1-1">
          <paragraph>a</paragraph>
          <section name="1-1-1">
            <paragraph>b</paragraph>
          </section>
        </section>
      </section>
      <section name="2">
        <paragraph>a</paragraph>
      </section>
    </instance>
  </xf:instance>
</xf:model>

<xf:group ref="instance('list')">
  <xf:repeat id="section-repeat" nodeset="section">
    <div>
      <xf:output ref="@name">
        <xf:label>section name: </xf:label>
      </xf:output>
    </div>
    <xf:repeat nodeset="paragraph">
      <xf:output ref=".">
        <xf:label>paragraph: </xf:label>
      </xf:output>
    </xf:repeat>
    <xf:repeat recurrentRepeat="section-repeat"/>
  </xf:repeat>
</xf:group>


This should work great in combination with a xf:insert with the context
and origin parameters

Of course problems like duplicated id for the xf:repeat and xf:case should
be
though about, IMHO solveable (reference to id works in the current "repeat
depth")

Would this be something to consider adding to the XForms specification ?

Greetings,

 Pepijn Noltes
 Software Engineer
 Topic Embedded Systems
 The Netherlands

Received on Tuesday, 19 September 2006 09:30:04 UTC