Automatically Create for-each Statements

You can automatically create for-each statements when mapping between repeatable source and target elements in the mapper.

To automatically create for-each statements:
  1. In the Source section, identify the repeatable source and target elements to which to map. Repeatable elements are identified by the Repeatable elements icon icon to the left of the name. When you right-click these elements and select Node Info, Repeating: true is displayed in the message details about the element.
  2. In the Source section, map the child repeatable element to the child target repeatable element. You cannot map repeatable elements to nonrepeatable elements.

    In the upper left are the designer, code, and test links, Below this is the Sources data structure. To the right is the Mapping Canvas section. To the right is the Target data structure. Above the Target data structure are the developer, XSLT, view, filter, previous, redo, maximize, and function links.

    The mapper creates a for-each statement to loop through the source Relationship element and place the mapping into the target Organization element. This statement does not include a value to select because parent elements do not typically contain attributes to map.

  3. Click Code to view the for-each statement.
    <xsl:for-each xml:id="id_37" select="$stageRead/nsmpr2:ReadResponse/ns21:recordset/ns21:record">
       <nstrgmpr:bike_c xml:id="id_38">
             <ns23:color xml:id="id_39">
               <xsl:value-of xml:id="id_40" select="ns21:color"/>
             </ns23:color>
             <ns23:bike xml:id="id_41">
                <xsl:value-of xml:id="id_42" select="ns21:bike"/>
             </ns23:bike>
             <ns23:name xml:id="id_43">
                <xsl:value-of xml:id="id_44" select="ns21:name"/>
             </ns23:name>
             <ns23:region xml:id="id_47">
                <xsl:value-of xml:id="id_48" select="ns21:region"/>
             </ns23:region>
             <ns23:lEAD xml:id="id_45">
                <xsl:value-of xml:id="id_46" select="ns21:lEAD"/>
             </ns23:lEAD>
          </nstrgmpr:bike_c>
       </xsl:for-each>