all groups > dotnet xml > june 2006 >
You're in the

dotnet xml

group:

TOP clause with XPath


TOP clause with XPath Mario Vázquez
6/30/2006 12:00:00 AM
dotnet xml: Hi,
Is there any way to simalate the SQL TOP clause using XPath?
Or, in other words, how to get a fixed number of nodes through a XPath
query?

Thanks,
Mario Vazquez

Re: TOP clause with XPath Martin Honnen
6/30/2006 2:22:34 PM


[quoted text, click to view]


[quoted text, click to view]

Sure, do e.g.
(originalXPath)[position() >= 1 and position() <= 20]
to get the first 20 nodes (if there are as many).
So using a predicate and the position function allows you to
select/filter out a certain number. If you just want a certain number
then e.g.
(originalXPath)[10]
gives you the tenth node.


--

Martin Honnen --- MVP XML
Re: TOP clause with XPath Mario Vázquez
6/30/2006 3:59:47 PM
Thanks!

"Martin Honnen" <mahotrash@yahoo.de> escribió en el mensaje
news:uIJUg$DnGHA.3340@TK2MSFTNGP02.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button