title: How to sort an xml file by attribute value in xslt?
body: <p>I want to sort an xml file by the attribute value "class" of the  element "entity". In output I want to keep the same structure of my input xml,
  Here a part of my xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
      version="1.0"&gt;
  &lt;entity class="entityZ" metadata-complete="false"&gt;
  &lt;table name="F_ENTITYZ"&gt;
  &lt;unique-constraint&gt;
  &lt;column-name&gt;column1&lt;/column-name&gt;
  &lt;/unique-constraint&gt;
  &lt;unique-constraint&gt;
  &lt;column-name&gt;column2&lt;/column-name&gt;
  &lt;/unique-constraint&gt;
  &lt;/table&gt;
  &lt;sequence-generator name="SEQUENCEZ_" sequence-name="F_SEQUENCEZ_" allocation-size="1" initial-value="1"/&gt;
  &lt;attributes&gt;
  &lt;/attributes&gt;
  &lt;/entity&gt;
  &lt;entity class="entityA" metadata-complete="false"&gt;
  &lt;table name="F_ENTITYA"&gt;
  &lt;unique-constraint&gt;
  &lt;column-name&gt;column1&lt;/column-name&gt;
  &lt;/unique-constraint&gt;
  &lt;/table&gt;
  &lt;sequence-generator name="SEQUENCEA_" sequence-name="F_SEQUENCEA_" allocation-size="1" initial-value="1"/&gt;
  &lt;attributes&gt;
  &lt;/attributes&gt;
  &lt;post-persist method-name="traceHistory"/&gt;
  &lt;post-update method-name="traceHistory"/&gt;
  &lt;/entity&gt;
  &lt;entity class="entityB" metadata-complete="false"&gt;
  &lt;table name="F_ENTITYB"&gt;
  &lt;unique-constraint&gt;
  &lt;column-name&gt;column1&lt;/column-name&gt;
  &lt;/unique-constraint&gt;
  &lt;/table&gt;
  &lt;sequence-generator name="SEQUENCEB_" sequence-name="F_SEQUENCEB_" allocation-size="1" initial-value="1"/&gt;
  &lt;attributes&gt;
  &lt;/attributes&gt;
  &lt;/entity&gt;
  &lt;/entity-mappings&gt;
  </code></pre>
  
  <p>Waiting for your help ...</p>