title: I'm having issues transforming an XML to another XML using XSLT
body: <p>I'm kind of a beginner in xml and at the moment i'm working on transforming an XML to another XML using XSLT. However i can't figure out why it's not working at the moment. I would love it if you could explain the issue here.</p>
  
  <p>Here's my XMLFile1.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="XSLTFile1.xslt"?&gt;
  
  &lt;School
  xmlns="http://www.w3schools.com"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.w3schools.com XMLSchema1.xsd"&gt;
  
  
    &lt;NameOfSchool&gt;FCB&lt;/NameOfSchool&gt;
  
    &lt;Child&gt;
  
      &lt;FirstName&gt;Sally&lt;/FirstName&gt;
      &lt;LastName&gt;Johnson&lt;/LastName&gt;
      &lt;P-Number&gt;1008021245&lt;/P-Number&gt;
  
  
      &lt;Sibling&gt;
        &lt;P-Number&gt;0005052464&lt;/P-Number&gt;
        &lt;FirstName&gt;Art&lt;/FirstName&gt;
        &lt;LastName&gt;Vandelay&lt;/LastName&gt;
  
      &lt;/Sibling&gt;
  
      &lt;Other&gt;
  
        &lt;Allergies&gt;No&lt;/Allergies&gt;
        &lt;AMS&gt;No&lt;/AMS&gt;
  
  
      &lt;/Other&gt;
  
    &lt;/Child&gt;
  
  
  
    &lt;Parent1&gt;
  
      &lt;FirstName&gt;H.E&lt;/FirstName&gt;
      &lt;LastName&gt;Pennypecker&lt;/LastName&gt;
      &lt;P-Number&gt;7806032356&lt;/P-Number&gt;
      &lt;Adress&gt;4 Yawkey Way Boston, Massachusetts 02215&lt;/Adress&gt;
  
  
      &lt;Contact&gt;
  
        &lt;Phone&gt;
          &lt;Work&gt;0522375796&lt;/Work&gt;
          &lt;Home&gt;0522597068&lt;/Home&gt;
        &lt;/Phone&gt;
  
      &lt;/Contact&gt;
  
  
    &lt;/Parent1&gt;
  
  
    &lt;Parent2&gt;
  
      &lt;FirstName&gt;Kel&lt;/FirstName&gt;
      &lt;LastName&gt;Varnsen&lt;/LastName&gt;
      &lt;P-Number&gt;7806089645&lt;/P-Number&gt;
      &lt;Adress&gt;1 East 161st Street Bronx, New York City, New York 10451&lt;/Adress&gt;
  
      &lt;Contact&gt;
  
        &lt;Phone&gt;
          &lt;Work&gt;0522596847&lt;/Work&gt;
          &lt;Home&gt;0522597068&lt;/Home&gt;
        &lt;/Phone&gt;
  
      &lt;/Contact&gt;
  
    &lt;/Parent2&gt;
  
  
  &lt;/School&gt;
  </code></pre>
  
  <p>And here is my XSLTFile1.xslt</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"&gt;
    &lt;xsl:output method="html" indent="yes"/&gt;
  
    &lt;xsl:template match="Parent1"&gt;
        &lt;BGI&gt;
          &lt;Parent1&gt;
            &lt;P-Number&gt;
              &lt;xsl:value-of select="P-Number"/&gt;
            &lt;/P-Number&gt;
            &lt;FirstName&gt;
              &lt;xsl:value-of select="FirstName"/&gt;
            &lt;/FirstName&gt;
            &lt;LastName&gt;
              &lt;xsl:value-of select="LastName"/&gt;
            &lt;/LastName&gt;
          &lt;/Parent1&gt;
  
        &lt;/BGI&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="Parent2"&gt;
      &lt;BGI&gt;
        &lt;Parent2&gt;
          &lt;P-Number&gt;
            &lt;xsl:value-of select="P-Number"/&gt;
          &lt;/P-Number&gt;
          &lt;FirstName&gt;
            &lt;xsl:value-of select="FirstName"/&gt;
          &lt;/FirstName&gt;
          &lt;LastName&gt;
            &lt;xsl:value-of select="LastName"/&gt;
          &lt;/LastName&gt;
        &lt;/Parent2&gt;
  
      &lt;/BGI&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>What i want is the new XML Document to look like this:</p>
  
  <pre><code>&lt;BGI&gt;
    &lt;Parent1&gt;
      &lt;P-Number&gt;7806032356&lt;/P-Number&gt;
      &lt;FirstName&gt;H.E&lt;/FirstName&gt;
      &lt;LastName&gt;Pennypecker&lt;/LastName&gt;
    &lt;Parent1&gt;
  
     &lt;Parent2&gt;
      &lt;P-Number&gt;7806089645&lt;/P-Number&gt;
      &lt;FirstName&gt;Kel&lt;/FirstName&gt;
      &lt;LastName&gt;Varnsen&lt;/LastName&gt;
    &lt;Parent2&gt;
  &lt;/BGI&gt;
  </code></pre>