I know this is an old thread, but i have just solved this problem on my X-Type, and i have noticed that just after the year that my car was made, Jaguar installed a different throttle body on newer cars and they don't have the part that's playing up on them.
The part that causing the problems for you is the IAC (Idle Air Control) Valve. Its the part that sits on top of the throttle body. Take the throttle body off, and clean it, and take to IAC Valve off the top and clean that, give it a good squirt of WD-40. I've just solved this problem on my own X-Type.
I know this is an old thread, but just thought I'd throw a solution out there