From: Adam R. <ad...@ex...> - 2012-12-21 13:21:04
|
> > > 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 > I think you could also avoid the union altogether. Wolfgang, would this be more efficient? let $corresp := (local:get-name-predicate(request:get-parameter('people' ,'')), local:get-name-predicate(request:get-parameter('place,''))) return collection('/db/punch/data')//tei:persName[@corresp=$corresp]) Thats the beauty of a language without null's where an empty sequence is a perfectly valid 'thing' to operate upon :-p -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |