1) Spellbooks. Even though you can do this in theory, Spellbooks have so many bugs that its not worth it.
2) Engineering Upgrade. I think that this is what Vexorian used in his map. However, this method is just as buggy as Spellbooks.
3) Dialogues. The only bug-free way that I know of to do this is to use a system of dialogues, allowing the hero to switch between spells but to never have more than six at once.
~The_Raven