XSLT is a declarative language so it doesn't have loops. The xsl:for-each instruction, which you might think of as a loop, is actually a mapping expression. That means it doesn't make sense to think of breaking out of it once some condition is found.
If you want to find all the nodes that appear in both an @From and an @To attribute, that's
/Root/Relations/@To[. = /Root/Relations/@From]
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference