px:mediatype-detect is very slow for large filesets

This is an attempt to improve on that. A further optimization
could be to completely bypass the 'detect-from-namespace' parts
when 'in-memory' is empty and 'load-if-not-in-memory' is false.

@josteinaj Do these changes make sense? I've tried to run the tests but they failed already before I did the change. So I'm not sure I didn't break anything.

Btw, I have two other commits, if you want I'll push them:
1. one where I changed the giant p:choose into a single p:add-attribute + an inline XML document with the mappings between extension and mediatype. (Initially because I thought the p:choose was causing the issue, and now because it makes everything a bit more compact and easier to read.)
2. one where I run the tests from Maven, using my xproc-maven-plugin.