Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XPath Query Fails [Thread Next] Re: XPath Query FailsTo: NULL Date: 8/1/2004 3:15:00 PM You may want, (//foo[1]//bar)[2] or //for[1]/descendant::bar[2] Both are same. However, //foo[1]/bar[2] means, //foo[1]/descendant-or-self::node()/bar[2] both are same. That means the second child of the parent of <bar>, i.e. <c>. If there are lots of <c>s, and if they have more then one <bar>, the last two xpath will select all of the second <bar>s. The abbreviated operators sometimes can be confusing. Use full path. "gilly3" <news@N...> wrote in message news:Xns952F7801EF57BnewsNOSPAMgilly3com@2...... > Why does my XPath Query Fail? > > If this is my xml: > > <a> > <b> > <foo> > <c> > <bar/> > </c> > <c> > <bar/> > </c> > </foo> > </b> > </a> > > Why does this XPath work: > > //foo[1]//bar[1] > > But not this one: > > //foo[1]//bar[2] > > Help! > > thanks > > -ivan. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
