Isn't Xehanort dead? I mean his heartless is Ansem SoD and his Nobody is Xemnas, which means he's dead, right? So how does he return in the end of KH3D?
You haven't seen the Re: Coded secret ending, have you?
When the heartless and the corresponding nobody (Ansem SoD and Xemnas) are destroyed, the original person is reborn => ergo Xehanort is back in action.
On one more side note: When a person's heart becomes a heartless that person doesn't die, it only goes dormant.
If the heartless is slain by a keyblade the original person can return.
In the rare case that a nobody was born both the heartless and nobody (which "occupies" the body and soul of the original person) need to be destroyed to bring the original person back.
Turning into a heartless =/= death.