The xml:base fixup was broken in more complex cases. Also avoid parsing and building the included URI multiple times.