Arbortext Command Language > Functions by Alphabetical Listing > xpath_boolean
  
xpath_boolean
xpath_boolean (expr[, doc])
This function evaluates an XPath expression with respect to a document and returns 1 (true) if expr is true, otherwise it returns 0 (false).
expr — A valid XPath expression.
Do not use expressions that contain position() or last(). They do not work in this context. Use the preceding-sibling or following-sibling axes instead to achieve the desired results. For example:
count(preceding-sibling::*)=0 will test that the context node is the first child of its parent.
count(preceding-sibling::para)=1 will test that the context node is the second para child of its parent.
count(following-sibling::*)=0 is a viable alternative to position()=last()
doc — The identifier of the document tree to use as the context node. If omitted or 0, the current document is used.
A typical boolean expression will use one of the XPath boolean operators (=, !=, <, >, >=, <=). For example,
count(sect1)=0
Non-boolean results are converted to boolean using standard XPath rules:
The numbers zero (0) and NaN (not a number) are converted to false. Other numbers are converted to true.
Node set expressions returning at least one node are converted to true. Empty node sets are converted to false.
Strings are converted to true if they contain at least one character (including white space). Empty strings are converted to false.
* 
Because non-empty strings are converted to true, the string “false” and the expression “string(false())” are both converted to true.
To handle errors, call this function from within a catch.
Related Topics
oid_xpath_boolean function
xpath_integer function
xpath_nodeset function
xpath_string function