Open
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`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ELEMENT root (foo+)>
<!ELEMENT foo (bar)>
<!ELEMENT bar (#PCDATA)>
<!ATTLIST foo name ID #REQUIRED>
]>
<root>
<foo name="first">
<bar>Some content</bar>
</foo>
<foo name="second">
<bar>Another content</bar>
</foo>
</root>
`;
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.
Metadata
Metadata
Assignees
Type
Projects
Status
Todo