I have some XML like this:
<Team ...some attributes...>
  <Name>My Team</Name>
  <Player uID="player1">
    <Name>Name</Name>
    <Position>Goalkeeper</Position>
    <Stat Type="first_name">Name</Stat>
    <Stat Type="last_name">Last</Stat>
    <Stat Type="birth_date">bday</Stat>
    <Stat Type="birth_place">bplace</Stat>
    <Stat Type="weight">84</Stat>
    <Stat Type="height">183</Stat>
    <Stat Type="jersey_num">1</Stat>
  </Player>
  <Player uID="player2">
    ...
  </Player>
  ...
</Team>
I want to search for players by jersey_num.  I'm using Nokogiri and this code gets me sort of close:
feed.xpath("/Team[@uID='#{team_uid}']//Player/Stat[@Type='jersey_num']")
That returns all the players in a given team, and an array of their jersey number attribute rows, but I want to find a player with a given jersey number, and then pull its uID.
I can do that with ancestor, but first I need this search to yield only one matching player.  I realize at the moment I'm not searching for it, but I'm not sure how to search given the Stat Type syntax.
                        
Then the xpath parameter should look about like this :
or maybe without trailing
/@uIDto getPlayerelement, and then do further extraction from ruby code. Notice thatStat[....]part in the above xpath filtersStatelement byTypeattribute value and by value of the element itself.