Previously, referencing an element that eventually pointed back to
the original <use> element would cause a stack overflow.
We now look at the referenced element and follow every <use> element
in its subtree and aim to detect any duplicates. If so, we consider
that referenced element invalid.