getodk / getodk/web-forms

`id` function is not compliant to the spec

Open
#176 1 comment 0 reactions 0 assignees View on GitHub
@odk/xpath documentation
Dominant language
TypeScript
Stars
38
Forks
22
PR merge metrics
No merged PRs in 30d

Description

As per the spec, `id` function selects elements by their unique ID and attribute for unique ID is declared using DTD.

Q. If no DTD is defined then is `id` attribute implicitly considered as unique ID of the element node?

Following test fails, because we are not handling DTD at this moment, right?

```
it.only('adhoc tests', () => {
const testDocument = xml`




]>


Some content


Another content


`;
const evaluator = new Evaluator({rootNode: testDocument});

const actual = evaluator.evaluate(`count(id('first second'))`);

expect(actual.numberValue).toBe(2);
})
```

This issue probably just needs documentation.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the supplied adhoc test and trace Evaluator.evaluate for the XPath id() call. Check the cited specification and the project's current DTD handling; done means documenting whether id attributes require DTD declarations and clarifying the expected result for this test.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.