[MarkLogic Dev General] Comparision of values within the node
(was: general@developer.marklogic.com)
deepak mohan
dpk_bio007 at yahoo.co.in
Wed May 6 02:40:24 PDT 2009
Hi Geert,
Thank you very much. Your first case works for me.
best regards,Deepak M.
--- On Wed, 6/5/09, Geert Josten <Geert.Josten at daidalos.nl> wrote:
From: Geert Josten <Geert.Josten at daidalos.nl>
Subject: RE: [MarkLogic Dev General] Comparision of values within the node (was: general at developer.marklogic.com)
To: "General Mark Logic Developer Discussion" <general at developer.marklogic.com>
Date: Wednesday, 6 May, 2009, 2:24 PM
Hi Deepak,
To my knowledge, you cannot express a comparison between node values in cts:query functions. You will have to search for documents containing these elements first with cts:search, and apply a XPath predicate on the resulting nodes, which restricts the results to the nodes that meet your criterium. For instance by doing something like this:
cts:search(doc(), "*")[number(.//priority) eq number(.//eligible-flag)]
Though, if you know the exact values you are searching, then you can simply test for those values in both elements. For instance like:
let $some-values := ("1", "2", "3")
return
cts:search(doc(),
cts:and-query((
cts:element-value-query(xs:QName("priority"), $some-values),
cts:element-value-query(xs:QName("eligible-flag"), $some-values)
))
)
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: general-bounces at developer.marklogic.com
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of
> deepak mohan
> Sent: woensdag 6 mei 2009 10:19
> To: general at developer.marklogic.com
> Subject: [MarkLogic Dev General] general at developer.marklogic.com
>
>
> Hi Chaps,
>
> I want to search for a node based on the comparision of
> values within the node. Could you please send me a cts:query
> for the above critertia.
>
> for eg: The node looks like this:
>
> <node1>
> <priority>1</priority>
> <eligible-flag>1</eligible-flag>
> </node1>
> <node2>
> <priority>2</priority>
> <eligible-flag>2</eligible-flag>
> </node2>
> <node3>
> <priority>2</priority>
> <eligible-flag>0</eligible-flag>
> </node3>
>
> I want to select the node if the priority and eligible has
> the same value....
>
> thanks in advance,
> Deepak M.
>
>
>
>
>
>
>
> ________________________________
>
> Now surf faster and smarter ! Check out the new Firefox 3 -
> Yahoo! Edition * Click here!
> <http://in.rd.yahoo.com/tagline_firefox_1/*http://downloads.ya
> hoo.com/in/firefox/?fr=om_email_firefox>
>
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
Bring your gang together. Do your thing. Find your favourite Yahoo! group at http://in.promos.yahoo.com/groups/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20090506/0ccce826/attachment.html
More information about the General
mailing list