Reducing the amount of XForms markup by using more attributes instead of nested elements

All,

I think that we touched on this in the past, but I don't think we have
formally decided anything. For an example, I found myself writing this
today:

<xf:select1 ref="lang">
    <xf:label>Lang:</xf:label>
    <xf:item>
        <xf:label>English</xf:label>
        <xf:value>en</xf:value>
    </xf:item>
    <xf:item>
        <xf:label>French</xf:label>
        <xf:value>fr</xf:value>
    </xf:item>
</xf:select1>

What about something like this instead:

<xf:select1 ref="lang" label="Lang:">
    <xf:item label="English" value="en"/>
    <xf:item label="French" value="fr"/>
</xf:select1>

Now this is a simple case where all the values are constants, but
there are ways to introduce dynamic values, for example:

- introduce `labelref` or `label-ref`
- use AVTs, e.g.: label="{my-label}"

Also, the choice of the `value` attribute is debatable, as `value`
currently is an XPath expression. We could write value="'en'" or
simply keep the value as the text value of the element.

So the exact details are TBD, but the fact remains that if you write
XForms by hand you often have to write way more markup than needed.
Since mainstream programming is tending towards more conciseness, we
should consider making further efforts in that direction as well.

-Erik

Received on Tuesday, 28 February 2012 01:06:05 UTC