vhemphill, I hate to tell you this, but odds are, you are looking at a problem with your throttle body. I would say to get the codes read to confirm this (post the codes here if in doubt). You have 3 options when it comes to fixing this.
1) go to the dealership and buy a new throttle body. Unfortunately, this is about a $1600 part. Replacing it is easy.
2) going to a junk yard and finding one from another X-Type and installing that. The price of this is going to vary based on the yard used, so, what the price will be is hard to say,but I would anticipate spending about $800 on this part.
3) look on E-bay and there is a guy that will rebuild the throttle body for around $400. The down side to this is that you have to leave the car parked as he is rebuilding this which he says will take about 7-10 days depending on shipping time.
So, before you start spending money, let us know what the codes are and we can confirm what you are seeing and go from there. I would hate to see you spend some big money on something that doesn't fix your problem. Please keep in mind that all these costs are just for parts. This does not include anything for labor or computer time (should this be needed). But, replacing the throttle body is less than an hour worth of work. So, that cost should be very minimal.
Chris "Thermo" Coleman and Jackie, the 12 XJ