(: A procedure to select the contents of the "chat" interventions :) declare boundary-space strip; let $doc := doc($arguments[1]) let $isdrew := $arguments[2] = "Drew" let $starttime := if ($isdrew) then $doc/trace/event[1]/time/date else $doc//record[1]//@millis let $endtime := if ($isdrew) then $doc/trace/event[last()]/time/date else $doc//record[last()]//@millis return meta {xs:string($starttime)} {xs:string($endtime)} {if ($isdrew) then "forestxml" else "xml"} tracefiles/{$arguments[3]} {$arguments[2]} {xs:string($starttime)} {xs:string($endtime)} 0