XQuery scripts (at least in Sherlock) require that they always return some kind of value.
If you think your trigger isn't running at all and you're sure you haven't botched anything else up, you probably just need to stick on a return null() at the end of the script.