https://medium.com/@dimitrenovatchev/mutual-recursion-with-anonymous-inline-functions-in-xpath-3-0eb7c961806f