-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify initial XPath expression context of bind expressions (and similar) #137
Comments
The primary use for this I'm aware of involves first capturing a roster in one repeat and then asking follow-up questions about some or all of the items in the roster in a second repeat. For example, you could capture the names and ages of all household members and then ask questions only about the children under 5. Here's an XLSForm that illustrates this: https://docs.google.com/spreadsheets/d/1Ca8fbhpGpdaxLAnSSebrGRnbey5U0FUbJM_pVxjReKI/edit#gid=1068911091
An alternative would be to consider implementing it for compatibility with existing forms without making it an explicit part of the spec and maybe communicating that it's deprecated in some way (warning?). I don't believe we document any examples like this and the second structure in my sample form seems less ambiguous. I believe this intersects in interesting ways with edits (#36): if certain repeat instances are entirely non-relevant, because the spec doesn't have a stable ordinal concept, their position will change on edit. That's why Enketo has an additional ordinal concept: https://enketo.github.io/enketo-express/tutorial-12-ordinals.html This is also at least tangentially related to enketo/enketo#49 I think |
The more this is kicking around my brain, the more I feel like we might want to defer even the spike until we have a vat of edge cases that we can consider together and triage! I think the concept is likely only useful with This comment from @eyelidlessness also resonates and may be an alternative to addressing this specific issue:
|
I'm not in a huge rush to dive further into this, but I do want to make it clear that this issue isn't specifically about It really is about the broader question: when an XPath expression's context is a bind That has broader implications than the particular test that raised the question this time, and the kinds of use cases we can extrapolate from it. There have been other cases like this which have raised the same question in my mind. I would need to spend some time going through our now-expanded test suite and probably through Enketo's fixtures to say for certain what the other cases look like. This one just happened to jump out at me as a fairly well distilled example where the implications of the question are relatively simple to grok. My gut instinct is that the time we'd invest in this proposed spike would be relatively minimal (even without time boxing it). Almost certainly less than the time we'd spend doubting it, and collecting cases to justify it. I also think that the intuitive answer we agreed on just a little while ago very probably reflects the expectation people would tend to have when authoring
It's also at least plausible that rethinking the conventions and recommendations around these structures could make answering the broader question more compelling.
I am eager to dive into these kinds of questions about edit-specific considerations. The absence of non-relevant repeat instances certainly could imply a positional change upon edit, but it's not necessarily what I'd expect. Depending on the particular |
This issue is intended to capture the outcome of some discussion with @lognaturel about this test. Specifically, given a form structure...
/data/node-values
will be"345"
""
This is because:
/data/node
, the expressionposition() > 2
will always returnfalse
becauseposition()
in a single node context will always return1
.node
repeat instances will ever be relevant.value
, causing their values to be blank.It's clear that the expectation is that the
relevant
expression is evaluated against a multiple node context. Though it's not obvious in this form fixture, there's still some room for ambiguity about what the expected context should be:nodeset
nodset
The first option seems obvious. But consider a variation of the above form fixture:
With the complete set, the respective values of
/data/outer/inner-vals
would be:"345"
"12345"
With the contiguous subset, they'd be:
"345"
"345"
The latter is what I would intuitively expect. Describing a structure like this in discussion with @lognaturel, we agreed on that intuition. Notably, for the affected test linked above, the implicit outcome would be that
position()
innodeset
context will behave as if it had been expressed asposition(.)
(i.e. it would be consistent with the ODK XForms specification's 1-arityposition
extension).Having a clear set of expectations, we also agreed on these next steps:
relevant
expressionsnodset
contextnodeset
contextValidate that this generalization does not break other things. (Editorial: it may very well fix other things.)
If all of the above holds, open an xforms-spec issue to clarify initial expression context accordingly.
The text was updated successfully, but these errors were encountered: