If it is possible to write custom rules in javascript using Xpath method?

As has been communicated previously, please try and keep to one question per thread, and provide as much context as possible (what you are trying to accomplish, what you have tried, and what has happened so far).

I am closing this thread as we have answered the question at hand.