Is there a way to access the emitted messages when calling fn:transform()?

"Imsieke, Gerrit, le-tex" <[email protected]> Sun, 14 Nov 2021 10:46:35 +0100
Newsgroups gmane.text.xml.saxon.help
Organization le-tex publishing services GmbH
Message-ID <[email protected]>
We'd like to be able to access the messages (and possibly also the 
fn:trace() output) of existing stylesheets, without the need to either 
write Java code or to change the stylesheets so that they write the 
messages to secondary result documents.

Is it already possible, or if it's not, is it conceivable to optionally 
make these messages available in the resulting map, for example using 
keys 'saxon:messages' and 'saxon:traces'? The content of these map 
values could be an array of items, where each item may be whatever was 
output in the messages (for example, a string), or an XML document, or a 
JSON document, ...

Gerrit