Fixes the test that runs against an invalid xml document.
Separates the reference rewrites into an isolated test case.