The function prefix() does not always return the correct result when the underlying node is a (Saxon-wrapped) DOM node.
This is because Saxon simply calls the DOM getPrefix() method, which is specified like this: "For nodes ... created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. " Saxon of course has no idea whether the node was created with a DOM Level 1 method, and has no way of finding out, so this method of determining the prefix is unsound.
A consequence of this error is that when attribute nodes are copied using xsl:copy-of, the prefix of the attribute name may be omitted, causing the attribute to be in the wrong namespace.
This problem is present in all known previous releases. A patch is being raised in Subversion for 9.0 and 9.1.
Fixed in 9.1.0.3