Hi Spike, I see two options: - replace your xpath with some query which can be passed as parameter and added to the and-query - pass the xpath as a string, use concat to make it a complete expression and use xdmp:value to execute the string expression
Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Grobstein, Spike > Sent: dinsdag 18 augustus 2009 16:15 > To: [email protected] > Subject: [MarkLogic Dev General] using function parameter as > context for cts:search > > Hi, > > > > I'm writing a cleanup function that takes a base context to > match to find documents that should be deleted: > > > > (: returns a sequence of URIs that should be deleted in the > context of $base_context (ie: /ra_document) that's older than > $duration :) > > declare function cleanup:find($duration as > xs:dayTimeDuration, $base_context as node()*) > > { > > let $query := > > cts:and-query(( > > cts:element-range-query(xs:QName('started_at'), '<=', > fn:current-dateTime() - $duration) > > )) > > for $doc in cts:search($base_context, $query) > > return (xdmp:node-uri($doc)) > > }; > > > > cleanup:find(xs:dayTimeDuration('P60D'), /some_document) > > > > ------------------8< snip -------------------------------------- > > > > When I run that, I get an error that the expression is unsearchable. > > > > What I'd like to do is provide a base context to do the > search on (ie: a document node type). > > > > Is there any way to do this? > > > > > > .spike > > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
