order by stateCt : order by « XQuery « XML

Home
XML
1.CSS Style
2.SVG
3.XML Schema
4.XQuery
5.XSLT stylesheet
XML » XQuery » order by 




order by stateCt


File: Data.xml


<order>
  <car dept="A">
    <number>1</number>
    <name language="en">name 1</name>
  </car>
  <car dept="B">
    <number>2</number>
    <name language="en">name 2</name>
  </car>
  <car dept="B">
    <number>3</number>
    <name language="en">name 3</name>
  </car>
  <car dept="C">
    <number>4</number>
    <name language="en">name 4</name>
  </car>
</order>


File: Query.xquery


for $prod in doc("Data.xml")//car
where $prod/@dept = "B"
order by $prod/name
return $prod/name


Output:

<?xml version="1.0" encoding="UTF-8"?>
<name language="en">name 2</name>
<name language="en">name 3</name>

 














Related examples in the same category
1.order by clause demo
2.The order by clause
3.Using multiple inventorying specifications
4.Inadvertent resorting in document inventory
5.without inadvertent resorting
6.Using an inventory comparison
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.