Parse XSLPattern queries and translate them into equivalent XPath queries.
XSLPattern built-in functions/operators are translated to their XPath
counterparts where applicable. If no direct XPath counterpart exists,
they are registered as custom XPath functions for the sake of speed where
possible. As a last resort, they are translated into compound XPath
expressions to accomplish the task, if more slowly.
If the parser encounters an error, the original XSLPattern query is
returned, as this is more likely to work than a mangled one.