Hi Karl, your battery is a key element of your Modern XK and its ability to start the car (or not as in your case) is no longer a pointer to whether the battery is fit for further service. All modern cars, especially Jaguars, need the battery to be in top condition to allow the multitude of electronics onboard to function correctly.
Typical signs of a failing battery are spurious warning lights and apparent electrical gremlins. In truth, I and many others, consider the battery in a Modern XK to be a consumable item and changed at circa 5 years old. In some cases with low usage and regular connection to a battery conditioner when the car is not being used, the battery life can be extended.
In your case, unless you know the history of the battery and can confirm it to be less than 5 years old, I would suggest it be changed at the earliest opportunity. Ensure you select the replacement to be of the correct power and dimensions - the battery must fit and be secured into the battery tray, otherwise it is an MoT failure. At a resting voltage below 12 volts, it would seem to be past its prime.
Also, as you have discovered, earth connections are also important and I would suggest you check any and all that you can locate around the car.
Let us know how you get on.
N6 JMX