W3C home > Mailing lists > Public > www-forms@w3.org > March 2005

RE: is XForms suitable for my problem ?

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Thu, 31 Mar 2005 09:57:17 +0100
Message-ID: <B894BAE9-0BD8-49AA-8902-73356F946724@S009>
To: "'LEBUR Guillaume'" <guillaume.lebur@justice.fr>
Cc: <www-forms@w3.org>

Hi Guillaume,

> The underlying question is actually : "Is an XForm able to take
> its data from a XML file containing an undefined number of similar
> elements (in my case, <section>'s and <ulink>'s), and to turn them
> into an undefined number of form controls ?"

If you are talking about a 'flat' structure (i.e., unlimited number of
folders, and unlimited number of documents in the folders, but not an
unlimited level of nesting) then XForms is ideally suited to what you
describe, by way of xf:repeat. This element allows you to have a dynamic,
repeating user interface that is based on the number of nodes in a nodeset.
So if you have five sections in your Docbook, you will get five 'iterations'
of the xf:repeat template, but add another to your data, and you
automatically obtain a sixth. And if you have repeating structures *within*
each section, then you just use a nested xf:repeat. (This is a very common
use of XForms, as a kind of 'fine-tuned' XML Editor, geared to a specific
type of document.)
xf:repeats can be nested to any depth you like, but there is a weakness in
the current version of XForms in that you need to know the maximum depth in
advance. So if your structure is actually that you have folders within
folders to any depth, XForms won't be able to do it. That will be addressed
in a future draft, though.
Note that this is not the same as having varying depths, in a context of
knowing the *maximum* depth. In that case XForms will work fine, since a
xf:repeat across an empty nodeset just renders nothing. So this:
        <folder />
    <folder />
would be correctly handled by:
  <xf:repeat nodeset="folder">
    <xf:repeat nodeset="folder">
      <xf:repeat nodeset="folder">
        <xf:repeat nodeset="folder">
even though the depths are different along different paths. (But to
emphasise again, this nested xf:repeat structure won't handle further depths
of the data.)

Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
Received on Thursday, 31 March 2005 08:57:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:14 UTC