0
votes
<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);
1

1 Answers

1
votes

This works, but it's a bit ugly

trace(XML(root.function.metadata.(@name=="foo")).parent().@name);