 <h1>Other XQuery implementations <em>do</em> support this query</h1> <p>If you want to validate that your query (as corrected per discussion in comments) <strong>does</strong> in fact work with other XQuery implementations when entered exactly as given in the question, you can run it as follows (tested in BaseX):</p> <pre><code>declare context item := document { &lt;actors&gt; &lt;actor filmcount="4" sex="m" id="15"&gt;Anderson, Jeff&lt;/actor&gt; &lt;actor filmcount="9" sex="m" id="38"&gt;Bishop, Kevin&lt;/actor&gt; &lt;/actors&gt; }; //actor/@id </code></pre> <hr> <h1>Oxygen XQuery needs some extra help</h1> <p>Oxygen XML doesn't support serializing attributes, and consequently discards them from a result sequence when that sequence would otherwise be provided to the user.</p> <p>Thus, you can work around this with a query such as the following:</p> <ul> <li><code>//actor/@id/string(.)</code></li> <li><code>data(//actor/@id)</code></li> </ul> <hr> <h2><em>Below applies to a historical version of the question.</em></h2> <p>Frankly, I would not expect <code>//actors/@id</code> to return anything against that data with any valid XPath or XQuery engine, ever.</p> <p>The reason is that there's only one place you're recursing -- one <code>//</code> -- and that's looking for <code>actors</code>. The single <code>/</code> between the <code>actors</code> and the <code>@id</code> means that they need to be <strong>directly</strong> connected, but that's not the case in the data you give here -- there's an <code>actor</code> element between them.</p> <p>Thus, you need to fix your query. There are numerous queries you could write that would find the data you wanted in this document -- knowing which one is appropriate would require more information than you've provided:</p> <ul> <li><code>//actor/@id</code> - Find <code>actor</code> elements anywhere, and take their <code>id</code> attribute values.</li> <li><code>//actors/actor/@id</code> - Find <code>actors</code> elements anywhere; look for <code>actor</code> elements directly under them, and take the <code>id</code> attribute of such <code>actor</code> elements.</li> <li><code>//actors//@id</code> - Find all <code>id</code> attributes in subtrees of <code>actors</code> elements.</li> <li><code>//@id</code> - Find <code>id</code> attributes anywhere in the document.</li> </ul> <p>...etc.</p>