I have a <div>
element which I want to use based on the xforms instance value.
Something like:
<xf:trigger appearance="minimal" >
<xf:label >
..
<div if="instance('scope')= 'user'"> <!-- I know this doesn't work -->
</div>
..
</xf:label>
....
</xf:trigger>
Is this 'if' attribute where we check instance values only available with the <xf:action>,<xf:submission> etc
. elements and not with regular html elements ? Or is there a way I am missing ?
For conditional HTML elements, XForms allows to define an xf:group element with a ref attribute.
The trick to emulate an "if" is to use a predicate as in ".[instance('scope') = 'user']": this way, the context node remains the same but the xf:group content will be disabled if the condition in the predicate is false.