Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: position() in XPath query [Thread Next] Re: position() in XPath queryTo: NULL Date: 10/10/2007 11:17:00 AM Thanks a lot! I have tried the examples you provided. It's good to know how it works. Leszek "Joe Fawcett" <joefawcett@n...> wrote in message news:%237xsTURBIHA.464@T...... > "TarTar" <spam.spam@l...> wrote in message > news:%238uJJxPBIHA.4836@T...... >> Hi Dimitre, >> >> Thanks a lot! Now the code works like a charm. >> >> BTW >> Could you explain (or point to a resource) what's the differenece between >> //name[position() > 10] and (//name)[position() > 10] ? The former one >> (with brackets) works perfectly - but why? >> >> Leszek >> > The first retrieves name elements when they have a position() greater than > ten within their siblings. > The second one retrieves all the name elements as one node-set and then > filters them, removing the first ten. > An example: > > <data> > <names> > <name att="1" block="1"/> > <name att="2" block="1"/> > <name att="3" block="1"/> > <name att="4" block="1"/> > <name att="5" block="1"/> > </names> > <names> > <name att="1" block="2"/> > <name att="2" block="2"/> > <name att="3" block="2"/> > <name att="4" block="2"/> > <name att="5" block="2"/> > </names> > <names> > <name att="1" block="3"/> > <name att="2" block="3"/> > <name att="3" block="3"/> > <name att="4" block="3"/> > <name att="5" block="3"/> > </names> > </data> > > //name[position() > 3] gives: > <name att="4" block="1"/> > <name att="5" block="1"/> > <name att="4" block="2"/> > <name att="5" block="2"/> > <name att="4" block="3"/> > <name att="5" block="3"/> > > (//name)[position() > 3] gives: > <name att="4" block="1"/> > <name att="5" block="1"/> > <name att="1" block="2"/> > <name att="2" block="2"/> > <name att="3" block="2"/> > <name att="4" block="2"/> > <name att="5" block="2"/> > <name att="1" block="3"/> > <name att="2" block="3"/> > <name att="3" block="3"/> > <name att="4" block="3"/> > <name att="5" block="3"/> > > so if all the names are siblings anyway the two expressions give the same > result. > > -- > > Joe Fawcett (MVP - XML) > > http://joe.fawcett.name > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
