declare namespace cristal "http://cristal-ise.org/"; declare function cristal:getOutcomeFromView($coll as xs:string, $view as node()) as xs:string { string-join(($coll,'/',$view,'Outcome.',$view/Viewpoint/@SchemaName,'.',$view/Viewpoint/@SchemaVersion,'.',$view/Viewpoint/@Last) ,'') }; declare function cristal:getOutcomeFromEvent($coll as xs:string, $event as node()) as xs:string { return string-join(($coll,'/','Outcome.',$event/Event/@SchemaName,'.',$event/Event/@SchemaVersion,'.',$event/Event/@ID),'') }; declare function cristal:getLastView($coll as xs:string, $schemaName as xs:string) as xs:string { string-join(($coll,'/','ViewPoint.',$schemaName,'.last'), '') } declare function cristal:getCollByType($typeName as xs:string) as xs:string* { for $prop in //Property[@name="CfCName"] let $itemColl := util:collection-name($prop) let $prodType := collection($itemColl)/Property[@name="Type"] where $prop eq $typeName and $prodType eq "Product" return $itemColl }; declare function cristal:getCollByName($name as xs:string) as xs:string* { for $prop in //Property[@name="CfCName"] let $itemColl := util:collection-name($prop) let $prodType := collection($itemColl)/Property[@name="Type"] where $prop eq $typeName and $prodType eq "Product" return $itemColl };