Subj : Re: referring to the "context node" in XML filtering predicate with To : Martin.Honnen From : Brendan Eich Date : Fri Apr 01 2005 10:44 pm Martin Honnen wrote: > > E4X section 11.2.4 describes the XML filtering predicate operator. In > the predicate I would like to call a method of the XML object the > filtering predicate is applied to e.g. > xmlObject..*.(nodeKind() == 'text') > however both Rhino and Spidermonkey then tell me that nodeKind is not > defined. Is there any way to call a method in the predicate or is the > predicate only able to access non function properties (i.e. the child > elements by name or the attributes by @attributename)? E4X has what I call a bug where method names are hidden from the normal property lookup mechanism, even though the spec says they're function-valued properties of XML.prototype and XMLList.prototype. We are talking about fixing this with a function namespace. I've prototyped this in SpiderMonkey such that (with a fix just checked in today) the following works: $ cat fn.js xmlObject = hithere l = xmlObject..*.(function::nodeKind() == 'text' && print(function::toXMLString())) $ Linux_All_DBG.OBJ/js -x fn.js hi there The function reserved identifier, when used as a namespace prefix, identifies an internal namespace whose URI is guaranteed not to collide with any valid URI. This namespace allows qualified access to function valued properties of XML.prototype (i.e., methods). /be .