Loading TOC...

cts:contains

cts:contains(
   $nodes as item()*,
   $query as cts:query
) as xs:boolean?

Summary

Returns true if any of a sequence of values matches a query.

Parameters
$nodes The nodes or atomic values to be checked for a match. Atomic values are converted to a text node before checking for a match, which may result in an error if the value cannot be converted.
$query A query to match against. If a string is entered, the string is treated as a cts:word-query of the specified string.

Example

cts:contains(//PLAY
  [TITLE="The Tragedy of Hamlet, Prince of Denmark"]
      /ACT[3]/SCENE[1],
    cts:word-query("To be, or not to be"))
  => ..true, if ACT II, SCENE I of Hamlet contains
    the phrase "To be, or not to be" (it does).

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.