Within for-each-group(), calling position() will give you values 1,2,3.... as you iterate over the groups. I would think that meets your need.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference