This code sample is adapted from Clifford B. Anderson and Joseph C. Wicentowski, XQuery for Humanists (College Station: Texas A&M University Press, 2020), 240. Download this code sample in its raw form. View the source on GitHub.

$corpus contains text
    ("librarian" ftor "libraries" ftor "library")
    ftand
    ("homelessness" ftor "homeless")
    distance at most 2 paragraphs