OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XPath expression

[ Lists Home | Date Index | Thread Index ]

>I want to make a XPath expression that finds the 5 first nodes that have a 
>attribute "namn" thats equals "Tomas". Is it possible?
>
>I suppose it should be something like this:
>//[@namn="Tomas"] [position()<6]

Something like that!

You forgot the * after //, but you also have the problem that
position() will return the position of the node amongst its matching
siblings, not amongst all the matching nodes.  You need to parenthesize
the first part of the expression to get the effect you want:

  (//*[@namn="Tomas"])[position()<6]

-- Richard

  • References:



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS