XPath: How to select nodes which have no attributes

xpath

Using XPath, how to select nodes which have no attributes (where attribute count = 0)?

For example:

<nodes>
    <node attribute1="aaaa"></node>
    <node attribute1="bbbb"></node>
    <node></node> <- FIND THIS
</nodes>

Best Answer

//node[not(@*)]

That's the XPath to select all nodes named "node" in the document without any attributes.