> -----Ursprungligt meddelande-----
> Fr�n: Jeroen Breedveld [mailto:[EMAIL PROTECTED]
> Skickat: den 8 augusti 2001 12:46
> Till: [EMAIL PROTECTED]
> �mne: RE: Correction
> 
> 
>  | -----Original Message-----
>  | From: [EMAIL PROTECTED] 
>  | [mailto:[EMAIL PROTECTED]
>  | Behalf Of Gannholm Torbj�rn
>  | Sent: zaterdag 4 augustus 2001 08:50
>  | To: '[EMAIL PROTECTED]'
>  | Subject: Correction
>  | 
>  | 
>  | > -----Ursprungligt meddelande-----
>  | > Fr�n:    Gannholm Torbj�rn 
>  | > Skickat: den 3 augusti 2001 13:31
>  | > Till:    '[EMAIL PROTECTED]'
>  | > �mne:    Positioning results of insert, append and move
>  | > 
>  | > 
>  | > Actually the xpath becomes more interesting in the case:
>  | > /customers/addresses/address[1]
>  | > because in this case there could be several addresses 
>  | > elements, so the expression could actually refer to a 
>  | node-set, while
>  | > /customers/addresses/address[first()]
>  | > would refer to just one node, the first element that fits the 
>  | > description.
>  | 
>  | Sorry, above is wrong. XPath does not have a first() function. The
>  | expression /customers/addresses/address[1] is always just 
>  | the first child in
>  | the whole document to match the expression.
> 
> Is that true? Doesn't that XPath query return all the first address
> elements of all the adresses elements?

I never really got quite clear on that. It depends on the context that the
[1] is evaluated in.

But it turns out you are right after a quick experiment with xt.

The [1] binds hardest, so to get just the first of all elements you have to
write '(/customers/addresses/address)[1]'. Glad I finally understood how
that works!


/tobe

----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact administrator:  mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------
  • Correction Gannholm Torbj�rn
    • Gannholm Torbj�rn

Reply via email to