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">
<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://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general