HXQ-0.4: data/q1.xq
define function f ( $x, $y ) = <student>{$x,' ',$y}</student>;
<students>{
for $s in doc('data/cs.xml')//gradstudent
orderby $s/gpa descending, $s//lastname
return f( $s/name, $s/gpa/text() )
}</students>
define function f ( $x, $y ) = <student>{$x,' ',$y}</student>;
<students>{
for $s in doc('data/cs.xml')//gradstudent
orderby $s/gpa descending, $s//lastname
return f( $s/name, $s/gpa/text() )
}</students>