This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The algorithm given in section 18.6 of the XSLT 2.1 WD to define the behaviour of the snapshot() function is incorrect in the case where the supplied node is an attribute or namespace node. The expression <xsl:sequence select="$node/descendant-or-self::node()[$level]"/> which terminates the recursion is assuming that the original node is a descendant of the root, which is not the case if it is an attribute or namespace. The fix for this isn't easy, because when the original node is an attribute or namespace, all the attributes and namespaces of its parent element will be copied, so the only way we can find the right one is by name. One solution might be to build a path to the node and then evaluate that path using xsl:evaluate.
I have redesigned the algorithm for the snapshot() function and I believe the new code solves this problem. I'm therefore recording this as fixed.