Hi Geert,
    Thank you very much. Your first case works for me.
best regards,Deepak M.


--- On Wed, 6/5/09, Geert Josten <[email protected]> wrote:

From: Geert Josten <[email protected]>
Subject: RE: [MarkLogic Dev General] Comparision of values within the node 
(was: [email protected])
To: "General Mark Logic Developer Discussion" <[email protected]>
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: [email protected]
> [mailto:[email protected]] On Behalf Of
> deepak mohan
> Sent: woensdag 6 mei 2009 10:19
> To: [email protected]
> Subject: [MarkLogic Dev General] [email protected]
>
>
> 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
[email protected]
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/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to