简体   繁体   中英

XQuery to Order elements(xi:include) in an xml file

Do any one know how to order elements in XML file. I have a course XML file and my course XML file has 5 units which are referenced as xi:include .

Each unit in turn has a unitsequencenumber element. I need to have my course XML returned with unit references ordered based on unitsequencenumber .

Use order by :

for $e in doc('filename.xml')/unit
order by $e/unitsequencenumber
return $e 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM