XPath to get the element with the highest ID
documents/document[not(../document/id > id)]/id
Besides Nick Jones XPath 1.0 correct answer, in XPath 2.0:
/documents/document[id = max(../document/id)]
documents/document[not(../document/id > id)]/id
Besides Nick Jones XPath 1.0 correct answer, in XPath 2.0:
/documents/document[id = max(../document/id)]