declare namespace x = "http://www.w3.org/1998/xhtml"; { for $i in doc("testResult.xml")/tests/test[@status = "failure"] order by $i/@name return {$i/@name} }