> The function xpath evaluates the XPath expression xpath (a text value) > against the XML value xml. It returns an array of XML values corresponding > to the node set produced by the XPath expression. If the XPath expression > returns a scalar value rather than a node set, a single-element array is > returned.
If you want to convert the result of an xpath query you need to operate over an array. Usually that means unnesting though there are other possibilities. If you know you are only dealing (or care about) the first element you can simply code it as (xpath(...))[1] - note the surrounding parentheses - to get that first element.