ModeShape/modeshape — pull request #738 by rhauch (2013-03-11 23:04:45+00:00)
Title: MODE-1680 Improves XPath functionality and corrects JCR-SQL2/JQOM when ORDER BY uses columns not in SELECT

Built upon a previously unmerged [pull-request](https://github.com/ModeShape/modeshape/pull/729) submitted by @okulikov that fixes an XPath for parsing error and adds support for the function `fn:name` and use of a child axis in `order by` clause. The latest commit changes improved the behavior of JCR-SQL2 and JCR-QOM queries that use columns not in the `SELECT` clause. Such columns are necessary within the query processing to evaluate the ordering, but are not to be exposed in the query results. One particular case needed by the recent XPath improvements (to handle order-by clauses that involve a property on the child node) resulted in the `ORDER BY` column coming from a selector that was not even included in the `SELECT`.

A test case added in Oleg's earlier commits was modified to verify the XPath and JCR-SQL2 behavior is as expected. Also added another query test that uses only JCR-SQL2.