title: Convert all XML elements without children to XML attributes of parent element
body: <p>Have the following xml input</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;EnvelopeType1&gt;
      &lt;Header&gt;
          &lt;User&gt;user1&lt;/User&gt;
          &lt;Password&gt;password&lt;/Password&gt;
      &lt;/Header&gt;
      &lt;CustomerNumber&gt;1&lt;/CustomerNumber&gt;
      &lt;CustomerName&gt;Me&lt;/CustomerName&gt;
      &lt;Address&gt;
          &lt;Number&gt;5&lt;/Number&gt;
          &lt;StreetName&gt;High St&lt;/StreetName&gt;
          &lt;State&gt;MI&lt;/State&gt;
      &lt;/Address&gt;
  &lt;/EnvelopeType1&gt;
  </code></pre>
  
  <p>And I need the following output after running it through an xslt:</p>
  
  <pre><code>&lt;EnvelopeType1 CustomerNumber="1" CustomerName="Me"/&gt;
      &lt;Header User="user1" Password="password"/&gt;
      &lt;Address Number="5" StreetName="High St" State="MI"/&gt;
  &lt;/EnvelopeType1&gt;
  </code></pre>
  
  <p>The root element may change to another type, and the contents inside the envelope may all change to different elements, etc, and also go several levels deep so I need something that can work generically.  There will never be existing attributes, its always going to be in elements, so there's no chance that a converted element will have the same name as an existing attribute.</p>
  
  <p>I'm thinking this will use apply-templates and somehow go recursively through the nodes, but I'm not that cluey on XSLT, would appreciate any help with this.</p>
  
  <p>There was another similar post here which I think would work, but requires XSLT2.0, I need something that would work with XSLT1.0</p>