I think you have to treat this as a 2-phase transformation
(a) do the grouping and capture the results in a variable
(b) do the paging on the contents of that variable.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference