PageRenderTime 9ms CodeModel.GetById 6ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

/xquery/retrieve-session-props.xql

http://transcriptstudio4isha.googlecode.com/
Unknown | 20 lines | 18 code | 2 blank | 0 comment | 0 complexity | 91f9655f9d23ab5f423ea56200dfaebe MD5 | raw file
 1xquery version "1.0";
 2
 3import module namespace functx = "http://www.functx.com" at "functx.xqm";
 4import module namespace utils = "http://www.ishafoundation.org/ts4isha/xquery/utils" at "utils.xqm";
 5
 6let $eventId := request:get-parameter('eventId', ())
 7let $sessionMetadataElements :=
 8	if (not(exists($eventId))) then
 9		$utils:dataCollection/session/metadata
10	else
11		$utils:dataCollection/session[@eventId = $eventId]/metadata
12return
13	<result>{
14		for $sessionMetadataElement in $sessionMetadataElements
15		let $sessionId := $sessionMetadataElement/parent::*/@id
16		let $resultItem := functx:add-attributes($sessionMetadataElement, xs:QName('_sessionId'), $sessionId)
17		order by exists($resultItem/@startAt), $resultItem/@startAt, $sessionId
18		return
19			$resultItem
20	}</result>