You're thinking too procedurally. You don't need to break; you don't even need to loop.
Your entire procedure can and should be reduced to a single XPath expression:
string(contains(TEST/ABC/DEF/GHI/Row/*[self::JKL or self::MNO]/Category, '123'))
That's it. No loop. No break. Just tests against the input XML and an optional conversion to string (which may or may not be necessary in your actual context).
Update after OP added input XML and desired output XML:
This XSLT,
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<item>
<xsl:if test="/xml/TEST/ABC/DEF/GHI/Row/
*[self::JKL or self::MNO]/Category = 123">
<cat>123</cat>
</xsl:if>
</item>
</xsl:template>
</xsl:stylesheet>
will produce the requested output XML,
<item>
<cat>123</cat>
</item>
if the original procedurally specified condition is true1, or this output XML,
<item/>
otherwise.
1 I took the liberty of also switching from a string contains test to a string value equality test, which is more likely what's desired here (else "1234" et al would also satisfy the test).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…