I quick test with some starting units (that had no xp at all) against a Banished Ogre.
With 2 heroes and 2 soldiers: both heroes get 5 xp, both soldiers get 2 xp each.
With a single hero and 2 soldiers: hero gets 10xp, and soldiers get 5 xp each.
With a single hero who dies during the combat, and two soldiers, the soldiers both get 5xp each.
With two heroes, and two soldiers, and only one hero dies, the other hero gets 5xp, and the soldiers get 2xp each.
With just my two soldier units, when they eventually beat the ogre (extra reload required), they both got 5xp.
So, if there is more than one champion, xp is divided by the number of champions in the army to provide an xp amount. Otherwise the amount is the total from the mobs.
Then Champions (and Henchmen and maybe scions) get that amount of xp, + any bonuses.
And other units get half that amount.
Don't group up your champions if you want to level up your normal units with them.