title: Union of two node-set results leads to duplicated set member
body: <p>I'm using xslt 1.0, and I need a union of two variables which means I have to use node-set function.</p>
  
  <p>The test case below creates a union of a single node with a set that contains this node. Since A contains B, the union operation should return B. But I get a new set with duplicate A's. </p>
  
  <p>If I use xpath directly, union behaves as expected. If I use variables and node-set function, I face the unexpected case. My scenario requires that I use node-set. I've simplified the test case as much as I can. </p>
  
  <p><strong>This is the xml content:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;root&gt;
    &lt;event&gt;
      &lt;id&gt;3&lt;/id&gt;
      &lt;eventType&gt;TYPE1&lt;/eventType&gt;
    &lt;/event&gt;
    &lt;event&gt;
      &lt;id&gt;2&lt;/id&gt;
      &lt;eventType&gt;TYPE2&lt;/eventType&gt;
      &lt;parent&gt;3&lt;/parent&gt;
    &lt;/event&gt;
    &lt;event&gt;
      &lt;id&gt;1&lt;/id&gt;
      &lt;eventType&gt;TYPE2&lt;/eventType&gt;
      &lt;parent&gt;3&lt;/parent&gt;
    &lt;/event&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p><strong>and this is the xslt:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" 
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
                  xmlns:ext="http://exslt.org/common"
                  exclude-result-prefixes="msxsl"
  &gt;
      &lt;xsl:output method="xml" indent="yes"/&gt;
  
      &lt;xsl:template match="/"&gt;      
  
        &lt;xsl:variable name="t2-events"&gt;
          &lt;xsl:copy-of 
            select="root/event
                    [eventType = 'TYPE2' and parent = '3']"/&gt;
        &lt;/xsl:variable&gt;
  
        &lt;xsl:variable name="specific-t2"&gt;
            &lt;xsl:copy-of 
              select="root/event
                      [eventType = 'TYPE2' and id = '2']"/&gt;        
        &lt;/xsl:variable&gt;
  
        &lt;DEBUG&gt;        
  
            &lt;results&gt;            
              &lt;xsl:variable name="dummy" 
                            select="root/event
                                    [eventType = 'TYPE2'] 
                                    | 
                                    root/event[id = '2']"/&gt;
              &lt;xsl:variable name="dummy2" 
                            select="ext:node-set($t2-events)
                                  | ext:node-set($specific-t2) "/&gt;
  
              &lt;xsl:comment&gt;Works as expected&lt;/xsl:comment&gt;
              &lt;dummy&gt;              
                  &lt;xsl:copy-of select="$dummy"/&gt;
              &lt;/dummy&gt;
              &lt;dummy2&gt;
                &lt;xsl:comment&gt;There are 3 elements here, where we should have 2&lt;/xsl:comment&gt;
                  &lt;xsl:copy-of select="$dummy2"/&gt;
               &lt;/dummy2&gt;            
            &lt;/results&gt;
  
        &lt;/DEBUG&gt;            
      &lt;/xsl:template&gt;  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>How do I apply a union on two node-set() calls?</p>