On Thu, 2011-10-06 at 21:25 +1100, Michael Chapman wrote: > On Wed, 5 Oct 2011, David Lutterkort wrote: > > So far, nobody has needed that distinction, but it would be easy enough > > to add a null function to the language so that you could pick out nodes > > with null values, i.e. something like > > > > match test/*[null(.)] > > > > which, in your example, would match /test/b > > A null() function would be useful, however I'm not sure it should take a > nodeset as an argument. It doesn't make sense for it to be applied to more > than one node.
The reason I said nodeset is that there's no type internally for just a node. There's two ways we can deal with passing more than one node: (1) return true only if all the nodes have null values (2) throw an error. I am inclined to do (1) > Perhaps it should be a no-argument predicate, "this node has no value". It would be more flexible if it takes an argument; I might do both, i.e. make the argument to null() optional. > Another question arises from all this: how would you match only non-null > nodes? Good point. We seem to be missing the boolean 'not' operator. I am very tempted to do what XPath does and make not a function. With that, you'd write match /test/*[not(null())] David _______________________________________________ augeas-devel mailing list augeas-devel@redhat.com https://www.redhat.com/mailman/listinfo/augeas-devel