title: XQuery equality of attributes in node and subnodes
body: <p>I have this piece of XML-code:</p>
  
  <pre><code>&lt;player name="John" points="50"&gt;
    &lt;game points="5"&gt;Beans&lt;/game&gt;
    &lt;game points="40"&gt;Cucumbers&lt;/game&gt;
    &lt;game points="50"&gt;Tomatos&lt;/game&gt;
  &lt;/player&gt;
  </code></pre>
  
  <p>What I want to do is to get this piece, but only with those games where number of points (attribute of "game") is equal to points which is attribute of "player".
  Thus, considering above example, I should get next XML-piece:</p>
  
  <pre><code>&lt;player name="John" points="50"&gt;
    &lt;game points="50"&gt;Tomatos&lt;/game&gt;
  &lt;/player&gt;
  </code></pre>
  
  <p>I write following XQuery:</p>
  
  <pre><code>for $a in doc("ex.xml")
  where $a/xs:int(@points)=$a/game/xs:int(@points)
  return $a
  </code></pre>
  
  <p>But I don't get any result. Could you please help me?</p>