Sorting xml categories

hey everyone,

i’m trying to sort out some xml entries based on an attribute when you click a button. an example of my xml is below.

<list>
    <entries cat="all">
        <entry cat="category1">
            <item>Info</Item>
        </entry>
        <entry cat="category2">
            <item>Info</Item>
        </entry>
        <entry cat="category1">
            <item>Info</Item>
        </entry>
    </entries>
</list>

the only thing i can figure out is how to sum up how many different categories there are…i’m not even sure if that matters. if anyone could give me advice or some tips i’d greatly appreciate it.

thanks!