extended position() function with JavaRosa-like behaviour when argument is provided, close #30