I just spent an hour on a xr related bug/problem. Since this may be
encountered by others, please allow me to explain here for future
reference.
In docA.tex, a label is usually presented in the aux file as
\newlabel{ref}{{1}{1}}
and the xr package in docB can process it correctly.
However, if \usepackage{hyperref} is used in docA, the aux entry
becomes something like
\newlabel{ref}{{1}{1}{section\label {abs:ref}\relax }{section.1}{}}
and if hyperref is used in docB, it expects aux entries in this format....
The consequences of this are that:
1. if hyperref is in docA, but not in docB, xr package in docB will
display a long string like 1sectionsection.1 for \pageref{label}.
2. if hyperref is in docB, but not in docA, latex errors will occur.
SOLUTION: make sure that hyperref is used in both or neither of docA and docB.
Implication: if xr is implemented, hyperref should be loaded according
to its presence in docA. This can never be implemented cleanly. :-(
Bo