All:
In a group by query expression like
  for $varGrp at $pos in local:getVariables($from,$to)
  group by $name := string($varGrp/@name)
  return <Something/>

is there any way to get a value or position for the group count?

In my particular use case, I used this to generate an HTML table and I would like to repeat the header every 20-30 rows (group). The "at $pos" variable can't be used as it holds a sequence  of positions of the group members (which is what it's supposed to).

Any suggestion appreciated.
best
*P