Incorrect "No result for query" for XPath expression
David Vergnaud <[email protected]> Wed, 21 Oct 2009 09:02:15 -0700 (PDT)
| Newsgroups | gmane.text.xml.xindice.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,=0A=0AI'm reporting on a problem which I'm pretty much convinced is a bu=
g in the current 1-2.dev version of Xindice (1.2m1). I'm using Xindice runn=
ing on its own (no Tomcat) as a daemon on a Linux box (Suse 11) with JDK 1.=
6. =0A=0ABasically, I have a DB where I've stored terminology entries that =
contain information about various banking terms in 4 languages. I want to b=
e able to conduct two types of searches, one where the term is searched for=
only one of the languages, and one where the search is carried out in all =
languages. For this, I use two versions of a somewhat complicated XPath exp=
ression: one where the language is specified (as attribute of one of the no=
des, in a predicate) and one where it isn't. This is the only difference be=
tween the two expressions. Surprisingly, the one where the language is fixe=
d does return results where the one without specification doesn't. Besides,=
I've tested the XPath expression on other systems, and seen that there rea=
lly should be results. =0A=0AThe first impression is that when evaluating f=
unction arguments inside a predicate, only the first node of a node set is =
evaluated. In my case, that would be confirmed by the following fact: each =
entry contains first the German word, then either French or English. When d=
oing an "unrefined" search (no language specification) with a German word, =
results are returned. When doing the same unrefined search with French or E=
nglish, no results are returned. =0A=0AHere's an example of an XPath we're =
using, first with the language refinement, then without:=0A/martif/text/bod=
y/termEntry[contains(langSet[starts-with(@lang,'fr')]/ntig/termGrp/term/tex=
t(),'bancaire')]=0A/martif/text/body/termEntry[contains(langSet/ntig/termGr=
p/term/text(),'bancaire')]=0A=0AAs you can see, the goal is to extract a te=
rmEntry element which contains the word "bancaire" under the specified path=
. In the first path, I set the langSet to have attribute lang start with "f=
r" (for French), in the second I don't. As I said before, the first express=
ion yields a result and the second one doesn't. =0A=0AI'm including an exam=
ple DB entry which can be used to test this -- I assume it should be possib=
le to observe this behaviour with only one entry in the DB as well. In orde=
r to use the xpath above with it, one would need to prefix all node names i=
n the xpath expression with "tbx" (I only removed that for legibility). =0A=
=0AShould this prove to be an error on my side, I'd be grateful to anyone w=
ho'd point it out. Otherwise, it might need to be taken onto the Xindice bu=
g list. =0A=0ACheers,=0A=0ADavid=0A=0A<?xml version=3D"1.0"?>=0A<martif xml=
ns=3D"http://www.lisa.org/tbx" type=3D"TBX" xml:lang=3D"de-CH">=0A <martif=
Header>=0A <fileDesc>=0A <titleStmt>=0A <title>=0A =
Test-TerminologieDB </title>=0A </titleStmt>=0A <publicati=
onStmt>=0A <p>=0A Version 1.1 </p>=0A </public=
ationStmt>=0A <sourceDesc>=0A <p>=0A Version 1.1 =
</p>=0A </sourceDesc>=0A </fileDesc>=0A </martifHeader>=0A <te=
xt>=0A <body>=0A <termEntry>=0A <descrip type=3D"classificat=
ionCode" />=0A <descrip type=3D"subjectField">=0A </descrip>=
=0A <langSet xml:lang=3D"de-CH">=0A <transacGrp>=0A =
<transac type=3D"transactionType">=0A created <=
/transac>=0A <transacNote type=3D"responsibility">=0A =
STEA </transacNote>=0A <date>=0A 2009=
-09-15T14:44:54.924+02:00 </date>=0A </transacGrp>=0A =
<descrip type=3D"reliabilityCode">=0A 1 </descr=
ip>=0A <note />=0A <descripGrp>=0A <descrip ty=
pe=3D"definition">=0A Die Garantie ist eine selbstst=E4ndige, =
vom Hauptschuldverh=E4ltnis unabh=E4ngige Verpflichtung. Der Garant (die Ba=
nk) kann keinerlei Einwendungen und Einreden aus dem Grundgesch=E4ft erhebe=
n. Das heisst: Der Garant zahlt auf erste schriftliche Anforderung (Inanspr=
uchnahme) des Beg=FCnstigten, gegen Einreichung der im Garantietext vorgesc=
hriebenen Best=E4tigung und allenfalls vorgeschriebenen Dokumente. =
</descrip>=0A <adminGrp>=0A <admin type=3D"sourc=
e">=0A CS Glossar </admin>=0A </admi=
nGrp>=0A </descripGrp>=0A <ntig>=0A <termGrp>=
=0A <term>=0A Bankgarantie </term>=
=0A <termNote type=3D"partOfSpeech" />=0A <termNo=
te type=3D"grammaticalGender" />=0A <termNote type=3D"grammati=
calNumber" />=0A <termCompList type=3D"lemma">=0A =
<termComp />=0A </termCompList>=0A <termCompLi=
st type=3D"morphologicalElement">=0A <termComp />=0A =
</termCompList>=0A <termNote type=3D"termType">=0A =
main </termNote>=0A <termNote type=3D"u=
sageNote" />=0A </termGrp>=0A <adminGrp>=0A =
<admin type=3D"source">=0A CS Glossar </adm=
in>=0A <note />=0A </adminGrp>=0A <descr=
ipGrp>=0A <descrip type=3D"example" />=0A <adminG=
rp>=0A <admin type=3D"source" />=0A </adminGrp>=
=0A </descripGrp>=0A <note />=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A abbr </te=
rmNote>=0A </termGrp>=0A <adminGrp>=0A <=
admin type=3D"source" />=0A </adminGrp>=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A syn </term=
Note>=0A <termNote type=3D"grammaticalGender" />=0A =
<termCompList type=3D"lemma">=0A <termComp />=0A =
</termCompList>=0A <termCompList type=3D"morphologicalEle=
ment">=0A <termComp />=0A </termCompList>=0A =
</termGrp>=0A <adminGrp>=0A <admin type=3D=
"source" />=0A <note />=0A </adminGrp>=0A =
<descrip type=3D"example" />=0A <adminGrp>=0A <ad=
min type=3D"source" />=0A </adminGrp>=0A <note />=0A =
</ntig>=0A </langSet>=0A <langSet xml:lang=3D"en-GB"=
>=0A <transacGrp>=0A <transac type=3D"transactionType">=
=0A created </transac>=0A <transacNote t=
ype=3D"responsibility">=0A STEA </transacNote>=0A =
<date>=0A 2009-09-15T14:44:54.924+02:00 <=
/date>=0A </transacGrp>=0A <descrip type=3D"reliabilityCo=
de">=0A 1 </descrip>=0A <note />=0A <=
descripGrp>=0A <descrip type=3D"definition" />=0A <ad=
minGrp>=0A <admin type=3D"source" />=0A </adminGrp>=
=0A </descripGrp>=0A <ntig>=0A <termGrp>=0A =
<term>=0A bank guarantee </term>=0A =
<termNote type=3D"partOfSpeech" />=0A <termNote t=
ype=3D"grammaticalGender" />=0A <termNote type=3D"grammaticalN=
umber" />=0A <termCompList type=3D"lemma">=0A <=
termComp />=0A </termCompList>=0A <termCompList t=
ype=3D"morphologicalElement">=0A <termComp />=0A =
</termCompList>=0A <termNote type=3D"termType">=0A =
main </termNote>=0A <termNote type=3D"usage=
Note" />=0A </termGrp>=0A <adminGrp>=0A =
<admin type=3D"source">=0A CS Glossar </admin>=
=0A <note />=0A </adminGrp>=0A <descripG=
rp>=0A <descrip type=3D"example" />=0A <adminGrp>=
=0A <admin type=3D"source" />=0A </adminGrp>=0A=
</descripGrp>=0A <note />=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A abbr </termN=
ote>=0A </termGrp>=0A <adminGrp>=0A <adm=
in type=3D"source" />=0A </adminGrp>=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A syn </termNot=
e>=0A <termNote type=3D"grammaticalGender" />=0A =
<termCompList type=3D"lemma">=0A <termComp />=0A =
</termCompList>=0A <termCompList type=3D"morphologicalElemen=
t">=0A <termComp />=0A </termCompList>=0A =
</termGrp>=0A <adminGrp>=0A <admin type=3D"so=
urce" />=0A <note />=0A </adminGrp>=0A <=
descrip type=3D"example" />=0A <adminGrp>=0A <admin=
type=3D"source" />=0A </adminGrp>=0A <note />=0A =
</ntig>=0A </langSet>=0A <langSet xml:lang=3D"fr-CH">=
=0A <transacGrp>=0A <transac type=3D"transactionType">=
=0A created </transac>=0A <transacNote t=
ype=3D"responsibility">=0A STEA </transacNote>=0A =
<date>=0A 2009-09-15T14:44:54.924+02:00 <=
/date>=0A </transacGrp>=0A <descrip type=3D"reliabilityCo=
de">=0A 1 </descrip>=0A <note />=0A <=
descripGrp>=0A <descrip type=3D"definition" />=0A <ad=
minGrp>=0A <admin type=3D"source" />=0A </adminGrp>=
=0A </descripGrp>=0A <ntig>=0A <termGrp>=0A =
<term>=0A garantie bancaire </term>=
=0A <termNote type=3D"partOfSpeech" />=0A <termNo=
te type=3D"grammaticalGender" />=0A <termNote type=3D"grammati=
calNumber" />=0A <termCompList type=3D"lemma">=0A =
<termComp />=0A </termCompList>=0A <termCompLi=
st type=3D"morphologicalElement">=0A <termComp />=0A =
</termCompList>=0A <termNote type=3D"termType">=0A =
main </termNote>=0A <termNote type=3D"u=
sageNote" />=0A </termGrp>=0A <adminGrp>=0A =
<admin type=3D"source">=0A CS Glossar </adm=
in>=0A <note />=0A </adminGrp>=0A <descr=
ipGrp>=0A <descrip type=3D"example" />=0A <adminG=
rp>=0A <admin type=3D"source" />=0A </adminGrp>=
=0A </descripGrp>=0A <note />=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A abbr </te=
rmNote>=0A </termGrp>=0A <adminGrp>=0A <=
admin type=3D"source" />=0A </adminGrp>=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A syn </term=
Note>=0A <termNote type=3D"grammaticalGender" />=0A =
<termCompList type=3D"lemma">=0A <termComp />=0A =
</termCompList>=0A <termCompList type=3D"morphologicalEle=
ment">=0A <termComp />=0A </termCompList>=0A =
</termGrp>=0A <adminGrp>=0A <admin type=3D=
"source" />=0A <note />=0A </adminGrp>=0A =
<descrip type=3D"example" />=0A <adminGrp>=0A <ad=
min type=3D"source" />=0A </adminGrp>=0A <note />=0A =
</ntig>=0A </langSet>=0A <langSet xml:lang=3D"it-CH"=
>=0A <transacGrp>=0A <transac type=3D"transactionType">=
=0A created </transac>=0A <transacNote t=
ype=3D"responsibility">=0A STEA </transacNote>=0A =
<date>=0A 2009-09-15T14:44:54.924+02:00 <=
/date>=0A </transacGrp>=0A <descrip type=3D"reliabilityCo=
de">=0A 1 </descrip>=0A <note />=0A <=
descripGrp>=0A <descrip type=3D"definition" />=0A <ad=
minGrp>=0A <admin type=3D"source" />=0A </adminGrp>=
=0A </descripGrp>=0A <ntig>=0A <termGrp>=0A =
<term>=0A garanzia bancaria </term>=
=0A <termNote type=3D"partOfSpeech" />=0A <termNo=
te type=3D"grammaticalGender" />=0A <termNote type=3D"grammati=
calNumber" />=0A <termCompList type=3D"lemma">=0A =
<termComp />=0A </termCompList>=0A <termCompLi=
st type=3D"morphologicalElement">=0A <termComp />=0A =
</termCompList>=0A <termNote type=3D"termType">=0A =
main </termNote>=0A <termNote type=3D"u=
sageNote" />=0A </termGrp>=0A <adminGrp>=0A =
<admin type=3D"source">=0A CS Glossar </adm=
in>=0A <note />=0A </adminGrp>=0A <descr=
ipGrp>=0A <descrip type=3D"example" />=0A <adminG=
rp>=0A <admin type=3D"source" />=0A </adminGrp>=
=0A </descripGrp>=0A <note />=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A abbr </te=
rmNote>=0A </termGrp>=0A <adminGrp>=0A <=
admin type=3D"source" />=0A </adminGrp>=0A </ntig>=0A =
<ntig>=0A <termGrp>=0A <term />=0A =
<termNote type=3D"termType">=0A syn </term=
Note>=0A <termNote type=3D"grammaticalGender" />=0A =
<termCompList type=3D"lemma">=0A <termComp />=0A =
</termCompList>=0A <termCompList type=3D"morphologicalEle=
ment">=0A <termComp />=0A </termCompList>=0A =
</termGrp>=0A <adminGrp>=0A <admin type=3D=
"source" />=0A <note />=0A </adminGrp>=0A =
<descrip type=3D"example" />=0A <adminGrp>=0A <ad=
min type=3D"source" />=0A </adminGrp>=0A <note />=0A =
</ntig>=0A </langSet>=0A </termEntry>=0A </body>=0A=
</text>=0A</martif>=0A=0A________________________________________________=
__=0ADo You Yahoo!?=0ATired of spam? Yahoo! Mail has the best spam protect=
ion around =0Ahttp://mail.yahoo.com