How to build an XP farm from a spawner in Minecraft
While you work, place a Torch next to the spawner.

A Torch is the basic light source: a stick with burning coal that lights caves and keeps monsters away.
It is made with the Crafting Table from Stick, Coal and Charcoal. It gives off light level 14.
One Coal or Charcoal on a Stick makes four torches. Place them on floors or walls; their light, level 14, stops most hostile mobs from spawning around them and melts nearby snow and ice.
Torches break instantly, pop off if their support goes, and water washes them away. Miners place them on one side of the tunnel to find the way back.
Coal / Charcoal + Stick → 4 × Torch
// Slots with several items cycle through every accepted option.
While you work, place a Torch next to the spawner.
Place a Torch in the room and 2 torches on the free floor blocks of the pen, so no mobs spawn there at night.
no monster spawns on a block lit by a torch.
A Torch gives light level 14, and light drops by 1 per block, so one torch keeps the floor safe up to 13 blocks away, counted along the floor, as long as no wall is…
At the Crafting Table: 1 × Stick, 1 × Coal and 1 × Charcoal give 4 × Torch. Mining the block drops it. It can be found as loot in Mineshaft, Trial Chambers and Village.
It lights up areas and prevents monster spawns. It is an ingredient in 2 recipes, made at the Crafting Table; for example Jack o'Lantern and Lantern.
Yes, light level 14.
No: when a piston pushes it, it breaks and drops as an item.