I have an XML document with a bunch of elements, each containing a timestamp attribute:
<?xml version="1.0" encoding="UTF-8"?>
<dfs:myFields xmlns:dfs="<url>">
<dfs:dataFields>
<dfs:yobeans Title="test1.xml" Modified="2011-06-07 10:03:52"/>
<dfs:yobeans Title="test2.xml" Modified="2011-06-07 10:43:17"/>
<dfs:yobeans Title="test3.xml" Modified="2011-06-07 10:43:27"/>
<dfs:yobeans Title="test4.xml" Modified="2011-06-07 11:42:27"/>
<dfs:yobeans Title="test5.xml" Modified="2011-06-07 11:42:38"/>
<dfs:yobeans Title="test6.xml" Modified="2011-06-07 11:42:47"/>
</dfs:dataFields>
</dfs:myFields>
Is it possible to use XPath 1.0 to select the most recent element? I have seen some people who claim they did it somehow with string comparison but did not specify how.
If the date is in yyyy-mm-dd format and the time is in 24 hour format and leading zeros are used everywhere, the text will sort in date-time order.