Description
Full example attached demonstrating the round trip behaviour of schema.dfdl.xsd.
Relevent schema is:
<xs:sequence>
<xs:element name="zero" type="xs:int" dfdl:length="8" dfdl:outputValueCalc="{ ../body/zero }"
dfdl:bitOrder="mostSignificantBitFirst" dfdl:byteOrder="bigEndian"
/>
<xs:element name="body" dfdl:lengthKind="implicit">
<xs:complexType>
<xs:sequence>
<xs:element name="a" type="xs:int" dfdl:length="4"/>
<xs:element name="b" type="xs:int" dfdl:length="4" dfdl:outputValueCalc="{ ../zero }"/>
<xs:element name="zero" type="xs:int" dfdl:inputValueCalc="{ 0 }"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
Note that there are 2 suspensions involved in unparsing the above. The first byte, and second nimble of the second byte both suspend until the last element is computed.
Also note that the bit-order changes between byte 1 and 2.
Given the input:
<tns:root xmlns:tns="urn:example">
<zero>0</zero>
<body>
<a>2</a>
<b>0</b>
<zero>0</zero>
</body>
</tns:root>
We expect unparse to reproduce input.bin exactly:
00 02
But instead see:
00 00
As if something is clobbering the value of <a>