Flattening the Output Structure

The normal ANSI X12 looping structure for an ASN consists of a header, a looping detail (HL) and a trailer section. The example actually consists of an embedded looping structure, Orders within Shipments, Packs within Orders, and Items within Packs. The technique discussed previously creates this looping structure, but also causes the output XML to come out in a normalized or flattened state.

A typical XML to XML transformation will produce embedded SG0/HL structure. One-to-one mapping to EDI structure is not possible.

In order to produce flat SG0/HL structure but still keep the embedded structure for calculation of HL IDs, you can update XML to XML mappings to use the invisible group method to have subsequent SG0 on the same level.

This will produce flat SG0/HL structure.

This is an illustration of how your loops may appear: