From: Wolfgang M. <wol...@ex...> - 2012-12-21 12:22:18
|
Hi Peter, > I'm trying to find a method of getting a program to branch depending on the parameter provided. After determining the selection, the following processes are identical. The following code will only provide data for $name-predicate. If I change the order, it works for a $place-predicate only. Isn't this what you would expect from an if statement? If $name-predicate is set, it will select the first clause and stop. You will always only get either the placeName or the persName elements returned. Please excuse if I'm misunderstanding what you are trying to do. I assume you want to search both, persName and placeName, if both parameters are set? In this case you need to combine the two selections, e.g. with a union: let $name-predicate := local:get-name-predicate(request:get-parameter('people','')) let $place-predicate := local:get-name-predicate(request:get-parameter('place','')) return (if($name-predicate) then (collection('/db/punch/data')//tei:persName[@corresp=$name-predicate]) else ()) union (if($place-predicate) then (collection('/db/punch/data')//tei:placeName[@corresp=$place-predicate]) else ()) Wolfgang |