Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7070247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:32:38+00:00 2026-05-28T05:32:38+00:00

I have the following Xquery code: for $w in $words let $freq := (count($corpus[.

  • 0

I have the following Xquery code:

for $w in $words
let $freq := (count($corpus[. eq $w]) div count($content2[text() eq $w])) 
order by $freq descending
return <tr><td>{$w}</td><td>{$freq}</td></tr>

$words is some distinct words that appears (may appear multiple times) in $corpus. $content2 is some another bag of words. Variables and division is not that important.

This xquery lists some frequency calculation of words, ordered.

What I want to do is limit the results by 10.
I tried to use positional values but as it gives me the position of the word in the word list, it didnt work out..

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:32:38+00:00Added an answer on May 28, 2026 at 5:32 am

    Use subsequence($sequence, $start, $records) to return a subset of results, starting at record $start (be aware XQuery counts from 1) returning records items. Have a look at “Limiting Result Sets” XQuery Wikibooks Page. An example of how to apply the function copied from this page:

    let $sorted-people :=
       for $person in collection($collection)/person
       order by $person/last-name/text()
       return $person
    
    for $person at $count in subsequence($sorted-people, $start, $records)
    return
       <li>{ $person/last-name/text() }</li>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
In XQuery, How do you order by ascending and descending? I have got the
I have following code in VS2008 If Linq.Enumerable.Contains(Of String)(selectedUsersRoles, RoleCheckBox.Text) Then RoleCheckBox.Checked = True
I have following code: <div class='parent'> <div class='left-child'></div> <div class=right-child></div> </div> What I want
Have following Java code,that creates StringBuilder with \n,i.e. carriage return delimiters: while (scanner.hasNextLine()){ sb.append(scanner.nextLine()).append(\n);
I have following text in a file 23456789 When I tried to replace the
I have following Code Block Which I tried to optimize in the Optimized section
I have a xml file <text> <defalut>This file has the following features:</defalut> <value> <ul>
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
I have following code that creates Linq query. I've never used Linq until today

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.