I think that
Saxon reported the line number of the error incorrectly.
Thanks, I'll see if I can improve it. Dynamic errors are reported at
the location where the error is caught, which occasionally is at the
level of the template or function rather than the individual