dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: XML
Expertise: Advanced
Jan 15, 2008

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Using the << and >> XQuery Operators

When you want to determine the order of articles into an sequence returned by an XQuery query, you can use the << and >> operators:

    - X << Y: is true if X is before Y;
    - X >> Y: is true if Y is before X;
For example, suppose you have the following sequence of strings:

Shark, Daisy, Hunter, Lego, Helly
Use this query:

let $xml:=doc(?file:///C://Data_Local//xml//AirWings.xml?)
for $a in $xml/company/aircrafts
  for $b in  $xml/company/aircrafts
   return(if($a/type<<$b/type) then concat($a/type/@M,"--]",$b/type/@M)
 	else concat($a/type/@M,"[--",$b/type/@M)
   )
The query returns:

Shark[--Shark, Shark--]Daisy, Shark--]Hunter, Shark--]Lego,
Shark--]Helly, Daisy[--Shark, Daisy[--Daisy, Daisy--]Hunter,
Daisy--]Lego, Daisy--]Helly, Hunter[--Shark, Hunter[--Daisy,
Hunter[--Hunter, Hunter--]Lego, Hunter--]Helly, Lego[--Shark,
Lego[--Daisy, Lego[--Hunter, Lego[--Lego, Lego--]Helly ,
Helly[--Shark, Helly[--Daisy, Helly[--Hunter, Helly[--Lego,
Helly[--Helly
Leonard Anghel
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date