Fix fn:parent so it now crawls the entire stack of parent nodes until it finds one that matches the expected_attr_value