How do I farm creepers for XP without them exploding?
I have been testing this vigorously and I've found a combination of slabs and blocks and that means that the creeper cannot see you and won't explode, no matter how much it is attacked. Here it is: Notice that the player is standing on a bottom slab, so they can peer into the whole easily.
Another possible solution that I found during testing is to use a combination of stairs and slabs and a bow. While this does affect the durability of the bow I think that this can be overlooked by how effective this system is.
The setup for the upside down stairs stops skeletons from shooting at you and the distance stops the creepers from exploding.
First thing to note: if a Creeper is standing in water, even if they do explode, they won't blow up any blocks, but the explosion will still deal damage to you and other mobs around them.
Ranged weaponry is the best bet for killing creepers, as they need to be within 3 blocks of the player to trigger an explosion. If you stand outside of this range and shoot them, then they will not explode.
If a Creeper cannot see you (turn on hitboxes to see their line of sight), they will not explode, even when attacked.
The only other option I could suggest is to set up cats in a line, so ensure that the Creepers don't fall down the same shaft as the rest of the mobs, and set up an automatic killing area for them specifically. You'd lose a little bit of exp, but you wouldn't have to deal with them at all.