[augeas-devel] Distinguishing empty string from no value in path expressions

Michael Chapman mike at very.puzzling.org
Fri Oct 7 04:28:38 UTC 2011


On Thu, 6 Oct 2011, David Lutterkort wrote:
> 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)

That seems reasonable to me.

>> 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.

I don't think it's really necessary. Having to use "." explicitly isn't a 
problem, and none of the other XPath functions available have optional 
arguments.

>> 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())]

Sounds good.

- Michael




More information about the augeas-devel mailing list