I agree it's somewhat unexpected. As we are working on the string result that is returned by Saxon, it's currently not that easy indeed to decide how to interpret the character stream.
Andy Bunce <bunce.a...@gmail.com> schrieb am Mi., 4. Mai 2022, 23:11: > Ok thanks. I thought this might have been unintended behavior. > if($report?result instance of document-node()+) then > document{$report?result} else $report?result > seems to give me what I expected here. > /Andy > > > On Wed, 4 May 2022 at 16:58, Christian Grün <christian.gr...@gmail.com> > wrote: > >> Thanks, Andy, I’ve updated the documentation. >> >> On Wed, May 4, 2022 at 3:12 PM Andy Bunce <bunce.a...@gmail.com> wrote: >> >>> Hi, >>> >>> Using BaseX 9.7.1 and saxon9he-9.9.1.jar >>> The documentation suggests the ?result from xslt:transform-report should >>> be *a* document-node where possible [1] >>> This seems not quite to be the case when there are processing >>> instructions or comments at the top level. In these cases a sequence of >>> document-nodes is returned. >>> >>> /Andy >>> [1] https://docs.basex.org/wiki/XSLT_Module#xslt:transform-report >>> >>> let $xslt:=<xsl:stylesheet xmlns:xsl=" >>> http://www.w3.org/1999/XSL/Transform" version="3.0"> >>> <xsl:mode on-no-match="shallow-copy"/> >>> </xsl:stylesheet> >>> >>> let $xml:=document{ <?something type="compact"?>, <foo/>} >>> return xslt:transform-report($xml,$xslt) >>> >>> Returns >>> map { >>> "messages": (), >>> "result": (<?something type="compact"?>, <foo/>) >>> } >>> >>> >>> >>> >>>