xml: { tmpath: { for $x in /person[who#bornIn#place[city:paris]] sortBy $x/lastName return xml: { tmpath:{!$x/fullName} tmpath:{ for $opera in $x/who#isAuthorOf#what[hasType(opera)] sortBy $opera/name return xml: { tmpath:{!$opera/name} } } } } } } wiki: { !!!People\\ \\ tmpath: { for $x in /person[who#bornIn#place[city:paris]] sortBy $x/lastName return wiki: { Full name: tmpath:{!$x/fullName}\\ Wrote following operas:\\ tmpath: { for $opera in $x/who#isAuthorOf#what[hasType(opera)] return wiki: { * tmpath:{!$opera/name}\\ } } } ---- } !!!End Of The List\\ }