Inherited relevance?

Hopefully this is a simple yes or no question... But does/how ODK XForms clients - eg Enketo, Collect - handle the concept of 'inherited' relevance? Which is to say, the situation where you have a control whose binding includes a relevant='foo', where the control is also under a group whose binding has its own relevant='bar'? Its possible that the control itself may be currently 'relevant' (and hence would normally be shown) but the group its under is not currently relevant (hence the control and all its peers under said group are actually hidden).

It would seem that in order to be strictly correct, the runtime relevant checking code would have to walk up the group parent tree of each control to ensure no parent group is non-relevant. Is that what Enketo, Collect et all are doing? This has important consequences if you were to consider a form is only 'complete' (ie submittable) when all required and relevant controls are answered.



Further investigation shows that this is indeed the case - relevance must (also) be inherited.

From XForms1.1 Spec (emphasis added):

6.1.4 The relevant Property

Description: indicates whether the model item is currently relevant. Instance data nodes with this property evaluating to false are unavailable in the user interface and can be removed from submission serialization.

Computed Expression: Yes.

Legal Values: Any expression that is convertible to XPath boolean with boolean().

Default Value: true().

Inheritance Rules: If any ancestor node evaluates to XPath false, this value is treated as false. Otherwise, the local value is used.
This is the equivalent of taking the logical AND of the evaluated relevant property on the local and every ancestor node.

I assume this is what ODK Collect and Enketo are doing, right?

This is something you should check empirically, but my experience is that the parent relevance overrides child relevance. How exactly that happens in JavaRosa, I have no idea.

Yup, empirically this is what I observe. I was just curious as to the exact mechanism (JavaRosa?) is using. eg walking up the group hierarchy whenever recalculating a control's relevance, or pushing irrelevance down whenever a group becomes irrelevant... Maybe I'll dig thru the JavaRosa code.