How to find the max attribute from an XML document using Xpath 1.0

In XPath 2.0, use the max function. To find the book with the highest id, do

/library/book[@id = max(/library/book/@id)]

Leave a Comment