title: XSL sorting, but only when a certain attribute is false
body: <p>I'm currently sorting a Magento-generated XML file, which looks like:</p>
  
  <pre><code>&lt;products&gt;
    &lt;product&gt;
      &lt;productnaam&gt;Example item 1&lt;/productnaam&gt;
      &lt;populariteit&gt;27845&lt;/populariteit&gt;
      &lt;imagelink&gt;http://www.example.com/image1.jpg&lt;/imagelink&gt;
    &lt;/product&gt;
    &lt;product&gt;
      &lt;productnaam&gt;Example item 2&lt;/productnaam&gt;
      &lt;populariteit&gt;12687&lt;/populariteit&gt;
      &lt;imagelink&gt;http://www.example.com/image1.jpg&lt;/imagelink&gt;
    &lt;/product&gt;
    &lt;product&gt;
      &lt;productnaam&gt;Example item 3&lt;/productnaam&gt;
      &lt;populariteit&gt;32574&lt;/populariteit&gt;
      &lt;imagelink&gt;http://www.example.com/media/catalog/productno_selection&lt;/imagelink&gt;
    &lt;/product&gt;
  &lt;products&gt;
  </code></pre>
  
  <p>using the following block of XSL:</p>
  
  <pre><code>&lt;xsl:template match="/"&gt;
    &lt;xsl:apply-templates select="/products/product"&gt;
      &lt;xsl:sort select="populariteit" order="ascending" data-type="number"/&gt;  
    &lt;/xsl:apply-templates&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>It sorts the items by popularity ("populariteit" in my XML), and with the following block of code I take the first one out of the list, so it will display the most popular item.</p>
  
  <pre><code>&lt;xsl:template match="product"&gt;
    &lt;xsl:if test="position()=1"&gt;
      &lt;xsl:value-of select="productnaam"/&gt;
      &lt;img&gt;
        &lt;xsl:attribute name="src"&gt;
          &lt;xsl:value-of select='imagelink'/&gt;
        &lt;/xsl:attribute&gt;
      &lt;/img&gt;
    &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>The problem is, however, that sometimes there is no valid picture, in that case, the <code>&lt;imagelink&gt;</code>-attribute is <em>always</em>:</p>
  
  <pre><code>&lt;imagelink&gt;http://www.example.com/media/catalog/productno_selection&lt;/imagelink&gt;
  </code></pre>
  
  <p>What I want is to sort the list, the way I do now, but it should skip all items where the <code>&lt;imagelink&gt;</code> is equal to what is shown above.</p>
  
  <p>I've tried things like:</p>
  
  <pre><code>&lt;xsl:sort select="populariteit" order="ascending" data-type="number" test="not(imagelink = 'http://www.fietspunt.nl/media/catalog/productno_selection')"&gt;
  </code></pre>
  
  <p>But that doesn't seem to work.</p>
  
  <p>In the example above, 'Example item 3' is the most popular, but, since it has a faulty <code>&lt;imagelink&gt;</code>-attribute, 'Example item 1' is the one that needs to be shown.</p>
  
  <p>What changes to my block of sort-code do I need to make, to make it work?</p>