RE: is XForms suitable for my problem ?

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>
      <folder>
        <folder />
      </folder>
    </folder>
    <folder />
  </folder>
 
would be correctly handled by:
 
  <xf:repeat nodeset="folder">
    <xf:repeat nodeset="folder">
      <xf:repeat nodeset="folder">
        <xf:repeat nodeset="folder">
          ...
        </xf:repeat>
        ...
      </xf:repeat>
      ...
    </xf:repeat>
    ...
  </xf:repeat>
 
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.)
 
Regards,
 
Mark
 

Mark Birbeck
CEO
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
http://www.formsPlayer.com/

Received on Thursday, 31 March 2005 08:57:47 UTC