Arbortext Command Language > Functions by Alphabetical Listing > xpath_valid
  
xpath_valid
xpath_valid (expr)
This function checks the syntax of an XPath expression without evaluating it. It does not validate namespace prefixes, element or attribute names. xpath_valid returns 1 if expr has correct syntax. If expr does not have correct syntax, the function returns 0 and stores an error message in the $main:ERROR variable.
This function has the following parameter:
expr — An XPath pattern.
Examples:
xpath_valid("foo()")
Returns 0, because foo is not an XPath function.
xpath_valid("foo/bar")
Returns 1, regardless of whether foo and bar are valid element names or not.
xpath_valid("myns:foo/bar")
Returns 1.