Say I have the following XML...
It's not pretty. As with any lookup, you need to use current():
/root/bucket[/root/base/tent[@key = current()/tent/@key]/@color = 'blue' or /root/base/tent[@key = current()/tent/@key]/@color = 'red']