Strange, but I see no reason this wouldn't work. Each element is being discriminated by whether the current population of the array at the time it is parsed, is <= 5.
At parse time, fn:count returns the current number of elements in the array. on Daffodil I believe this will be 1 for the first element, not 0, because Daffodil will have speculatively attached the element to the array, and then be proceding to try to parse the child. That may be the rub. The DFDL spec doesn't really say what the value of fn:count() is when used in an expression within an array element itself. ________________________________ From: Costello, Roger L. <[email protected]> Sent: Tuesday, October 8, 2019 11:20 AM To: [email protected] <[email protected]> Subject: Can an array count itself? Hello DFDL community, Can an array count itself? Like this: <xs:element name="name" type="xs:string" maxOccurs="unbounded"> <xs:annotation> <xs:appinfo source="http://www.ogf.org/dfdl/"> <dfdl:discriminator test="{ fn:count(.) le 5 }" /> </xs:appinfo> </xs:annotation> </xs:element>
