Where is the temperature sensor on a 6 cylinder 1997 Jeep Cherokee?

look next to the firewall on the head . just under the valve cover and it will only have one wire going to it There are actually TWO on my 1996 4.0L XJ. One on the front - top of the head, and one on the driver's side-top of the head next to the rockerbox. The front sensor feeds the computer, the side sensor feeds the idiot light or temperature gauge.