You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type | name | constraint
----------------------------------------------------------
begin_repeat | rep |
text | A |
text | B | ${A} = 'something'
end_repeat | |
${a} in this case should become "../A" instead of "/data/rep/A" because the absolute "/data/rep/A" in pure un-hacked XPath always returns the value of the A node in the first repeat (even if the context is the 100th repeat).
The text was updated successfully, but these errors were encountered:
Glad to hear that! It would simplify enketo too as the workaround is messy and buggy.
There should be no reason to ever want absolute paths when referring to a node inside a repeat from another in the same repeat. I believe it's just something that happened long time ago in the early JavaRosa libs and was never corrected (so there are many forms out there that have these incorrect XPaths).
Now that I've thought about this a bit more, I've realized it's necessary to add some notion of scope to the pyxform so that the correct relative paths can be computed from ${variable}s to reference values nested at different levels. So, never-mind what I said about it simplifying things in pyxform, although I think variable scope might be nice to have.
Right, I can see that it gets more tricky with nested groups/repeats. I hope you'll come up with a way to do this, as it would be great to push this forward.
One day this will have to happen... so I'm putting this here. It relates to a long-standing javarosa bug: https://bitbucket.org/javarosa/javarosa/wiki/XFormDeviations#!model-item-property-xpaths-are-always-evaluated-in-the-context-of-the-nodeset. Seems like pyxforms could take the lead in starting to do this correctly! It will avoid the 'position-injection' hack that is currently required for evaluating absolute paths inside repeats, improve performance significantly for some forms, and reduce code ugliness.
${a} in this case should become "../A" instead of "/data/rep/A" because the absolute "/data/rep/A" in pure un-hacked XPath always returns the value of the A node in the first repeat (even if the context is the 100th repeat).
The text was updated successfully, but these errors were encountered: