1. A method for executing a function in a query requesting data from a markup language document stored in a database, the markup language document organized hierarchically into nodes, the method comprising: receiving the query requesting data from the markup language document, the query including a function to be executed during execution of the query; determining nodes of the markup language document satisfying the query; deriving values of said nodes of the markup language document; and executing the function with said derived values and said nodes of the markup language document.