From: Jens Ø. P. <oe...@gm...> - 2012-12-21 16:31:39
|
On Dec 21, 2012, at 11:54 AM, Peter Watson <pet...@ke...> wrote: > Hi > > 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. I presume from this that this particular use of a conditional clause is invalid. What alternatives do I have for achieving the desired result? (Apart from separate XQueries which is where I am at the moment. I've also tried putting alternatives into the predicate which according to Presley p 46 I assume you mean Pris[cilla Walms]ley! > does seem to be legitimate - see below, but that does not work either). What is it you have found not to work? Jens > > Best wishes > > Peter > > let $name-predicate := local:get-name-predicate(request:get-parameter('people','')) > let $place-predicate := local:get-name-predicate(request:get-parameter('place','')) > let $selected-documents := > (if($name-predicate) then (collection('/db/punch/data')//tei:persName[@corresp=$name-predicate]) > else if($place-predicate) then (collection('/db/punch/data')//tei:placeName[@corresp=$place-predicate]) > else ()) > return $selected-documents > > Alternative predicate: > let $selected-documents := collection('/db/punch/data')//(if($name-predicate) then tei:persName[@corresp=$name-predicate] > else tei:placeName[@corresp=$place-predicate] ) > return $selected-documents > > Version: 2.0-tech-preview > SVN Revision: 15855 > Build: 20120228 > > ------------------------------------------------------------------------------ > 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 |