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 }
adam@exist-db.org
irc://irc.freenode.net/existdb