Reputation: 44114
<root>
<function name="lala">
<metadata name="foo" />
</function>
<function />
...
</root>
In the XML tree above, how can I select the one (or first) function
containing a metadata
with @name
being "foo" in an ActionScript 3 E4X expression?
What I've tried, but doesn't work, is:
// should trace "lala", traces ""
trace(root.function.(contains(metadata.(@name=="foo"))).@name);
Upvotes: 0
Views: 552
Reputation: 44114
This works, but it's a bit ugly
trace(XML(root.function.metadata.(@name=="foo")).parent().@name);
Upvotes: 1