E4X filtering based on descendant attribute values

I’m having hard time reaching the right nodes here. The XML structure is like this:


<map>
	<y>
		<rs>
			<r>
				<cs>
					<c n="egypt">
						<is>
							<i t="f/e/v">
						</is>
					</c>
				</cs>
			</r>
		</rs>
	</y>
</map>

[LIST]
[]rs = regions where r = one region
[
]cs = countries, where c is one country
[*]is = companies, where i = one company
[/LIST]

The company nodes (“i”) has a type attribute (“t”) with a value of either e, f or v and the country nodes (“c”) have a name attribute (“n”).

I’m trying to return a list of names for countries that contain company nodes with t value of f, so here are some of my attempts. None of them work.


_xml.y.rs.r.cs.c.(child("is").i.@t == "f").@n
_xml.y.rs.r.cs.c.(child("is").(i.@t == "f")).@n
_xml.y.rs.r.cs.c.(child("is").i.(@t == "f")).@n

The problem is that the selector either returns too many or too few nodes.