Here's a sketch of my XML file:
<file recordCount="n">
<record/>
<record/>
<record/> <!-- ...etc... -->
</file>
I made the XML Schema (version 1.1) assert on the file
element that the @recordCount
(a positive integer) must equal the calculated number of record
elements contained in file
.
Here's the best I could come up with:
test="count(record) eq @recordCount"
This is currently failing the test XML file whatever I put in @recordCount
(given a nonZeroInteger
) and however many (valid) record
elements I have...
I assume I'm missing something really basic here like a node path or the type of the 2 variables to compare in the test
?
Possibly related: XSD 1.1 Assert to Count and Compare Elements
This XPath is correct. It's now behaving as expected in the IDE. If I learn why it was not validating correctly I'll update the question.