[xsl] Counting when using xsl:key in nested values

Subject: [xsl] Counting when using xsl:key in nested values
From: Peter Sherwood <PeteJ@xxxxxxxxxxxxxx>
Date: Wed, 29 Oct 2008 07:48:55 -0700 (PDT)
Hi All,

(using xsl1.0)
I've been using the procedure described in the following link to organise data that needs to be collated in a grouped manner.

http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200201/msg00316.html

That works pretty well and produces my list in the correct grouped manner.
My problem is now is that the pesky designers want each row coloured. Great! I'll use position() mod != 1 blah.....

Oh no I won't. 

Due to the fact that I now have two levels of grouping the position() gets completely lost when I'm at the row level. I can  get the id of my entry with generate-id() but I don't know how many non-unique entries I have skipped. Therefore I can't know how many rows I've had previously. 
The same applies for some recursive routine, I just don't know which rows I have avoided.
I won't ask why I can't reassign a "variable" :-). Although I understand the reasons behind not being able to reassign one I invariably find it generates more potentially buggable, harder to read code rather than reduce it.

So any ideas how I can perform a count of what has gone before (using the original example is fine)? Is this only possible in XSL 2.0?

Pete Sherwood
petej@xxxxxxx

Current Thread