XSLT name() function is evil and should be avoided just like GoTo.
Test code is attached below.
You should not be using name() function even if you have namespaces turned off.
Saxon (and perhaps some other processors) contain an optimization that translates XML qualified names into packed integer structures (see NamePool in Saxon).
So, using name() function bespoke potential problems also makes your XSLT code slow.