...assuming we don't already do this. As far as I know, we validate XML against a Relax NG schema only before expanding IDREFs. This doesn't ensure that the element with the referenced ID is actually valid in the given context.
We should definitely implement best practices in our schema code first. It's too convoluted to dive right into this task.
An XSL transform (using the XSL id() function) should be able to resolve the IDREFs, and then we can validate the transformed XML.
Origin: https://github.com/ClusterLabs/pacemaker/pull/3409#discussion_r1548573737