I intend to make a query about an XML document whose structure is as follows:
<bib>
<libro anyo="1994">
<titulo>TCP/IP Ilustrado </titulo>
<autor>
<apellido>Stevens</apellido>
<nombre>W.</nombre>
</autor>
<editorial>Prentice-Hall</editorial>
<precio>65.95</precio>
</libro>
<libro anyo="1992">
<titulo>Programación Avanzada en el entorno Unix</titulo>
<autor>
<apellido>Stevens</apellido>
<nombre>W.</nombre>
</autor>
<editorial>Prentice-Hall</editorial>
<precio>65.95</precio>
</libro>
<libro anyo="2000">
<titulo>Datos en la Web</titulo>
<autor>
<apellido>Abiteboul</apellido>
<nombre>Serge</nombre>
</autor>
<autor>
<apellido>Buneman</apellido>
<nombre>Peter</nombre>
</autor>
<autor>
<apellido>Suciu</apellido>
<nombre>Dan</nombre>
</autor>
<editorial>Morgan Kaufmann</editorial>
<precio>39.95</precio>
</libro>
<libro anyo="1991">
<titulo>Economía de la Tecnología y el Contenido de la TV digital</titulo>
<editor>
<apellido>Gerbarg</apellido>
<nombre>Darcy</nombre>
</editor>
</libro>
</bib>
As you can see, the author W. Stevens appears in two books ( TCP / IP Illustrated and Advanced Programming in the Unix environment ).
The goal of the first clause FLOWR is to extract a single instance of the author element if its child elements have the same content
for $a in doc("libros.xml")/bib/libro/autor
group by $nom:=$a/nombre, $ape:=$a/apellido
return <autor>
<nombre>{
concat($a[1]/nombre,' ',$a[1]/apellido)
}</nombre>
<libro>{
for $b in doc("libros.xml")/bib/libro
where $b/autor/[nombre eq $a[1]/nombre]
return $b/titulo
}</libro>
</autor>
Specifically, in the second clause FLOWR (line 10) I get the following error:
[FORG0006] Effective boolean value not defined for array (*): [true ()].
The purpose of this second clause FLOWR is to return the content of the title element, belonging to the book element, where the element author matches the author who is currently iterating through the first clause FLOWR
What could this error be?
I already made a publication with a question about XQuery, well, I have another doubt, effect of that publication. If I make a different publication, it is because I believe that the doubt is of another kind