Fwd: Re : [xquery-talk] about a query which have a contains function

Michael Kay mike at saxonica.com
Wed Oct 27 09:28:57 PDT 2010

Forwarding an off-list reply to the list. (Mohamed, please don't go 


-------- Original Message --------
Subject: 	Re : [xquery-talk] about a query which have a contains function
Date: 	Wed, 27 Oct 2010 00:51:47 +0100 (BST)
From: 	Mohamed kharrat <med_khr at yahoo.fr>
To: 	Michael Kay <mike at saxonica.com>

i have this query

let $y:="Java Web Services"

     for $x in doc("query/books.xml")

     where contains($x/books/book/title/text(),$y)

     return $x

it does't return a value, but it return [err:XPTY0004]A sequence with 
more than one item does not match the type text()? according to the 
Sequence Type Matching rules.
if i write return $x/books/book/authors/author the same thing, it does't 
it work only if i write   return 1  , in this case when the query find 
"Java Web Services" it return 1

thank you

*De :* Michael Kay <mike at saxonica.com>
*À :* talk at x-query.com
*Envoyé le :* Mar 26 octobre 2010, 23h 29min 26s
*Objet :* Re: [xquery-talk] about contains function

On 26/10/2010 21:30, Mohamed kharrat wrote:
> Dear sir,
> i need to use contains function with  NUX JAVA API
> second question
> i need to query a collection.
> how to do that.
> thank you
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
It would be useful to know how far you have got, and where you got stuck.

Are you able to run queries at all - or is it this specific query you 
are having difficulty with?

Is your problem with the query, or with the Java API?

What did you try, and how did it fail?

We need to know the answers to these questions so we can try to explain 
what to do in terms you are likely to understand.

When people have problems with the contains function it is often because 
they tried to guess what it did instead of reading the specification; 
the behaviour of a function can sometimes be guessed from its name, but 
not always.

Michael Kay

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20101027/b8451fe1/attachment.htm

More information about the talk mailing list