> The biggest performance gain in this PR isn't actually the XSLT though (although I think that helped as well). The most important improvement is extracting the `px:mediaoverlay-rearrange` out from the `p:for-each` so that it is only invoked once instead of once for each content document.

Right, that was my assumption.

> we could replace the XPaths in the XSLT with the original XPath (feel free to do so if you think it's more readable)

OK, I'll do it for better readability then.