HI Geert,

        cts:search(doc(), "*")[number(.//priority) eq 
number(.//eligible-flag)]

returns XDMP-ARGTYPE error.

<error:message>Invalid argument type</error:message> 
  <error:format-string>XDMP-ARGTYPE: (err:XPTY0004) 
number((doc("mohan.xml")/nodes/node[1]/priority, 
doc("mohan.xml")/nodes/node[2]/priority, 
doc("mohan.xml")/nodes/node[3]/priority, ...)) -- arg1 is not of type 
xs:anyAtomicType?</error:format-string> 

My xml content is :

    <nodes>
      <node>
             <priority>1</priority>
             <eligible-flag>1</eligible-flag>
      </node>
      <node>
             <priority>2</priority>
             <eligible-flag>2</eligible-flag>
      </node>
      <node>
             <priority>2</priority>
             <eligible-flag>0</eligible-flag>
      </node>
      <node>
             <priority>5</priority>
             <eligible-flag>2</eligible-flag>
      </node>
      <node>
             <priority>8</priority>
             <eligible-flag>1</eligible-flag>
      </node> 
</nodes>

Santhosh Rajasekaran
Tata Consultancy Services
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



Geert Josten <[email protected]> 
Sent by: [email protected]
05/06/2009 02:24 PM
Please respond to
General Mark Logic Developer Discussion <[email protected]>


To
General Mark Logic Developer Discussion <[email protected]>
cc

Subject
RE: [MarkLogic Dev General] Comparision of values within the node (was: 
[email protected])






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

ForwardSourceID:NT0000AE9A 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to