getodk / getodk/xforms-spec

if() not described correctly

Open
#285 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
34
Forks
28
Avg merge
27m
Merged PRs (30d)
1

Description

The current ODK Collect and the old Enketo XPath evaluator does not convert the 2nd and 3rd parameter of `if()` to a string, i.e. it evaluates `if(false(), false(), false()) or false()` to "false".

The spec says both parameters should be converted to strings and thus the above expression would return "true". The new Enketo evaluator actually follows this spec, hence this issue was discovered. It actually evaluates `if(false(), "false", "false") or false()` which becomes `"false" or false()` and is `true`.

I think the spec should be corrected to accept any type as 2nd and 3rd parameter (even node-set so `count(if( true(), //a, //b))` would also work.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the specification text for if() alongside the behavior described for the ODK Collect, old Enketo, and new Enketo XPath evaluators. Verify the sample expressions and the proposed node-set case, then update the specification only if the comparison confirms the stated incompatibility and the accepted parameter types are decided.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.