title: XML order by Attribute
body: <p>I have googled around and tried to find an answer to this, but none of the solutions seem to work.
  I have the following xml schema:</p>
  
  <pre><code>&lt;xml&gt;
    &lt;race&gt;
      &lt;particpant time="3.25" name="joe blogs"&gt;
      &lt;particpant time="1.15" name="john Doe"&gt;
      &lt;particpant time="2.0" name="A random"&gt;
    &lt;/race&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p>I then attempt the following transformation in xslt:</p>
  
  <pre><code>&lt;ul&gt;
     &lt;xsl:for-each select="participant"&gt;
     &lt;xsl:sort  order="ascending" select="@time"/&gt;
       &lt;li&gt; &lt;xsl:value-of select="@name"/&gt; (&lt;xsl:value-of select="@time"/&gt;)&lt;/li&gt;
     &lt;/xsl:for-each&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>The loop works and pulls out each participant, but the sort ordering has a weird effect, it switches positions around but not necessarily ordering them into the correct order.</p>
  
  <p>Can anyone point me in the right direction. </p>
  
  <p>BTW The code above is a stripped back version of my code and with dummy data as the actual file is larger and more complex.</p>
  
  <p>Thanks in advance</p>
  
  <p>John</p>