title: How can I rewrite this xquery to remove a subnode without rewriting this entire query?
body: <p>Here is the xquery that works on this xml files.</p>
  
  <pre><code>&lt;results&gt;
    {
      for $depen in doc("../company/dependent.xml")//dependent
      where $depen/dependent_name=*
      return
       &lt;row&gt;
       &lt;dependent name="{$depen/dependent_name}"/&gt;
        {
          for $emp in doc("../company/employee.xml")//employee[ssn = $depen/essn ]
          return
  
          &lt;employee&gt;
  
          &lt;emp fname="{$emp/fname}" lname="{$emp/lname}"/&gt;
                {
                for $man in doc("../company/employee.xml")//employee[ssn = $emp/superssn ]
                return
                &lt;manager&gt;
  
                &lt;mgr fname="{$man/fname}" lname="{$man/lname}"/&gt;             
  
                &lt;/manager&gt;
               }              
          &lt;/employee&gt; 
        } 
       &lt;/row&gt;   
    }
  &lt;/results&gt;
  </code></pre>
  
  <p>It produces the output below. </p>
  
  <pre><code>&lt;results&gt;
    &lt;row&gt;
      &lt;dependent name="Alice"/&gt;
      &lt;employee&gt;
        &lt;emp fname="John" lname="Smith"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;dependent name="Elizabeth"/&gt;
      &lt;employee&gt;
        &lt;emp fname="John" lname="Smith"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;dependent name="Michael"/&gt;
      &lt;employee&gt;
        &lt;emp fname="John" lname="Smith"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;dependent name="Alice"/&gt;
      &lt;employee&gt;
        &lt;emp fname="Franklin" lname="Wong"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="James" lname="Borg"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;dependent name="Joy"/&gt;
      &lt;employee&gt;
        &lt;emp fname="Franklin" lname="Wong"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="James" lname="Borg"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;dependent name="Theodore"/&gt;
      &lt;employee&gt;
        &lt;emp fname="Franklin" lname="Wong"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="James" lname="Borg"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;dependent name="Abner"/&gt;
      &lt;employee&gt;
        &lt;emp fname="Jennifer" lname="Wallace"/&gt;
        &lt;manager&gt;
          &lt;mgr fname="James" lname="Borg"/&gt;
        &lt;/manager&gt;
      &lt;/employee&gt;
    &lt;/row&gt;
  &lt;/results&gt;
  </code></pre>
  
  <p>How do I remove the employee and manager tags in the final result so it looks more like this below.</p>
  
  <pre><code>   &lt;results&gt;
        &lt;row&gt;
          &lt;dependent name="Alice"/&gt;
          &lt;emp fname="John" lname="Smith"/&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/row&gt;
        &lt;row&gt;
          &lt;dependent name="Elizabeth"/&gt;
          &lt;emp fname="John" lname="Smith"/&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/row&gt;
        &lt;row&gt;
          &lt;dependent name="Michael"/&gt;
          &lt;emp fname="John" lname="Smith"/&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/row&gt;
        &lt;row&gt;
          &lt;dependent name="Alice"/&gt;
          &lt;emp fname="Franklin" lname="Wong"/&gt;
          &lt;mgr fname="Franklin" lname="Wong"/&gt;
        &lt;/row&gt;
        &lt;row&gt;
  </code></pre>
  
  <p>... and so on and so forth.</p>
  
  <p>I just need to know how to rewrite the final xquery to remove the need for employee and manager node in the final result but still keep the value.</p>