It's really a DOM-style implementation, and the namespace
axis just goes
up the tree and gathers up the nodes. So, this breaks when
you really on
generate-id() as a hack to implement node identity, and also
in the case,
where you use the parent axis. In the first case, there's no
work-around,
while in the second case, there is.
Saxon, as a matter of interest, does exactly the same thing internally, but
when you use the namespace axis explicitly it creates a transient namespace
node with the right parent pointer. This is sufficiently rare that the cost
hardly matters.
Michael Kay