You get XP per damage, not kill. If you do 99 damage to an enemy and someone rushes in and pops the last one health off, you still get 99% of the XP and they get 1%.
There's XP earned based on damage, and a further bonus for the incap which is based on damage done - so if you deal 99 damage to a guy who can take 100, and someone else deals the last 1, they get the 1% damage XP, AND a 1% kill bonus. If you deal 50% damage to someone a teammate took 50% of the health from, and finish him off, you get a 50% kill bonus on top of the 50% damage XP.
Even with that, everything else is worth more than killing, though. And you only get a kill bonus on incapped targets when you melee finish them one they're down.