I have next xml:
<Histories>
<History>
<Date>20.06.2010</Date>
<FileName>4.txt</FileName>
</History>
<History>
<Date>05.06.2012</Date>
<FileName>2.txt</FileName>
</History>
<History>
<Date>18.12.1999</Date>
<FileName>3.txt</FileName>
</History>
</Histories>
I need to get last node by date (set XPath witch return date). How can I do? Example: 2.txt
Thanks
If you had proper dates in your XML (yyyyddmm
instead of dd.mm.yyyy
), this XPath 1.0 would work:
/Histories/History[
not(
(preceding-sibling::History | following-sibling::History)/Date > Date
)
]
Since you have your dates the wrong way, XPath 1.0 cannot do this.