Use tf:containsText


How can i use the fonction tf:containsText in a JSP

i must declare

declare namespace tf=“

but where and how???


hi poussing,

it may well be me, but i don’t get the connection between a JSP and the acual XQuery.
what the beast usually looks like is this:

declare namespace tf=""
for $a in input()/bib/book
where tf:containsText($a/title, "UNIX")
return $a

(to be found here in documentation: …/Tamino/Tamino )

hope this helps.

andreas f.


but the problem is

this declaration make a error when i try it in a jsp

" declare namespace tf=“” "

hi poussin,

unfortunately i am fresh out of crystal balls, so you’ll have to elaborate a little. what exactly is the error? how does your actual code look like?

or, would it be as simple as a problem with quotes in a string? then your declaration has to look like this:

String myXQuery = "declare namespace tf=\"http://.../TaminoFunction\""
+ "for ... where ... let ..."

andreas f.

Hi, poussin!

You have to declare the namespace directly at the begin of your query as andreas f. pointed out.

So somewhere you have your

http://localhost/tamino/mydb/collection?_xquery =[B]declare ...[/B] for ... where tf:containsText... 

Probably you have to write the blanks as %20 if you use it literally.