title: XSLT: element that has no attributes and no children transform to parent attribute
body: <p>The structure, names, values of the given .xml files is unknown.</p>
  
  <p>For every not-root element that has simple structure(has no child-nodes, has no attributes, BUT has text and is not empty) transform it into parent's attribute.</p>
  
  <p>I have .xml file:   </p>
  
  <pre><code>&lt;list&gt;
     &lt;worker&gt;
        &lt;name atr="ss"&gt;val1&lt;/name&gt;
     &lt;/worker&gt;
     &lt;worker&gt;
        &lt;make1&gt;val2&lt;/make1&gt;
     &lt;/worker&gt;
     &lt;worker&gt;
        &lt;name&gt;
          &lt;make2&gt;val3&lt;/make2&gt;
        &lt;/name&gt;
     &lt;/worker&gt;
     &lt;worker&gt;
        &lt;name&gt;
          &lt;doo atr="ss1"&gt;val4&lt;/doo&gt;
          &lt;make3&gt;&lt;/make3&gt;
        &lt;/name&gt;
     &lt;/worker&gt;
  &lt;/list&gt;
  </code></pre>
  
  <p>And I want to get this:</p>
  
  <pre><code>&lt;list&gt;
     &lt;worker&gt;
        &lt;name atr="ss"&gt;val1&lt;/name&gt;
     &lt;/worker&gt;
     &lt;worker make1="val2"/&gt;
     &lt;worker&gt;
        &lt;name make2="val3"/&gt;
     &lt;/worker&gt;
     &lt;worker&gt;
        &lt;name&gt;
          &lt;doo atr="ss1"&gt;val4&lt;/doo&gt;
          &lt;make3/&gt;
        &lt;/name&gt;
     &lt;/worker&gt;
  &lt;/list&gt;
  </code></pre>
  
  <p>Here is my .xsl for now (doesn't work correctly):</p>
  
  <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
      &lt;xsl:output indent="yes" method="xml"/&gt;
      &lt;xsl:template match="@*|node()"&gt;
        &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
        &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="//*[not(*|@*)]"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:attribute name="{name()}"&gt;
                  &lt;xsl:value-of select="text()"/&gt;
              &lt;/xsl:attribute&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>