-
Notifications
You must be signed in to change notification settings - Fork 137
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
${} references in predicates not used as choice filters should be expanded using current() #490
Comments
I am aware of one group of users (OpenClinica) that would benefit from the proposed feature. Generally, useful for those people that use complex external data structures. |
@gushil - Can you work on this next? |
@MartijnR @lognaturel - Is it as simple as adding current()/ before these references as they are generated now or does it also need to take into account the hierarchy between the item containing this logic and the item being referenced? |
Would like @MartijnR to chime in as well but I believe that if we detect a |
It looks like it does already do the relative paths correctly, so hopefully prepending
and that the context of this predicate is not part of the primary instance (and e.g. not creating a choice list from previously answered repeat questions). That is probably reliably done by looking for |
YES. Very important. |
I'm on it. |
I tried using this form :
Anything I missed? |
@MartijnR @lognaturel Thanks! |
Did you change |
I haven't do that. Should I? |
Yes, sorry that wasn’t clear. The linked form works but only because I explicitly wrote current() expressions. That’s not great because it’s hard to keep track of where we do and don’t need to be explicit. Additionally, being able to use ${} expressions means we don’t have to worry about nesting. The raw expressions are brittle in the sense that if I nest them in an additional group or repeat, they just silently fail. This can be pretty hard to troubleshoot. |
Yes ;). This bug is about translating ${node} syntax in an XPath expression when used inside square brackets. We're trying to make it easier for people to query complex data so they don't have to think about when to use |
Oops. Our messages crossed @lognaturel! |
I've created PR #524 that hopefully can fix this issue. Open to more suggestion, especially with test(s). Thanks. |
Additional tests for this feature: A
expected output: B
expected output: CI don't know if existing tests already cover this, but if not clear, it won't hurt to add these (with no changed behavior):
expected output: DI don't know if existing tests already cover this, but if not clear, it won't hurt to add these (with no changed behavior):
expected output: |
Software and hardware versions
All versions
Problem description
It's useful to manually write XPath expressions with predicates and it can be convenient to mix in
${}
references. For example, consider this form which looks up items in a repeat. The expressioninstance('item')/root/item[itemindex=current()/../item-counter]/label
would be convenient to write asinstance('item')/root/item[itemindex=${item-counter}]/label
. However, this would currently be expanded toinstance('item')/root/item[itemindex=../item-counter]/label
which is incorrect.Steps to reproduce the problem
Convert a form such as the one linked above. Notice that the expression in the predicate does not use
current()
.Expected behavior
All
${}
expressions in XPath predicates should expand usingcurrent()
. Alternately we could document that we don't allow using${}
references in XPath predicates.The text was updated successfully, but these errors were encountered: