Just starting to learn XML and XSL and having a bear trying to solve what
I think should be a simple problem. It's very much the same as: http://www.dpawson.co.uk/xsl/sect2/N4486.html#d56e144

The solution there is too cryptic for me, however.

This is a test XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="grouptest.xsl"?>
<test>
<item>
<state>North Dakota</state>
<data>3</data>
</item>
<item>
<state>Vermont</state>
<data>3</data>
</item>
<item>
<state>North Dakota</state>
<data>1</data>
</item>
<item>
<state>North Dakota</state>
<data>2</data>
</item>
<item>
<state>South Dakota</state>
<data>12</data>
</item>
<item>
<state>Iowa</state>
<data>3</data>
</item>
<item>
<state>South Dakota</state>
<data>10</data>
</item>
</test>

What I would like to output is a sorted table with each group of states alternating
between 2 colors. The output should look sort of like (the symbols represent
background color):

Iowa%%%%%3
North Dakota#####1
North Dakota#####2
North Dakota#####3
South Dakota%%%%%10
South Dakota%%%%%12
Vermont#####3

I've tried a bijillion different methods without success. Could someone
help!

Thanks