In the previous example you were outputting an attribute m:contextKey that caused the m namespace to be declared.
In this example you are outputting an attribute m:id that causes exactly the same effect, and the remedy is exactly the same.
I'm sorry I'm having so little success in explaining this to you.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference