XSLT is designed so that the result tree can be produced in document order; this means there is a rule that you can't add attributes to an element after you have added children to the element (the rule isn't expressed in this way, because there's no notion of time, but it amounts to the same thing.)
Have you tried running this with the -T tracing option? It gives you more information about what's going on.
However, I have to say I found this one quite tricky to debug myself. What's happening is that the match="*" template for <MESSAGE_SUMMARY> is first copying the whitespace text node immediately after the start tag; then when it hits the IN_TO_XYZ element it's firing the rule that creates the attribute node, and you can't create an attribute after creating a text node, even if the text node is all whitespace.
If you fix this, for example by stripping whitespace, you still hit the problem later on with the <IN_TO_PQR> element.
I wonder what output you were actually trying to create? Was it deliberate that the IN_TO_XYZ and IN_TO_PQR elements aren't being copied, and that the alert attribute are (both!) being added to the MESSAGE_SUMMARY element?
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference