title: libxml2: xpath relative to sub node
body: <p>Given the xml file</p>
  
  <pre><code>&lt;a&gt;
     &lt;b&gt;
        &lt;d&gt;v&lt;/d&gt;
     &lt;/b&gt;
     &lt;c&gt;
        &lt;d&gt;v&lt;/d&gt;
     &lt;/c&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>And the xpath "//d/text()"</p>
  
  <p>I want to apply the xpath only to c and not to the whole document.</p>
  
  <p>This has to work with libxml2 2.7.6</p>
  
  <p>Doing this does not work;</p>
  
  <pre><code>xmlNodePtr node = &lt;node pointer to c&gt;
  xmlXPathContextPtr xpathCtx = xmlXPathNewContext( node-&gt;doc );
  xpathCtx-&gt;node = node;
  
  xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression ( "//d/text()", xpathCtx);
  </code></pre>
  
  <p>Returned xpathObj contains refences to both /a/b/d and /a/c/d. Only /a/c/d was expected.</p>