title: How to get the last records that match a specific element value using xslt?
body: <p>I have an xml with a list of cars  records that look like this</p>
  <pre><code> &lt;Car&gt;
      &lt;color&gt;red&lt;/color&gt;
      &lt;type&gt;toyota&lt;/type&gt;
     &lt;status&gt;done&lt;/status&gt;
    &lt;/Car&gt;
    &lt;Car&gt;
      &lt;color&gt;green&lt;/color&gt;
      &lt;type&gt;mazda&lt;/type&gt;
      &lt;status&gt;done&lt;/status&gt;
    &lt;/Car&gt;
    &lt;Car&gt;
      &lt;color&gt;yellow&lt;/color&gt;
      &lt;type&gt;ford&lt;/type&gt;
    &lt;status&gt;working&lt;/status&gt;
    &lt;/Car&gt;
    &lt;Car&gt;
      &lt;color&gt;green&lt;/color&gt;
      &lt;type&gt;mazda&lt;/type&gt;
      &lt;status&gt;pending&lt;/status&gt;
    &lt;/Car&gt;
  </code></pre>
  <p>I'm currently  getting the last Car records like this</p>
  <pre><code>&lt;Cars&gt;
        &lt;Car&gt; 
            &lt;xsl:copy-of select=&quot;//Car[last()]&quot;/&gt;
        &lt;/Car&gt;       
    &lt;/Cars&gt;
  </code></pre>
  <p>I want to see if is possible to get the last car records that match my element value</p>
  <p>Example</p>
  <p>From the xml example above I want to get the last car records that doesn't contain pending status so my output look like this.</p>
  <p>This is the last record that match my criterial</p>
  <pre><code> &lt;Car&gt;
      &lt;color&gt;yellow&lt;/color&gt;
      &lt;type&gt;ford&lt;/type&gt;
    &lt;status&gt;working&lt;/status&gt;
    &lt;/Car&gt;
  </code></pre>
  <p>And also  that only have the records I want like this.</p>
  <pre><code>&lt;Cars&gt;
  &lt;Car&gt;
          &lt;color&gt;yellow&lt;/color&gt;
        &lt;status&gt;working&lt;/status&gt;
        &lt;/Car&gt;
  &lt;Cars&gt;
  </code></pre>