<p>I would like to create an HTML table with row colors changing based on position and content.  But instead of alternating every row, I'd like to be able to group rows together, so that I can have some XML like this:</p>

<pre><code>&lt;itemlist&gt;
   &lt;item group="0"&gt;Conent...blah blah&lt;/item&gt;
   &lt;item group="0"&gt;Content...who cares&lt;/item&gt;
   &lt;item group="1"&gt;Content&lt;/item&gt;
   &lt;item group="2"&gt;Content&lt;/item&gt;
   &lt;item group="2"&gt;Content&lt;/item&gt;
&lt;/itemlist&gt;
</code></pre>

<p>And all of the items with group=0 are one color, and items with group=1 are another, and group=2 are either toggled back to the first color, or are their own color.</p>

<p>All I can seem to find out there is ways to alternate every row, but I can't seem to "get it" when it comes to actually using the node data to help me make the decision.</p>

The first two groups are simple as you can parse them based on their group number.
To handle group 2, consider using the
preceding
function to get a list of proir notes, and use
count
to determine how many there are. You can can then alternate values based on whether the count is even or odd.