title: Sorting XPath results in the same order as multiple select parameters
body: <p>I have an XML document as follows:</p>
  
  <pre><code>&lt;objects&gt;
    &lt;object uid="0" /&gt;
    &lt;object uid="1" /&gt;
    &lt;object uid="2" /&gt;
  &lt;/objects&gt;
  </code></pre>
  
  <p>I can select multiple elements using the following query:</p>
  
  <pre><code>doc.xpath("//object[@uid=2 or @uid=0 or @uid=1]")
  </code></pre>
  
  <p>But this returns the elements in the same order they're declared in the XML document (uid=0, uid=1, uid=2) and I want the results in the same order as I perform the XPath query (uid=2, uid=0, uid=1).</p>
  
  <p>I'm unsure if this is possible with XPath alone, and have looked into XSLT sorting, but I haven't found an example that explains how I could achieve this.</p>
  
  <p>I'm working in Ruby with the Nokogiri library.</p>