I took Ambien to go to/from the UK. I was Heathrow to Miami, so I had time to sleep... but I've found that Ambien doesn't make me unable to wake up if necessary, and doesn't make me groggy and miserable when I wake up. It also doesn't make me loopy, waking up in the middle or after a full "night's" sleep. Of course, I tested it a couple of times to make sure before using on a plane...
I'd never be able to take Xanax on a flight, especially international, because it makes me stupid.
ETA: I just called my doc and told her I needed something to help me sleep/rest on the flight, because of a fear of flying, and because I was a smoker and being on a plane forever (New Orleans to Miami, Miami to UK) was going to drive me insane... she gave me 10, 2 of which I still have 5 years later. Oh yeah, I just took a half on the flight...