Pass all stack information to validator

This allows access to more information than is available in xpath, like namespace information for ancestor nodes. This allows implementing #141 as a validator.