You sound like you are already on the right track - what you are describing should be doable via the built in Infopath rules gui/interface - I doubt you would even need to manually write any xpath.
e.g. sharepoint table 1 with leave entitlements
ID leaveEntitlement
0 250 hrs
1 102 hrs
sharepoint table 2 with user names
ID name
0 John Mowely
1 Jane Lovely
Populate the name drop down box (lets call it my:selectName) with a secondary data connection to table 2, but make the bound value the ID.
Then a rule on the name drop down should query another secondary data connection to table 1 which has a filter on it to only retrieve leaveEntitlement where ID = my:selectName.
Then set your field where the entitlement should be put from the secondary data connection.