John L. Clark wrote:
> Run the doXPathSearch command, and enter '//listitem' at the prompt.
> Looking good, this selects the first listitem (with an id of
> 'top-list1') in the document (in document order), as you would expect.
> Now how about '//listitem[2]'? This actually selects the listitem with
> an id of 'bottom-list2', which is the *third* listitem in document
> order. I would have expected it to select the listitem with an id of
> 'bottom-list1'. Is there something "interesting" going on with the
> XPath evaluation here?
Result is correct. //listitem[2] will select all listitems that are
second childs of its parent. It is because it is shorthand for
/descendant-or-self::node()/child::listitem[2]. For your desired result,
you should use (//listitem)[2].
Jirka
--
------------------------------------------------------------------
Jirka Kosek e-mail: jirka at kosek.cz http://www.kosek.cz
------------------------------------------------------------------
Profesion?ln? ?kolen? a poradenstv? v oblasti technologi? XML.
Pod?vejte se na n?? nov? spu?t?n? web http://DocBook.cz
Podrobn? p?ehled ?kolen? http://xmlguru.cz/skoleni/
------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3158 bytes
Desc: S/MIME Cryptographic Signature
Url :
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20050525/3006f0c1/attachment.bin