title: Looping and concatenating parent child node in XSLT
body: <p>I have a xml looks like this :</p>
  
  <pre><code>&lt;School&gt;
  &lt;Class&gt;
      &lt;Student1&gt;Student1&lt;/Student1&gt;
  &lt;/Class&gt;
  &lt;Major&gt;
      &lt;Name1&gt;Name1&lt;/Name1&gt;    
      &lt;List&gt;
          &lt;Title1&gt;Title1&lt;/Title1&gt;
      &lt;/List&gt;
      &lt;List&gt;
          &lt;Title2&gt;Title2&lt;/Title2&gt;
      &lt;/List&gt;
  &lt;/Major&gt;
  &lt;Class&gt;
      &lt;Student2&gt;Student2&lt;/Student2&gt;
  &lt;/Class&gt;
  &lt;Major&gt;
      &lt;Name2&gt;Name2&lt;/Name2&gt;    
      &lt;List&gt;
          &lt;Title3&gt;Title3&lt;/Title3&gt;
      &lt;/List&gt;
      &lt;List&gt;
          &lt;Title4&gt;Title4&lt;/Title4&gt;
      &lt;/List&gt;
  &lt;/Major&gt;&lt;/School&gt;
  </code></pre>
  
  <p>The Class &amp; Major's node have many sequences. I typed in 2 sample for each. The 1st Class will be join with the 1st Major and List node will be split by looping the Class &amp; Major's node. It will occurs for the 2nd Class &amp; 2nd Major and the rest.</p>
  
  <p>And here's the desired output I want :</p>
  
  <pre><code>&lt;School&gt;
  &lt;Class&gt;
      &lt;Student1&gt;Student1&lt;/Student1&gt;
      &lt;Name1&gt;Name1&lt;/Name1&gt;
      &lt;List&gt;
          &lt;Title1&gt;Title1&lt;/Title1&gt;
      &lt;/List&gt;
  &lt;/Class&gt;
  &lt;Class&gt;
      &lt;Student1&gt;Student1&lt;/Student1&gt;
      &lt;Name1&gt;Name1&lt;/Name1&gt;
      &lt;List&gt;
          &lt;Title2&gt;Title2&lt;/Title2&gt;
      &lt;/List&gt;
  &lt;/Class&gt;    
  &lt;Class&gt;
      &lt;Student2&gt;Student2&lt;/Student2&gt;
      &lt;Name2&gt;Name2&lt;/Name2&gt;
      &lt;List&gt;
          &lt;Title3&gt;Title3&lt;/Title3&gt;
      &lt;/List&gt;
  &lt;/Class&gt;
      &lt;Class&gt;
      &lt;Student2&gt;Student2&lt;/Student2&gt;
      &lt;Name2&gt;Name2&lt;/Name2&gt;
      &lt;List&gt;
          &lt;Title4&gt;Title4&lt;/Title4&gt;
      &lt;/List&gt;
  &lt;/Class&gt;&lt;/School&gt;
  </code></pre>
  
  <p>How I can transform my XML into desired output?</p>