The variable example works, but there is a much easier way to do it (in my opinion). Let's say, in your XML, you have the element "events" repeating 31 times -- indicating 31 events -- and you want each one to have a unique ID.
In your XSL sheet, you'd run a loop creating a <div> like this:
The reason I pointed to the variable option, is that the question is not clear. If there is only one loop, then yes, I agree with you. If there are more however, the position will not give the desired results.
That could work, but the problem becomes if you want to do anything with CSS. For instance, if you wanted to alternate background colors for even and odd-numbered <div>'s, you couldn't with the generateid() function, since it creates a random ID. By using a variable, you can check the position() and create an attribute that determines whether a <div> is even or odd numbered. Still, good contribution and it might be exactly what they're looking for!