XPath Syntax - which is best?

state:actioned()=true()
state:actioned()=true
state:actioned()=1
state:actioned()

Are all of those valid and one in the same Depending on which document or sample I'm looking at I see all flavors.



Answer this question

XPath Syntax - which is best?

  • Noa

    I guess I am just clarifying that there is no difference between them in terms of execution or meaning.


  • LouisVanAlphen

    The second one (focused()=true) is an error, since true by itself is undefined. The rest are equivalent, but yeah, having no RHS is less typing.

    Note that any non-empty string is converted to true, so you could have focused()='0' or focused()='false' or even focused()='Jack Sparrow' and they would all be equivalent to true().

    Only focused()=0 or focused()=false() or focused()='' or not(focused()) are really false.



  • derekyeong

    Thanks for the clarification.


  • Stas Kravets

    I've been using the last: less typing. :)

  • XPath Syntax - which is best?