title: How to perform intersection in nodeset using xpath 2.0
body: <p>I have two different node-sets that contain one or more elements with the same name.</p>
  
  <p>I want to select these same-named elements by using the intersect operation in XPath 2.0 and XPath 1.0 as well.        </p>
  
  <p>This is the sample code i have tried.</p>
  
  <p>Input:   </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;root&gt;
      &lt;child1&gt;
      &lt;a /&gt;
      &lt;b /&gt;
      &lt;d /&gt;
      &lt;/child1&gt;
      &lt;child2&gt;
      &lt;c /&gt;
      &lt;a /&gt;
      &lt;d /&gt;
      &lt;/child2&gt;
      &lt;/root&gt;
  </code></pre>
  
  <p>The code I tried</p>
  
  <p>Xpath 1.0: </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"&gt;
      &lt;xsl:template match="/"&gt;
      &lt;!-- TODO: Auto-generated template --&gt;
      &lt;xsl:variable name="ns2" select="/root/child2/child::*"/&gt;       
      &lt;xsl:copy-of select="/root/child1/child[.=$ns2]"/&gt;
      &lt;/xsl:template&gt;
      &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Xpath 2.0:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:template match="/"&gt;
      &lt;!-- TODO: Auto-generated template --&gt;
      &lt;xsl:variable name="ns1" select="/root/child1/child::*"/&gt;
      &lt;xsl:variable name="ns2" select="/root/child2/child::*"/&gt;       
      &lt;xsl:copy-of select="$ns1 intersect $ns2"/&gt;
      &lt;/xsl:template&gt;
      &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Issue: I am getting the empty result.</p>
  
  <p>Expected result:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;a/&gt;
      &lt;d/&gt;
  </code></pre>
  
  <p>Please suggest what I am missing.</p>
  
  <p>I have tried the set operation intersection for two different noteset.I have attached my code sample below,</p>