ancestor is


Return type:
Returns true if the element has the specified ancestor, and false otherwise. Replacing is with isnt reverses the result.
ancestor (of element-expression)? (is | isnt) namespace-modifier? (element-name | element-name-list)


ancestor is tests whether the element stack of the currently-active parse contains an instance of the element element-name, or one of the elements listed in element-name-list. element-name-list is a parenthesized list of elements, separated by |. Replacing is with isnt will reverse these results.

If element-expression is not specified, the test searches the element stack starting with the parent of the current element; the current element is not included in the search. If element-expression is specified, the search begins with the parent of the element specified by element-expression.

You can specify the name dynamically by using the identity operator (~) followed by a string expression: for example, to check for elements with an ancestor of the same name as the current element,

  element #implied when ancestor is ~(name of element)