Hi taminoes,

How can I get ino:docname using tf:containsText, tf:containsNearText, etc?

I tried something like this:

declare namespace tf=‘
for $a in input()/docnixe
where tf:containsText($a/properties/@mimetype,“image/")
and tf:containsText(root($a),"INO
{ tf:getDocname(root($a)) }

But, I just have got

Thanx in advance, Ito

Hi Ito,

how about this:

   declare namespace tf='' 
   for $a in input()/docnixe
   let $docName := <docName>{tf:getDocname(root($a))}</docName>
   where tf:containsText($a/properties/@mimetype,"image/*")
     and tf:containsText($docName, "INO*.jpg")
   return <out>
   { $docName/text() }

The tricky thing here is that the tf:containsText() function requires a node for the first parameter - so we can’t just pass the result of tf:getDocname(), because this is a string not a node. Unfortunately the result of root($a) is the document root, which doesn’t help much.

An alternative approach could be to use the xf:contains, xf:starts-with, xs:ends-with, etc. functions on the value of tf:getDocname(). These functions accept a string parameter, although they don’t have the same full-text capabilities as tf:containsText().

I hope that helps,