I have an 89, but had very similar problems. So I know it is a little different year, but maybe my experience will help. (Borla Header, Isky Cam #133125- 10% bigger, stock size injectors, XJ-Armor air tube, 90K on rebuilt engine. All other parts original.)
My Jeep ran nice, but I changed the plugs and checked cap and rotor then headed to the Test only shop. I failed for NOx! I changed the O2, CAT, Cap & Rotor, Wires, EGR (it looked rusty -you don’t have.) Then took it to test only with the engine nice and hot still I failed for NOx!. The readings were better but not passing. So I changed the MAP and CPS, indexed the distributor, thermostat 200 (from 180), changed oil viscosity to 20/50, adjusted TPS using FSM method. Checked compression and Fuel pressure and both were fine. After this mine ran sweeter, BUT failed still. As you can imagine I was pretty pissed off with the PRC (peoples republic of CA) by now.
I began to investigate for a “special shop” - no luck. So I called the CA BAR and they told me about the “Gold Shield” stations. They can test and repair “test only vehicles”. So I gathered my $$$ and drove my jeep to a GS shop with a list of what I had done so far. I told them I don’t care what it takes I need it to pass. Luckily I happened to be talking to the Owner and tester. (No he didn’t cheat.) After listening to my XJ and my story he told me it should pass. He then told me that the CAT needs to be REAL HOT not just the engine and that many of these Jeeps will fail for NOx it CAT is not real hot. He ran my Jeep for about 20 minutes at about 3500 rpm. Then tested. IT PASSED NO PROBLEM. The man told me that correcting the TPS setting, and changing O2 and CAT help always, but it probably would have passed with out buying any other parts.
Well I have a nice set of spare parts now for the trail and will swap my new/old Hollowed CAT and save the new CAT for the next 2 years.
Hope things get better for your XJ.
rs