title: How to transform XML using XSLT?
body: <p>I've got a XML with this structure:</p>
  
  <pre><code>&lt;entities&gt;
      &lt;entity&gt;
          &lt;field&gt;13&lt;/field&gt;
      &lt;/entity&gt;
      &lt;entity&gt;
          &lt;field&gt;1&lt;/field&gt;
      &lt;/entity&gt;
      &lt;entity&gt;
          &lt;field&gt;5&lt;/field&gt;
      &lt;/entity&gt;
  &lt;/entities&gt;
  </code></pre>
  
  <p>and I need to transform it to that structure using XSLT:</p>
  
  <pre><code>&lt;entities&gt;
      &lt;entity field="13"/&gt;
      &lt;entity field="1"/&gt;
      &lt;entity field="5"/&gt;
  &lt;/entities&gt;
  </code></pre>
  
  <p>That's my XSLT for now:</p>
  
  <pre><code> &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="field/text()"&gt;
          &lt;xsl:value-of select="concat('&amp;quot;', ., '&amp;quot;')"/&gt;
      &lt;/xsl:template&gt;
  </code></pre>
  
  <p>I'm stuck with transforming <code>&lt;field&gt;</code> into entity's attribute. How to do that?</p>