Link to home
Start Free TrialLog in
Avatar of sydron
sydronFlag for Australia

asked on

XPath 1.0 - Getting maximum and minimum value of a node

Can anyone suggest a clean way of grabbing the maximum and minimum value of an XML document  ( say datetime of an event ).

e.g say I have a list of event nodes and I want to grab the min and max event date in the xml.

I  can not use XPath 2.0 so any functions that are available for 2.0 to solve this problem can not be used.

Any ideas guys?
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sydron

ASKER

The dateformat is yyyy-mm-ddThh:mm:ss.

Hope this is what you need.
Avatar of sydron

ASKER

I have to agree with you that it is slower to do this in xpath. I might actually just do it in the application language itself.
I thought of stripping the non digit characters from teh date, but that doesn't work on the nodeset of course,
only option that is elegant enough to maintain seems to me that you get the max and min through application code
Avatar of sydron

ASKER

Perfect answer.