I don't remember the all syntax offhand, but you can pass any XML expression you want into the function. For example, "*" would be an xmllist of all children. I think "." would pass in the current "context" node (I think that would be the item node in this case). "parent()" would pass the parent node etc.
Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Carter Sent: Monday, September 22, 2008 11:45 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] e4x problem - filtering elements based on multiple child conditions Thanks - thats very useful - hadn't thought of that. Assumed it would not be possible. Whats the best way to get a handle on the item element from within the itemContains function? I would probably go with this approach: xlFilteredItems = _xmlData..group.(nameElementsContainAll(name,filters)); // assuming filters are lower case and distinct... private function nameElementsContainAll(nameElements:XMLList, filters:Array):Boolean { var matchedFilters:Array = new Array(); for each (var nameElement:XML in nameElements) { var matchIndex:int = filters.indexOf(nameElement.toString().toLowerCase()); var matchedFilter:String = filters[matchIndex]; if (matchedFilters.indexOf(matchedFilter) < 0) { // in case name appears multiple times in the group matchedFilters.push(matchedFilter); } } return matchedFilters.length() == filters.length(); } Tracy Spratt wrote: > > This is not a direct answer to your immediate question , but rather a > general tip: > > If you need complex calculations within an e4x expression, you can call > out to a function of your own. The () just requires a boolean value, so > you can do something like below, where I wanted to a bit of string > manipulation within the expression: > > xlFilteredItems = > _xmlData..item.(itemContains(attribute("item"),sFilterString)) > > > > and the function: > > private function itemContains(sItem:String, sMatch:String):Boolean > > { > > sItem = sItem.toLowerCase(); > > sMatch = sMatch.toLowerCase(); > > return (sItem.indexOf(sMatch) != -1); > > }//contains > > > > Tracy > -- View this message in context: http://www.nabble.com/e4x-problem---filtering-elements-based-on-multiple -child-conditions-tp19604364p19620894.html <http://www.nabble.com/e4x-problem---filtering-elements-based-on-multipl e-child-conditions-tp19604364p19620894.html> Sent from the FlexCoders mailing list archive at Nabble.com.