title: xpath 1.0 first and last nodes
body: <p>How do i select only the first and the last nodes using an xpath 1.0 statement?</p>
  
  <p><code>Vehicle/Car[position() = 1]</code> works correctly</p>
  
  <p><code>Vehicle/Car[position() = last]</code> works correctly</p>
  
  <p>however when i try and put them together it only brings back the first result and ignores the second condition.
  I've tired what i think should work:</p>
  
  <pre><code>Vehicle/Car[position() = 1 or position() = last()]
  </code></pre>
  
  <p>but this only brings back the first position. </p>
  
  <p>I've also tried alternatives such as:</p>
  
  <pre><code>Vehicle/Car[position() = 1][position() = last()]
  </code></pre>
  
  <p>which all seem to return only the first not the first and the last.</p>
  
  <p><strong>added*</strong> example input and output as requested.</p>
  
  <p><strong>input example:</strong></p>
  
  <pre><code>&lt;Vehicle&gt;
      &lt;Car&gt;
          &lt;CarNumber&gt;123&lt;/CarNumber&gt;
      &lt;/Car&gt;
      &lt;Car&gt;
          &lt;CarNumber&gt;456&lt;/CarNumber&gt;
      &lt;/Car&gt;
      &lt;Car&gt;
          &lt;CarNumber&gt;789&lt;/CarNumber&gt;
      &lt;/Car&gt;
  &lt;/Vehicle&gt;
  </code></pre>
  
  <p><strong>expected output:</strong> </p>
  
  <pre><code>123789
  </code></pre>
  
  <p><strong>actual output:</strong> </p>
  
  <pre><code>123
  </code></pre>
  
  <p><strong>xslt:</strong></p>
  
  <pre><code>&lt;xsl:template match="/"&gt;
      &lt;xsl:value-of select="Vehicle/Car[position() = 1 or position() = last()]"/&gt;
  &lt;/xsl:template&gt;
  </code></pre>