There is a slight restriction on \xmlrefatt that makes its use problematic, because it does not differentiate between an absent attribute and an attribute consisting of an empty string.
The use for \xmlrefatt I had in mind was (a) do nothing if the attribute is absent, and (b) reset some value to its default value when the attribute is present but an empty string.

Is it an option that its implementation is changed? A boolean return value will be fine, because false then can signify the attribute’s absence and true its presence. In the latter case it is safe to retrieve the attribute which then might be an empty string.

Summarizing: the fact that \xmlrefatt tries to do two different things at the same time (signalling presence/absence) and returning an attribute, in a certain sense cripples its use.

dr. Hans van der Meer