XML Source:
<documents>
<document>
<id>3</id>
</document>
<document>
<id>7</id>
</document>
<document>
<id>1</id>
</document>
</documents>
I need the document-element with the highest value in its id-element (so <document><id>7</id></document> in the example). I can’t change the C# code, it is XMLDocument.SelectSingleNode(...), I only can modify the XPath used.
Is there something like documents/document[id=max(id)] or like order by id descending to get it?
1 Answer