Do we have an abort() function to terminate a XQuery script from XQuery 3.1? I can write a if-else to return nothing. But I dont want to do that.
You can use the error(...)
function for that. The thrown error can then be caught by try
/catch
if needed. Using errors for control flow is not advisable however, because it is normally not optimized for performance.