From: Peter W. <pet...@ke...> - 2012-12-21 16:49:33
|
Yes, I confirm that I could not get the alternatives to work in the XPath either. Peter On 21/12/2012 15:54, Jens Østergaard Petersen wrote: > > On Dec 21, 2012, at 2:20 PM, Adam Retter <ad...@ex... > <mailto:ad...@ex...>> wrote: > >> >> 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 > > Well, then a sequence has to be introduced in the XPath, > > collection('/db/punch/data')//(tei:persName, > tei:placeName)[@corresp=$corresp] > > Strangely, eXist does not handle this correctly, ignoring all but the > first item in the sequence .... > > Jens > >> >> >> -- >> Adam Retter >> >> eXist Developer >> { United Kingdom } >> ad...@ex... <mailto:ad...@ex...> >> irc://irc.freenode.net/existdb <http://irc.freenode.net/existdb> >> ------------------------------------------------------------------------------ >> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial >> Remotely access PCs and mobile devices and provide instant support >> Improve your efficiency, and focus on delivering more value-add services >> Discover what IT Professionals Know. Rescue delivers >> http://p.sf.net/sfu/logmein_12329d2d_______________________________________________ >> eXist-TEIXML mailing list >> eXi...@li... >> https://lists.sourceforge.net/lists/listinfo/exist-teixml > > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > > > _______________________________________________ > eXist-TEIXML mailing list > eXi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-teixml |