Solved

XPATH Limit number of results

Posted on 2006-11-29
2
2,298 Views
Last Modified: 2008-01-09

string l_search_string = @"//User[contains(translate(.,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),'" + l_search + "')]";
XmlNodeList l_list = l_doc.DocumentElement.SelectNodes(l_search_string);

I am doing a User Search and want to limit the number of result to say 10, is this possible using XPATH?

So if l_search is 'William' and there are 1000 williams I only want the frst 10

I tried adding [position () >= 10] but that does not give the desired result

I pass the result set to a DataList which displays results on a web page so i only want to display 10

Thanks

wc
0
Comment
Question by:williamcampbell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 125 total points
ID: 18043590
Hi williamcampbell,
> [position () >= 10]

well, you need [position () <= 10]

Cheers!
0
 
LVL 12

Author Comment

by:williamcampbell
ID: 18045410
Doh!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can I assign SimpleXMLElements to variables? 5 77
SQL Result Set to XML 4 58
XML Removal- Powershell 4 41
Import XML File into MS SQL table 3 12
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question