|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Position operatorMichael Kay mhk at mhk.me.ukMon Jan 23 09:08:59 PST 2006
It's purely a matter of operator precedences: [] binds more tightly than /.
Read it, if you prefer, as
for $x in doc("book.xml")/descendant::node()
return $x/child::title[1]
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: http://xquery.com/mailman/listinfo/talk
> [mailto:http://xquery.com/mailman/listinfo/talk] On Behalf Of Ronald Bourret
> Sent: 23 January 2006 08:23
> To: xquery-talk
> Subject: Position operator
>
> I'm missing something obvious here.
>
> Suppose book.xml contains multiple title elements. Why does:
>
> doc("book.xml")//title[1]
>
> return a sequence of all title elements and:
>
> (doc("book.xml")//title)[1]
>
> return the first title element? I would have thought both
> queries would
> return the first title element.
>
> Thanks,
>
> -- Ron
>
> _______________________________________________
> http://xquery.com/mailman/listinfo/talk
> http://xquery.com/mailman/listinfo/talk
>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






