Hello DFDL community,

My DFDL schema has this array:

<xs:element name="Section_Header"
                   maxOccurs="unbounded"
                  dfdl:occursCountKind="expression"
                   
dfdl:occursCount="{../../Headers/File_Header/Number_of_Sections_in_the_Section_Table}">

Each <Section_Header> element contains information about a following <Section> 
element.

Later in the schema is an array of <Section> elements. The array must have the 
same number of elements as Section_Header. I can easily specify the number of 
occurrences of this second array:

<xs:element name="Section"
                   maxOccurs="unbounded"
                   dfdl:occursCountKind="expression"
                   dfdl:occursCount="{ fn:count(../Section_Header) }">

I would like to reference elements within <Section_Header>. For example, there 
is a <Size_of_Raw_Data> element that I would like to use:

If the i'th <Section_Header> element has
               <Size_of_Raw_Data>100</Size_of_Raw_Data>,
               then the i'th <Section> element must have a
               size of 100 bytes.

How does the i'th <Section> element refer to the i'th <Section_Header> element? 
 I think that I need something like this:

<xs:element name="Section"
                   maxOccurs="unbounded"
                   dfdl:occursCountKind="expression"
                   dfdl:occursCount="{ fn:count(../Section_Header) }"
                    type="xs:hexBinary"
                    dfdl:lengthKind="explicit"
                    dfdl:lengthUnits="bytes"
                    dfdl:length="../Section_Header[i]/Size_of_Raw_Data"/>

Of course, the above value of dfdl:length is not correct, as [i] is not 
defined. So, how to do this?

/Roger

Reply via email to