@if and @src

Here's a partly-baked idea that came from today's vFtF:

Add @src to model as Steven suggested, but also to bind.
Add @if to all elements except
- 
model                                                                           

- value
- label
- submission
- mediatype
- filename

For all elements already posessing @ref or @nodeset, @if is roughly 
equivalent to what can be done by these existing patterns:
 <elt ref="x" if="pred" /> --> <elt ref="x[pred]" />
 <elt nodeset="x" if="pred" /> --> <elt nodeset="x[pred]" />

but it's more declarative and it's less likely to lead to unintended 
consequences
- relative paths would be allowed with context references, instead of 
having to be absolute
- no interop problem of some processors supporting "." in variance with 
XPath 1.0 spec and others properly but pedantically requiring self::node().

So, putting them together:

<bind if="mode=view">
  <bind nodeset="/" readonly="true" />
</bind>

Or, consider this:

<select ref="abc">
  <label>ABC</label>
  <choices>
     <item if="../def = 1">
        <label>Hi</label>
        <value>Hi</value>
     </item>
  </choices>
</select>

Received on Thursday, 11 June 2009 20:12:14 UTC