 <p>Strictly speaking, those declarations are not attributes but namespaces nodes. To get them with XPath, it depends of what version of XPath you use.</p> <p>For XPath 1, use :</p> <pre><code>/*/namespace::* </code></pre> <p>For XPath 2, use : <code>fn:in-scope-prefixes</code> and <code>fn:namespace-uri-for-prefix</code> to get the prefix and the associated namespace uri.</p>