IAC, TPS and throttle body valve could all be involved. I'd start with some free stuff first.
If not done yet, clean throttle body/valve especially where the valve "sits" at idle (is good maintenance anyway).
For correct running of engine, fuel/spark/timing all need to be there. So also think about fuel delivery: could be verified with a reading of fuel pressure at cold start up. Re/Adjusting the throttle cable is a free fix which has solved a few issues for Xj users.
Testing the TPS is best done with an analogue multi meter, because it will give you a nice visual on the meter 'sweep'.
All the above can be done at no cost before any parts are (to be) purchased
pS: rough idle at cold start up could also be leaking fuel injector(s). The idle should usually clear out after a few seconds of running as the engine clears the excess fuel.