11.9 (and SaxonHE-J 12.7) has the same issue, and continues to have the issue with the delivery-format option set on transform()
all give the same "not allowed in prolog" result.
instead, no matter if delivery-format is set or what it's set to if it is set, or if I assign the result to a variable typed item() and return that.
Hello,
It seems that BaseX 12.0 beta 2686758, and later, is tripping on the XSLT transformation that outputs text, not XML.
I am using SaxonHE12-5J.
Even the following XQuery setting is not helping.
declare option output:method 'text';
IMHO, BaseX should read the output:method attribute from an XSLT and handle it properly.
method? = "xml" | "html" | "xhtml" | "text" | "json" | "adaptive" | eqname
Below is an easy repro.
Process3.xslt is working (xsl:output method="xml")
Process2.xslt is NOT working (xsl:output method="text")
Error:
Stopped at C:/Program Files (x86)/BaseX/src/file, 10/15:
[FODC0002] "" (Line 1): Content is not allowed in prolog.
XQuery
=============
(: Outputs the result as xml. :)
declare option output:method 'text';
declare variable $input as xs:string := 'e:\Temp\BaseX_XSLT\Input2.xml';
declare variable $stylesheet as xs:string := 'e:\Temp\BaseX_XSLT\Process2.xslt';
xslt:transform($input, $stylesheet)
input2.xml
==============
<dummy>text</dummy>
Process3.xslt
=================
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="/dummy">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Process2.xslt
================
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="/dummy">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>