How-to break a for-each loop in XSLT?
XSLT is written in a very functional style, and in this style there is no equivalent of a break statement. What you can do is something like this:
...body of loop...
That way the for-each will still iterate through all the nodes, but the body of the loop will only be executed if the condition is true.