added support for $selectedNode, $first, $middle, $last, $odd and $even in tree label scope