Keep XP on death!
Hold a broken item in your hand and type /fix to repair it for free. It must not have any enchantments on it.
/fix