Hi Abishek, Xdmp:unquote is used to convert xml encoded as a string (for instance, XML received from HTML form submit request parameters) into nodes. You are looking for evaluation of an XPath. In your case I'd recommend using xdmp:value for that. Just replace xdmp:unquote with xdmp:value and that should do the trick..
Kind regards, Geert Van: [email protected] [mailto:[email protected]] Namens Abishek N Verzonden: vrijdag 18 februari 2011 0:56 Aan: [email protected] Onderwerp: Re: [MarkLogic Dev General] xs:string to xpath Apologies Missed out the actual question.. Is there a better way than the third approach that I had given? I similar to unquote I have also tried fn:QName but no luck Hello I know this sounds quite simple, but I have not been able to accomplish this. Let me consider the following eg. I am trying to run a search on a single document on the fragment root //ns:address xquery version "1.0-ml"; declare namespace ns = "http://www.addware.com/xmlschemas/report/1"; let $result := cts:search(//ns:address, cts:and-query(( cts:document-query("doc.xml"), ((cts:element-range-query(xs:QName("ns:name"),"=","John Doe"))))),'unfiltered') similarly based on the request if i were to run the search based on the user name in various fragment roots for eg //ns:insurance or //ns:contactnumber based on the user name can I parameterize the fragment root //ns:address such that I dont have to write multiple search queries? here is what I tried, lets say I have a metadata xml file which tells be if the request is for "ad", then look for the results in the fragment roots //ns:address if it for "phone", then look for results in the fragament root //ns:contactnumber which would be returned as a xs:string even though I read it from the metadata file, when I do an unquote it tells me that this is not a search able expression. metadata file would be like this <list> <frags> <type>ad</type> <searchfrag>//ns:address</searchfrag> </frags> <frags> <type>phone</type> <searchfrag>//ns:contactnumber</searchfrag> </frags> <frags> <type>ins</type> <searchfrag>//ns:insurance</searchfrag> </frags> </list> let $result := cts:search(xdmp:unquote("//ns:address"), cts:and-query(( cts:document-query("doc.xml"), ((cts:element-range-query(xs:QName("ns:name"),"=","John Doe"))))),'unfiltered') i found an another way let $result := cts:search(if($attr="ad") then //ns:address else if ($attr="phone") then //ns:contactnumber else //ns:insurance, cts:and-query(( cts:document-query("doc.xml"), ((cts:element-range-query(xs:QName("ns:name"),"=","John Doe"))))),'unfiltered') Thanks AN
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
