It will be the buttons. I had the same issue and replaced them. Very tricky to do but solved my problem.
https://www.ebay.co.uk/itm/for-Jaguar-X-S-XJ-XK-XJR-Type-4-Button-Remote-Key-Fob-Case-Repair-Refurb-Kit-/172182298119?mkcid=16&mkevt=1&_trksid=p2349624.m46890.l49286&mkrid=710-127635-2958-0