Can't answer for UK, but the general rule in US law is that a court is supposed to earnestly strive to carry out the intention of the testator (person who made the will). As long as the beneficiary can be identified and located and the relationship demonstrated, the legacy should be upheld. You may have to be able to connect all the dots, though - retrace the history of name change and transition to another gender.
Given the strong historical links between English and American law, I would be surprised if the rule would be different in UK.