Sounds like a sensor/solenoid/ electrical connection in the transmission, possible others, like loss of fluid ect.
Gearbox fault in a Jaguar sounds very expensive.
Try to have a parts house use an ODB-II scanner and get any codes that come up. With this you can determine the exact problem
Looking for a Used X-TYPE in your area?
CarGurus has 11 nationwide X-TYPE listings starting at $4,995.
Search Jaguar X-TYPE Questions
Jaguar X-TYPE Experts
Related Models For Sale