Simplify the Xpath handling for Javascript