[jQuery] Sorting numerically based on number of occurrences
Hello,
Hopefully someone can give me a few pointers on how to impliment this,
i'm not sure if its a jquery only or some sort of jquery / standard
javascript hybrid solution that is needed.
I'm looking to grab a set of 10 to 20 names from a XML file, and then
sort them based on the number of times the occur in the XML file. So
say i have
<xml>
<name>John</name>
<name>Smith</name>
<name>Jones</name>
<name>Doe</name>
<name>Jones</name>
<name>Smith</name>
<name>Jones</name>
</xml>
I want to pull these names into an object / array then sort them by
number of occurrences on a page. They would output on the page like
so..
Jones(3)
Smith(2)
Doe(1)
John(1)
Now i have managed to pull the names in fine, and created an array of
all the names, i'm just a little unsure on what to do next with the
sorting issue, and how to do this.
Any input on the problem would be greatly appreciated.
Thanks
1man