Fixed bug with OPF image <item> generation

Fixed bug that was causing multiple `<item>` elements to be generated in the OPF manifest for the same image if that image was referenced in more than one `<img>` `src` attribute.

Also did some miscellaneous refactoring and cleanup to make XSL more test friendly and potentially more compatible with XSLT processors less tolerant than xsltproc.