Trouble retrieving document

I am performing an XQuery on a document where the values to be searched on are in the form of key/value pairs. As a simple search, I would like to return any document that has a certain value, regardless of the key. It seems to work great for some string, but not for others.

My document looks like:
<kfx:DOCUMENT ino:id=“1” xmlns:kfx=“” DOCID=“0000019A” DOCUMENTCLASSNAME=“DMV FORMS”>
<kfx:DOCUMENTFIELD NAME=“Office Location” VALUE=“501” />
<kfx:DOCUMENTFIELD NAME=“Deposit Date” VALUE=“20030523” />
<kfx:DOCUMENTFIELD NAME=“Deposit Number” VALUE=“0026” />
<kfx:DOCUMENTFIELD NAME=“Form Type” VALUE=“Deposit Cover” />
<kfx:DOCUMENTFIELD NAME=“Batch Code” VALUE=“0000” />
<kfx:DOCUMENTFIELD NAME=“Barcode” VALUE=“501 0523030026” />
<kfx:DOCUMENTFIELD NAME=“Batch Date” VALUE=“00000000” />
<kfx:PRIMARYFILE FILENAME=“5ac491d7-2d92-4106-95d3-733c23a379f5” NUMBER=“1” />

My XQuery is:
declare namespace kfx=''
for $q in input()/kfx:XMLRELEASE//kfx:DOCUMENT
where $q/kfx:DOCUMENTDATA/kfx:DOCUMENTFIELD[@VALUE=“Deposit Cover”]
return $q

This XQuery returns the expected document, however if I try to search with the VALUE set to “501 0523030026”, I get no documents returned.

Any ideas??


Hi Michelle,

I just tried both queries with Tamino, by placing the document into ino:etc.
Both queries worked okay.

Perhaps there is something specific to your Tamino version, or the schema you are using?


I’m using Tamino and I’ve attached my schemas and sample XML. Any ideas? (3.43 KB)

Hi Michelle,

in the file K006A001.xml there is this line:

   <kfx:DOCUMENTFIELD NAME="Barcode" VALUE="501 0523030026 " />
   Please note that there is a space here ----------------^</pre><BR>If the filter condition contains a space, the XQuery works:<BR><pre class="ip-ubbcode-code-pre">   declare namespace kfx=""
   for $q in input()/kfx:XMLRELEASE//kfx:DOCUMENT
   where $q/kfx:DOCUMENTDATA/kfx:DOCUMENTFIELD[@VALUE="501 0523030026 "]
   return $q

I hope that helps,

Thanks Trevor, that was the problem. I hadn’t noticed the extra space.