When I was play my MC world I notice my XP bar said I had 0 levels (it was empty) when I should've had 22 levels. I killed a chicken to gain some exp and it set itself back to 22 again. How strange!
This seems to only occur when leaving and rejoining a world riding a horse:
Steps to reproduce:
-ride a horse (tamed)
-save and quit world
-reload world
-dismount horse
-notice how the xp bar reads 0
-kill a mob to gain some xp
-notice that when gaining the xp the xp bar refills to its previous state
Please provide a screenshot of your game with the F3 debug screen enabled.