XPTY0019

A step in a path expression (that is not the last step) is returning atomic values, which is not permitted. For example, the following expression:

doc("catalog.xml")//name/substring(.,1,3)/replace(.,'A','a')

is not permitted because the second to last step, substring(.,1,.3), is returning atomic values. It can be rewritten as:

for $shortName in doc("catalog.xml")//name/substring(.,1,3)
return replace($shortName,'A','a')

Get XQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.