RE: A few XForms Questions...

Hi Dan,

You wrote:
> From the spec, an itemset can not contain an itemset,
> but a choices can contain itemset or choices. If I
> want the hierarchy totally dynamic using itemset, is
> the following representation correct?

> <selectOne ref="">
> 	<caption>Select a category and keyword</caption>
> 	<choices>
> 		<itemset nodeset="">
> 			<caption ref=""/>
> 			<value ref=""/>
> 		</itemset>
> 		<choices>
> 			<itemset nodeset="">
> 				<caption ref=""/>
> 				<value ref=""/>
> 			</itemset>
> 		</choices>
> 	</choices>
> <selectOne>

Yes, it is correct, but it doesn't do what you want it to do.

> Does it adequately imply that the second itemset is
> dependent upon the first itemset similar to a nested
> repeat?  This representation does not seem as strong
> as the nested repeat.

They are *not* nested - the two itemsets have a common parent, but that is
all. So there is no relationship between the two nodeset attributes.

> I would prefer something like the following where the
> nodeset context is more obvious:
>
> <selectOne ref="">
>	<caption>Select a category and keyword</caption>
> 		<itemset nodeset="">
> 			<caption ref=""/>
> 			<value ref=""/>
> 			<itemset nodeset="">
> 				<caption ref=""/>
> 				<value ref=""/>
> 			</itemset>
> 		</itemset>
> <selectOne>

I agree with your sentiment, but actually all you'd need to do is allow
xforms:choices to have single node binding attributes
(xforms:bindFirstAttributes in the schema) which would mean you then don't
have to nest itemsets (which seems wrong when nesting is the job of
xforms:choices).

Another solution would be to allow xforms:group (or something with similar
functionality but called something like xforms:setContext to make its
purpose clearer) to appear anywhere in an XForms document. That would help
in a few other situations as well as this one, such as, when referring to
text for captions and hints it would be handy to be able to do this:

  <xforms:button>
    <!--
      get the caption, hint, help and error messages in the selected
language, for
      a 'Previous' button
    -->
    <xforms:setContext model="strings" ref="/lang/strings[@id='prev']">
      <xforms:caption ref="caption" />
      <xforms:alert ref="alert" />
      <xforms:help ref="help" />
      <xforms:hint ref="hint" />
    </xforms:setContext>
    <xforms:action ...>
      ...
    </xforms:action>
  </xforms:button>

There are many similar situations where this would save repetition. For
example, after inserting a new element with the xforms:insert action, it
would be convenient to be able to group a whole load of xforms:setValue
actions together, under a common context.

Regards,

Mark


Mark Birbeck
Managing Director
x-port.net Ltd.
4 Pear Tree Court
London
EC1R 0DS

E: Mark.Birbeck@x-port.net
W: www.x-port.net
T: +44 (20) 7689 9232
Co-author Professional XML and
Professional XML Meta Data,
both by Wrox Press

Received on Friday, 17 May 2002 08:45:49 UTC