Many times it´s the cable. Take a look, beginning at the firewall and following it bak to the transfer. Try not to have any sharp bends in the cable or unessary kinks, it works best the straighter the run. Cable doesn´t have much extra length in most XJ´s I´ve seen.
The inside of the speedo cable, is like a long spring, it can be removed and greased with graphit grease, usually helps smooth out the action some. The spring/cable is four sided on the end and sometimes after removal is hard to get the spring/cable to go back into the receptical, at the speed sensor near the gauge cluster.
Taking the dash apart and seperating the speed sensor from the speedo cable end is a pain. Not something I´d want to do, unless really necessary.
Most times the problem spot in the cable, is right at the firewall in the engine bay, cable is bent a bit too sharply, right at the transfer and where it is clipped to the frame, near the transfer linkage.