Accessing hierarchy from template