title: xsl variable - only filtered data
body: <p>I have set of unique parts (part_number defined with part nodes. Those parts can be used many times and each occurane ist defined by part_occurance node which is
  linked by part value to part id.</p>
  
  <pre><code>&lt;data&gt;
  &lt;part id="part_id_01"&gt;
      &lt;part_number&gt;number_01&lt;/part_number&gt;
  &lt;/part&gt;
  &lt;part id="part_id_03"&gt;
      &lt;part_number&gt;number_18&lt;/part_number&gt;
  &lt;/part&gt;
  &lt;part id="part_id_04"&gt;
      &lt;part_number&gt;number_12&lt;/part_number&gt;
  &lt;/part&gt;
  &lt;part id="part_id_05"&gt;
      &lt;part_number&gt;number_13&lt;/part_number&gt;
  &lt;/part&gt;
  &lt;part_occurence id="occurence_id_01"&gt;
      &lt;part&gt;part_id_03&lt;/part&gt;
      &lt;name&gt;test_0&lt;/name&gt;
  &lt;/part_occurence&gt;
  &lt;part_occurence id="occurence_id_02"&gt;
      &lt;part&gt;part_id_03&lt;/part&gt;
      &lt;name&gt;test_1&lt;/name&gt;
  &lt;/part_occurence&gt;
  &lt;part_occurence id="occurence_id_03"&gt;
      &lt;part&gt;part_id_01&lt;/part&gt;
      &lt;name&gt;test_2&lt;/name&gt;
  &lt;/part_occurence&gt;
  &lt;part_occurence id="occurence_id_04"&gt;
      &lt;part&gt;part_id_04&lt;/part&gt;
      &lt;name&gt;test_3&lt;/name&gt;
  &lt;/part_occurence&gt;
  &lt;part_occurence id="occurence_id_05"&gt;
      &lt;part&gt;part_id_03&lt;/part&gt;
      &lt;name&gt;test_4&lt;/name&gt;
  &lt;/part_occurence&gt;
  &lt;part_occurence id="occurence_id_06"&gt;
      &lt;part&gt;part_id_03&lt;/part&gt;
      &lt;name&gt;test_4&lt;/name&gt;
  &lt;/part_occurence&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>This set contains all occurances:</p>
  
  <pre><code>&lt;xsl:variable name="occurrence_List1" select="part_occurrence" /&gt;
  </code></pre>
  
  <p>How to get this variable containing occurences but excluded all occurences with part_number for example 'number_18'</p>
  
  <p>My XML is very large and created dynamically and I will keep at this variable only filtered data for later for-each use. Because I go later many times throw this variable i want keep it small as possible for speed reason...Sorry for bad my english :)</p>
  
  <p>This is my xsl-file now:</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pxslt="file://pxslt.py" xmlns:msxsl="urn:schemas-microsoft-com:xslt"&gt;
  &lt;xsl:key name="k1" match="part" use="@id"/&gt;
  &lt;xsl:template match="/data"&gt;
  &lt;xsl:variable name="part_list" select="part" /&gt;
  &lt;xsl:variable name="occurrence_List1" select="part_occurrence[not(key('k1', part)/part_number = 'number_18')]" /&gt;
  &lt;!--&lt;xsl:variable name="occurrence_List1" select="part_occurence" /&gt;--&gt;
  &lt;test&gt;
  &lt;xsl:for-each select="$occurrence_List1"&gt;
      &lt;part&gt;
          &lt;xsl:variable name="idx" select="part"/&gt;
          &lt;xsl:attribute name="part"&gt;&lt;xsl:value-of select="part" /&gt;&lt;/xsl:attribute&gt;
          &lt;xsl:attribute name="part_name"&gt;&lt;xsl:value-of select="$part_list[@id=$idx]/part_number" /&gt;&lt;/xsl:attribute&gt;
      &lt;/part&gt;
  &lt;/xsl:for-each&gt;
  &lt;/test&gt;
  
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>but the result is empty. :(</p>
  
  <p>When I try without filtering I get:</p>
  
  <pre><code>&lt;test xmlns:pxslt="file://pxslt.py" xmlns:msxsl="urn:schemas-microsoft-com:xslt"&gt;
    &lt;part part="part_id_03" part_name="number_18"/&gt;
    &lt;part part="part_id_03" part_name="number_18"/&gt;
    &lt;part part="part_id_01" part_name="number_01"/&gt;
    &lt;part part="part_id_04" part_name="number_12"/&gt;
    &lt;part part="part_id_03" part_name="number_18"/&gt;
    &lt;part part="part_id_03" part_name="number_18"/&gt;
  &lt;/test&gt;
  </code></pre>