I have the below xml, in which I need to do the following:
If the value of both title and text element are same, sort those list element based on score attribute
For e.g.: Here the value of title and text for 1st and 3rd list element are same, so these two should be sort based on score and display the list which has the highest score and discard others.
How can I achieve this?
Desired output:
<list>
<title>abcd</title>
<text>abcd</text>
<score>2</score>
</list>
-----XML-----
<result>
<list>
<title>abcd</title>
<text>abcd</text>
<score>1</score>
</list>
<list>
<title>efgh</title>
<text>efgh</text>
<score>3</score>
</list>
<list>
<title>abcd</title>
<text>abcd</text>
<score>2</score>
</list>
<result>