First off check that your parking lights are working. On many early models of the XJ the park lights fuse and the instrument lights fuse are wired in series. The parking light fuse goes out and so does the instrument lights.
The dimmer part of the headlight switch has always been a weak point. When it fails it can also overheat the headlight switch and melt the connector.
I got really tired of swapping out aftermarket headlight switches. The OEM switch sucks, the aftermarket switch sucks worse. I jumped my instrument lights to full bright, bypassing the dimmer, never had another failure.