>Is it possible to sort two elements within a same for-each loop?
Sure, you can sort any number of elements in a for-each loop.
But that's so obvious, I must have misunderstood the question. Please be a bit more specific.
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference