Shortest XPath to find minimum/maximum of sibling dateTime nodes
I have the following simple xml: <root> <item> <d>2002-05-30T09:00:00</d> </item> <item> <d>2005-05-30T09:00:00</d> </item> <item> <d>2003-05-30T09:00:00</d> </item> </root> Now I want to find the minimum or maximum dateTime node using XPath. My solution at the moment is: /root/item[not(number(translate(./d, 'TZ:-', '.')) <= number(translate(following-sibling::item, 'TZ:-', '.')))][not(number(translate(./d, 'TZ:-', '.')) <= number(translate(preceding-sibling::item, 'TZ:-', '.')))][1]/d It works but is is ugly as hell and not very efficient. Basically it converts the dateTime to a number and