Modifies xpath so that a count() function will return a number rather
than erroring out. Adds required namespaces to the namespaces in core.