Hi Sai, There shouldn't be much difference from running code in CQ compared to running it from an xqy file. I suspect a configuration error. Make sure your xqy is running against the same database as you have selected in CQ.
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 > sai shanker > Sent: dinsdag 29 september 2009 16:00 > To: General Mark Logic Developer Discussion > Subject: Re: [MarkLogic Dev General] XQuery - working in cq > but not from code > > Hi Matt, > I have tried the namespace that you suggested but it is > giving me an error. > Also i don't have namespace in my xml document that is why i > am using *: wildcard namespace which is working fine without > any error. > <td align="left"> { $book/*:title/text() } </td> > > What i am suspecting is with the $query_string variable is > not getting substituted properly and hence the for is not > returning any result. > Thanks, > Sai. > > > > --- On Tue, 9/29/09, Matt Corkum <[email protected]> wrote: > > > > From: Matt Corkum <[email protected]> > Subject: Re: [MarkLogic Dev General] XQuery - working > in cq but not from code > To: "General Mark Logic Developer Discussion" > <[email protected]>, [email protected] > Date: Tuesday, September 29, 2009, 9:41 AM > > > Hi Sai -- > > It may be namespaces then. > > I do not see any default namespace declared in your > xquery. Sometimes these help if you have no declared name > space on your elements and functions. > > default element namespace = "" > default function namespace = "" > > take care -- > Matt > At 09:28 AM 9/29/2009, sai shanker wrote: > > > Hi, > I am running into issues with a small code > which executes perfectly fine in the cq but when it code to > code it fails:- > > my code for search.xqy is mentioned below:- > > ================================================================= > <html xmlns=" http://www.w3.org/1999/xhtml > <http://www.w3.org/1999/xhtml> "> > <head> > <title>Results</title> > </head> > <body> > <table> > { > let $title := xdmp:get-request-field("title") > let $authorLast := > xdmp:get-request-field("authorLast") > > let $query_string := if ($title) then > cts:element-query(xs:QName("title"), > > cts:word-query(($title),("case-insensitive", > > "diacritic-insensitive")) ) > else > ( > if ($authorLast) then > cts:element-query(xs:QName("author"), > > cts:element-query(xs:QName("last"), > > cts:word-query(($authorLast),("case-insensitive", > > > "diacritic-insensitive")) )) > else "" > > ) > > > for $book in cts:search( > doc("myBooks.xml")/*:books/*:book,$query_string) > return > <tr> > <td align="left"> { $book/*:title/text() } </td> > <td align="left"> { > $book/*:author/*:last/text() } </td> > </tr> > } > </table> > </body> > </html> > > ================================================================ > > Can you please help me ? > > Thanks and Regards, > Sai. > > > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > > > -----Inline Attachment Follows----- > > > _______________________________________________ > General mailing list > [email protected] > <http://us.mc529.mail.yahoo.com/mc/compose?to=gene...@develope > r.marklogic.com> > http://xqzone.com/mailman/listinfo/general > > > > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
