Selecting a single NodeSet from a collection of NodeSets where a containing Node has the highest val

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
I have an XML document that has a number of NodeSets. Each of these NodeSets has a child node that contains a date value, in the format, yyyymmdd (i.e. 20101207). The format is good as we dont need to do any formatting on it to apply a calculation. However,
I need to extract only a single NodeSet, the NodeSet whose child date node is the highest (i.e. latest date).
Example XML that I have is below..
<TRENDAS><br/>
<DATE>20091231</DATE><br/>
<POENG>29</POENG><br/>
</TRENDAS><br/>
<TRENDAS><br/>
<DATE>20101016</DATE><br/>
</TRENDAS> <br/>
<TRENDAS><br/>
<DATE>20081231</DATE><br/>
<POENG>29</POENG><br/>
</TRENDAS>
The bold NodeSet would be the NodeSet I need in this case as it contains the latest date.
Any help on this would be much appreciated.
Is there XPath that can extract this NodeSet directly, or would sorting need to be applied and then extract the top (position = 1) NodeSet?
Thanks in advance
Tryst <hr class="sig Tryst

View the full article
 
Back
Top