Using XPath to match a key/value paired XML message

In one of my current projects, we have an XML message that looks a little like this.

<envelope>
    <message>
    <message-id>1</message-id>
    <keys>first-name<keys>
    <keys>last-name<keys>
    ....
    <values>Angelo<values>
    <values>van der Sijpt<values>
    </message>
</envelope>

For testing purposes, I want to use XPath to get values from this, i.e. match first-name to Angelo.

After some fiddling, I wound up with this slightly ugly contraption. Might be useful for you one day, though I hope you can be spared...

//message/values[count(//message/keys[.="field-name"]/preceding-sibling::keys)+1]