Context Sample

How to:

Reference:

The goal of the context example is to produce the exact same output as the input. That is why the input and output structures are the same. The looping of the input data adds complexity to this project, which can be resolved by setting the context property.


Top of page

x
Procedure: How to Set the Context Property

To set the context property:

  1. Create a new Transform project.
  2. Import a Transform Template (.xch) file.
  3. Load the Input Structure.
  4. Click the Mappings tab.
  5. Click Test Transform to view the output.

    Group b has child element c with mapping path set to a/b/c.

    This path has two "b" group loop iterations in the input. These iterations are different because the values for the attribute, "name," are different.

    By default, Transformer’s engine does not recognize that the "b" group loop iterations are different. These iterations are treated as the same because their path location in the document, noted as “a/b”, is the same. To avoid an unexpected result, you must specify that the input node (“a/b”) has different loop instances by setting the "Context" property of the group node.

  6. Right-click the b group node and select Properties.

    The Output Node Properties dialog box opens.

  7. In the Context field, specify the path value for the looping node on the input side, which is a/b.

    With these settings you are specifying the looping order for the Transformer’s engine to produce the output tree structure correctly. iWay Transformer’s engine is now aware which "c" node belongs to which "b" node in the context of their loop instances.


Top of page

x
Reference: Sample Context Input File

The following is a sample context input file.

- <a> 
  - <b name="b1"> 
     <c>value of input element a/b@name=b1/c is 1</c> 
     <c>value of input element a/b@name=b1/c is 2</c> 
    </b> 
  - <b name="b2"> 
     <c>value of input element a/b@name=b2/c is 3</c> 
     <c>value of input element a/b@name=b2/c is 4</c> 
    </b> 
</a>

iWay Software