Unless you modify the XSL to perform the sorting there, you'll need to use code to physically sort your data.
Hyperlinks cannot call into code. You can, however, remove the background and border colors of a button, and underline the text, which will make it "look like" a hyperlink. That button can call into code.

Signature
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
I am trying to use a dropdown to dynamically sort the contents of a
repeating table. Is that possible? Is it possible to use hyperlinked
column headers instead?