title: Generate XSL (Denormalise format) for Nested XML
body: <p>I need to flatten my XML as the file size very huge and nested level, I am creating the XSL file manually. Below is my sample scenario of content of the XML file-</p>
  <pre><code>&lt;StudentDetail&gt;
    &lt;SchoolName&gt;SSHPS&lt;/SchoolName&gt;
    &lt;SchoolEstablishedYear&gt;1990&lt;/SchoolEstablishedYear&gt;
    &lt;ClassDetails&gt;
      &lt;ClassDetail&gt;
        &lt;ClassStartedYear&gt;1990&lt;/ClassStartedYear&gt;
        &lt;Section ID=&quot;12345&quot;&gt;
          &lt;SectioName&gt;Section A&lt;/SectioName&gt;
          &lt;Students&gt;
            &lt;Student ID=&quot;1&quot;&gt;
              &lt;StudentName&gt;John&lt;/StudentName&gt;
              &lt;Address&gt;
                &lt;HomeNumber&gt;10&lt;/HomeNumber&gt;
                &lt;StreetName&gt;Avenue&lt;/StreetName&gt;
              &lt;/Address&gt;
            &lt;/Student&gt;
            &lt;Student ID=&quot;2&quot;&gt;
              &lt;StudentName&gt;Steve&lt;/StudentName&gt;
            &lt;/Student&gt;
          &lt;/Students&gt;
        &lt;/Section&gt;
        &lt;Section ID=&quot;123456&quot;&gt;
          &lt;SectioName&gt;Section B&lt;/SectioName&gt;
          &lt;Students&gt;
            &lt;Student ID=&quot;100&quot;&gt;
              &lt;StudentName&gt;Dia&lt;/StudentName&gt;
              &lt;Age&gt;6&lt;/Age&gt;
            &lt;/Student&gt;
            &lt;Student ID=&quot;101&quot;&gt;
              &lt;StudentName&gt;Kevin&lt;/StudentName&gt;
            &lt;/Student&gt;
          &lt;/Students&gt;
        &lt;/Section&gt;
      &lt;/ClassDetail&gt;
      &lt;ClassDetail&gt;
        &lt;ClassStartedYear&gt;1995&lt;/ClassStartedYear&gt;
        &lt;Section ID=&quot;543466&quot;&gt;
          &lt;SectioName&gt;Section A&lt;/SectioName&gt;
          &lt;Students&gt;
            &lt;Student ID=&quot;200&quot;&gt;
              &lt;StudentName&gt;Dia&lt;/StudentName&gt;
              &lt;Muncipality&gt;
                &lt;AreaCode&gt;100&lt;/AreaCode&gt;
                &lt;Areaname&gt;GRAND&lt;/Areaname&gt;
              &lt;/Muncipality&gt;
            &lt;/Student&gt;
            &lt;Student ID=&quot;201&quot;&gt;
              &lt;StudentName&gt;Liva&lt;/StudentName&gt;
            &lt;/Student&gt;
          &lt;/Students&gt;
        &lt;/Section&gt;
        &lt;Section ID=&quot;7543466&quot;&gt;
          &lt;SectioName&gt;Section A&lt;/SectioName&gt;
          &lt;Students&gt;
            &lt;Student ID=&quot;300&quot;&gt;
              &lt;StudentName&gt;Zane&lt;/StudentName&gt;
            &lt;/Student&gt;
            &lt;Student ID=&quot;301&quot;&gt;
              &lt;StudentName&gt;Susan&lt;/StudentName&gt;
            &lt;/Student&gt;
          &lt;/Students&gt;
        &lt;/Section&gt;
      &lt;/ClassDetail&gt;
    &lt;/ClassDetails&gt;
  &lt;/StudentDetail&gt;
  </code></pre>
  <p>Below is the required format of the XML-</p>
  <pre><code>&lt;StudentDetail&gt;
      &lt;Student&gt;
          &lt;SchoolName&gt;SSHPS&lt;/SchoolName&gt;
          &lt;SchoolEstablishedYear&gt;1990&lt;/SchoolEstablishedYear&gt;
          &lt;ClassStartedYear&gt;1990&lt;/ClassStartedYear&gt;
          &lt;SectionID&gt;12345&lt;/SectionID&gt;
          &lt;SectioName&gt;Section A&lt;/SectioName&gt;
          &lt;StudentID&gt;1&lt;/StudentID&gt;
          &lt;StudentName&gt;John&lt;/StudentName&gt;
          &lt;Address_HomeNumber&gt;10&lt;/Address_HomeNumber&gt;
          &lt;Address_StreetName&gt;Avenue&lt;/Address_StreetName&gt;
          &lt;Age&gt; &lt;/Age&gt;
          &lt;Muncipality_AreaCode&gt;&lt;/Muncipality_AreaCode&gt;
          &lt;Muncipality_Areaname&gt;&lt;/Muncipality_Areaname&gt;
      &lt;/Student&gt;
     .
     .
     .
      &lt;Student&gt;
          &lt;SchoolName&gt;SSHPS&lt;/SchoolName&gt;
          &lt;SchoolEstablishedYear&gt;1990&lt;/SchoolEstablishedYear&gt;
          &lt;ClassStartedYear&gt;1995&lt;/ClassStartedYear&gt;
          &lt;SectionID&gt;7543466&lt;/SectionID&gt;
          &lt;SectioName&gt;Section A&lt;/SectioName&gt;
          &lt;StudentID&gt;100&lt;/StudentID&gt;
          &lt;StudentName&gt;Dia&lt;/StudentName&gt;
          &lt;Address_HomeNumber&gt;&lt;/Address_HomeNumber&gt;
          &lt;Address_StreetName&gt;&lt;/Address_StreetName&gt;
          &lt;Age&gt;&lt;/Age&gt;
          &lt;Muncipality_AreaCode&gt;100&lt;/Muncipality_AreaCode&gt;
          &lt;Muncipality_Areaname&gt;GRAND&lt;/Muncipality_Areaname&gt;
      &lt;/Student&gt;
  &lt;/StudentDetail&gt;
  </code></pre>
  <p>I have generated the XSL template, I am not able to load this as there is some error within this-</p>
  <pre><code>&lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;&gt;
  &lt;xsl:output indent=&quot;yes&quot; method=&quot;xml&quot;/&gt;
  &lt;xsl:template match=&quot;/&quot;&gt;
      &lt;StudentDetail&gt;
          &lt;xsl:for-each select=&quot;StudentDetail/ClassDetails&quot;&gt;
           &lt;Student&gt;
              &lt;SchoolName&gt;&lt;xsl:value-of select=&quot;StudentDetail/SchoolName&quot;/&gt;&lt;/SchoolName&gt;
              &lt;SchoolEstablishedYear&gt;&lt;xsl:value-of select=&quot;StudentDetail/SchoolEstablishedYear&quot;/&gt;&lt;/SchoolEstablishedYear&gt;
              &lt;ClassStartedYear&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/ClassStartedYear&quot;/&gt;&lt;/ClassStartedYear&gt;
              &lt;StudentID&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/Section/@ID&quot;/&gt;&lt;/StudentID&gt;
              &lt;SectioName&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/SectionName&quot;/&gt;&lt;/SectioName&gt;
              &lt;StudentID&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student/@ID&quot;/&gt;&lt;/StudentID&gt;
              &lt;StudentName&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student&quot;/&gt;&lt;/StudentName&gt;
              &lt;Address_HomeNumber&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student/Address/HomeNumber&quot;/&gt;&lt;/Address_HomeNumber&gt;
              &lt;Address_StreetName&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student/Address/StreetName&quot;/&gt;&lt;/Address_StreetName&gt;
              &lt;Age&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student/Age&quot;/&gt;&lt;/Age&gt;
              &lt;Muncipality_AreaCode&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student/Muncipality/AreaCode&quot;/&gt;&lt;/Muncipality_AreaCode&gt;
              &lt;Muncipality_Areaname&gt;&lt;xsl:value-of select=&quot;StudentDetail/ClassDetails/ClassDetail/Section/Students/Student/Muncipality/Areaname&quot;/&gt;&lt;/Muncipality_Areaname&gt;
           &lt;/Student&gt;
          &lt;/xsl:for-each&gt;
      &lt;/StudentDetail&gt;       
  &lt;/xsl:template&gt;
  
  </code></pre>
  <p>I am new to handling the XML, I am stuck with handling the nested XML</p>