HI deepak,
If this is your xml file isteard of node1 and node2 and etc., You can
chage it to a common tag called node.
xdmp:document-insert("mohan.xml",
<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>
</nodes>)
then you can user normal flower expression to get the nodes, without
cts:search function you can get the particular nodes which is matching the
criteria . i.e ( priority value = eligible-flag value)
xquery is :
<nodes>
{
for $x in doc("mohan.xml")//node
where $x/priority = $x/eligible-flag
return $x
}
</nodes>
Note:
If you know the uri of the file than give that in the doc("mohan.xml")
function,
Even if you don't know the file name then simply use doc() still it will
return the same result. (basically it will search for all the files
matching the given criteria.)
<nodes>
{
for $x in doc( )//node
where $x/priority = $x/eligible-flag
return $x
}
</nodes>
output:
<nodes>
<node>
<priority>1</priority>
<eligible-flag>1</eligible-flag>
</node>
<node>
<priority>2</priority>
<eligible-flag>2</eligible-flag>
</node>
</nodes>
Regards,
Santhosh Rajasekaran
deepak mohan <[email protected]>
Sent by: [email protected]
05/06/2009 01:49 PM
Please respond to
General Mark Logic Developer Discussion <[email protected]>
To
[email protected]
cc
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!_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
ForwardSourceID:NT0000AE8A
=====-----=====-----=====
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