IMG-672 Clean up code for getting images from xhtml.