[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Position operator

Michael Kay mhk at mhk.me.uk
Mon Jan 23 09:08:59 PST 2006


position operator
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.