Mapping Optional and Mandatory Elements

Using the Map Editor, you can map a number of combinations between optional and mandatory source and target elements. You can readily identify optional elements in your schemas as having defined cardinality.  {minOccurs} or {maxOccurs} properties appear in the schema nodes.

Note: To ensure that a target element contains data, assign a literal value when mapping optional source elements to mandatory target elements or use the Choose function.

To map optional and mandatory elements:

  1. Open the map activity icon in your project.

  2. Expand the schema icons in your map and align and size your schemas into a workable order. Guidelines

  1. To map a connection, drag the source element you want to map and drop it on the target element.
    If the connection is valid, a map link graphically connects the two.

Note: To modify the source or target element of the link, delete it and then re-establish the link. You cannot reattach the link to another element.

  1. In Properties, select one of the following Mapping Modes from the drop-down list:

for-each

value-of

copy-of

for-each-value-of

  1. To output a value inside a CDATA Section, set the Output as CDATA property to Yes. If your map requires that a source element value be output in an embedded XML CDATA Section, then set the Output as CDATA property to Yes.

  2. To save your changes, select File>Save mapName.map from the menu bar.
    When you save your map, the XSLT required to transform the source to target document is automatically generated.

  3. View the generated XSLT.

  4. Test your map.