
If I understand the example correctly, you have added 'payloadLength' to the infoset as a convenience to the user, but at the same time you are referencing it from the 'payload' element's dfdl:length property. Your example could be changed to use the 'length' element instead: <element name="length" type="xs:int" dfdl:outputValueCalc="{ dfdl:contentLength(../payload) + 20 }"> <element name="payloadLength" type="xs:int" dfdl:inputValueCalc="{ ../length - 20 }" /> <element name="payload" dfdl:length="{ ../length - 20 }"> <complexType>.....</complexType> </element> If we allow both input & output value calc on a element, it is saying that on unparsing the element's value in the infoset is ignored, and its value never appear in the data. So it's a place to hold a transient value, don't we have variables for that? Regards Steve Hanson IBM Integration Bus, Hursley, UK Architect, IBM DFDL Co-Chair, OGF DFDL Working Group smh@uk.ibm.com tel:+44-1962-815848 mob:+44-7717-378890 From: Mike Beckerle <mbeckerle.dfdl@gmail.com> To: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org> Date: 19/07/2016 18:49 Subject: [DFDL-WG] Need dfdl:inputValueCalc and dfdl:outputValueCalc on same element Sent by: "dfdl-wg" <dfdl-wg-bounces@ogf.org> So in PCAP format we find something like this: <element name="length" type="xs:int" dfdl:outputValueCalc="{ dfdl:contentLength(../payload) + 20 }"> <element name="payloadLength" type="xs:int" dfdl:inputValueCalc="{ ../length - 20 }" /> <element name="payload" dfdl:length="{ ../payloadLength }"> <complexType>.....</complexType> </element> To make this unparse we really need the payloadLength element to carry both an IVC and an OVC. Otherwise when unparsing the dfdl:length expression on the payload element can't be meaningful. We have an erratum that states that length expressions are always re-evaluated when unparsing, so as to produce a target length that can be used to insert padding/fillByte. However, the spec currently says you cannot have both IVC and OVC on the same element. I do not recall why we have this restriction, other than trying to prohibit things we didn't think were necessary, but it seems in this situation to be needed. Comments? Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy -- dfdl-wg mailing list dfdl-wg@ogf.org https://www.ogf.org/mailman/listinfo/dfdl-wg Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU