xpath query to select element where attribute not present

What should be xpath query to select an element where the attribute att not present.

<root>
  <elem att='the value' />
  <elem att='the value' />
  <elem att='the value' />
  **<elem />**
  <elem att='the value' />
  <elem att='the value' />
</root>

I want to update element where attribute att not present.

Thanks

Jon Skeet
people
quotationmark

You can use [@att] to test for the presence of an attribute, so you just need:

//elem[not(@att)]

... to test for the absence of it.

(Tested using xpathtester)

people

See more on this question at Stackoverflow