<?sum(current-group()/sold * current-group()/price)?>
What is it? Where do you learn this syntax, remotely like a processing-instruction but not being one?
I group by <ticket>
Suppose you mean what you say and thereby you mean you're working with xslt 2.0 as well.
One more thing, the <sold></sold> tag will only have 2 values (1 or 0)
If you do thing right, it does not generically matter.
Here is how at the current-group() (xslt 2.0) of what you said you have grouped.