Julen Martínez
Julen Martínez

Reputation: 27

Unable to perform XPath operation. A sequence of more than one item is not allowed as the first argument of concat()

The XML is

<alumno id="a01">
            <apellido1>Cervantes</apellido1>
            <apellido2>Saavedra</apellido2>
            <nombre>Miguel</nombre>
            <sexo>Hombre</sexo>
            <estudios>
                <ciclo codigo="c01"/>
                <modulos>
                    <modulo codigo="m3009"/>
                    <modulo codigo="m0005"/>
                </modulos>
            </estudios>
</alumno>

I am trying to concat it that it shows "nombre apellido1 apellido2" with concat(//alumno/nombre, //alumno/apellido1, //alumno/apellido2) but returns me the error: Unable to perform XPath operation. A sequence of more than one item is not allowed as the first argument of concat() (<nombre/>, <nombre/>, <nombre/>, ...)

By the way, there is more than one < alumno >.

Upvotes: 1

Views: 171

Answers (1)

Jack Fleeting
Jack Fleeting

Reputation: 24940

Your actual XML probably has more than one alumno with different ids. So you need to concat at each alumno level separately (and add spaces). Try

//alumno/concat(nombre," ", ./apellido1," ", ./apellido2)

on your actual XML and see if it works.

Upvotes: 1

Related Questions