Re: [xsl] XPath that returns nothing

Subject: Re: [xsl] XPath that returns nothing
From: Liam R E Quin <liam@xxxxxx>
Date: Mon, 26 Sep 2011 21:49:56 -0400
On Mon, 2011-09-26 at 23:17 +0200, Olivier Lefevre wrote:
> What is the best XPath expression that is guaranteed to return nothing?
> (best in the sense of simplest, always works and costs as little as
> possible to evaluate). I was hoping it'd be the empty string but that
> seems forbidden.

*[0] or *[false()]
might do it in both xpath 1 and 2.

Hmm, depending on the evaluation context, /*[false()] is safer - e.g.
since this is the XSL list, you may not have a context item.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

Current Thread