So according to the secret reports in order to restore a lost person you need two things. First is a body, a replica that has essentially been tuned to that person using data/memories/whatever. The second is their heart which must be lead into it and awakened via a "spark" a "connection". For Roxas and Namine the heroes rebuilt them using replica bodies and the data for Roxas and Namine from the digital Twilight Town. For Xion the Organization spent the game recreating her with their experiments they were doing in the worlds like toy story, and then when Sora clashed with her and said her name that was the "spark"/"connection" that was able to lead Xion's heart into this replica and awaken as a completed Xion. That's why when Sora said the name Xion the replica spazzes out and after she collapses that's when Axel suddenly remembers Xion indicating she has returned.
Or at least that's how I'm viewing it.