How about put the path to the element in your cts:search xpath. Something like:

cts:search( doc("doc")/doc/name , cts:element-value-query( xs:QName("name") , 
"Sub Part")  )

If you need to get back to the doc node, you can XPath your way up there using 
/parent::doc or something similar.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Geert Josten
Sent: Monday, December 21, 2009 7:09 AM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] How to get cts:element-value-query() to 
not decend to the depths of Hades

Hi David,

I guess you would be looking for something like 
cts:element-child-value-query(), but unfortunately it doesn't exist..

I see no other way than to change your XML structure. cts:not-query is not 
likely to help you out..

Kind regards,
Geert



Drs. G.P.H. Josten
Consultant




Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl<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 Lee, David
Sent: maandag 21 december 2009 14:16
To: [email protected]
Subject: [MarkLogic Dev General] How to get cts:element-value-query() to not 
decend to the depths of Hades
I have a XML doc (not my own design) something like
<doc>
   <name>Title</name>
   <part>
       <name>Part</name>
       <subpart>
            <name>Sub Part<name>
    </subpart>
   </part>
  ...

</doc>


I want a cts:search  query that will match <name>Title</name> but not <name>Sub 
Part<name> or other names.

cts:search( doc("doc")/doc , cts:element-value-query( xs:QName("name") , "Sub 
Part")  )

matches when I do not want it to.   How can I restrict cts:element-value-query 
from matching descendant  nodes ?
I looked at adding an and-not-query but that wont work because its possible for 
multiple name elements to have the
same value and I dont want a match discarded just because it matched in 
multiple places.

Any suggestions ?






----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected]<mailto:[email protected]>
812-482-5224




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

Reply via email to