Grouping elements

Grouping enables you to restructure data by splitting it into groups. The element or attribute that you choose as the base of your group is called the 'key'.

For example, if you have the following list of students and the courses they are taking:

Student Courses
Alyssa French, English
Ben Latin, Science
Cy Latin, French

This is the chart as shown in XML:

<?xml version="1.0" encoding="UTF-8"?>
 <school>
 <student name="Alyssa">
 <course>French</course>
  <course>English</course>
 </student>
 <student name="Ben">
 <course>Latin</course>
 <course>Science</course> 
</student>
 <student name="Cy">
 <course>Latin</course>
<course>French</course>
</student>
</school>   

but would prefer to list all of the students in a particular course, you could divide students into groups based on the courses they take. The course name is the 'key':

Course Student
French Alyssa
Latin Ben, Cy
English Alyssa
Science Ben

This is the chart as shown in XML:

<?xml version="1.0" encoding="UTF-8"?>
<school>
<course name="French"> 
<student name="Alyssa"/> 
<student name="Cy"/> 
</course> 
<course name="Latin"> 
<student name="Ben"/> 
 <student name="Cy"/>
</course> 
 <course name="English">
<student name="Alyssa"/>
</course> 
<course name="Science">
<student name="Ben"/> 
 </course>
</school>

 

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

To create a grouping,...

  1. Open your mapping in the XML to XML editor.

  2. Map the source and target nodes as appropriate.

  3. Click Mapping > Define Grouping.

  4. Select the appropriate key and click Finish.

  5. The grouping will now appear in the Overview pane next to the corresponding mapping.

 

Parent topic

Editing an XML to XML mapping