No XSLT is involved.
Make function exit quickly (text nodes are most common).