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()

xslt:transform($input, $stylesheet,map{'delivery-format': 'raw'})
xslt:transform($input, $stylesheet,map{'delivery-format': 'serialized'})
xslt:transform($input, $stylesheet,map{'delivery-format': 'document'})

all give the same "not allowed in prolog" result.

Since setting the stylesheet to process3.xsl which ought to return

<dummy>text</dummy>

returns

text

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.

-- Graydon

On Sun, Jun 1, 2025, at 15:54, [email protected] wrote:
> 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
> https://qt4cg.org/specifications/xslt-40/Overview.html#id-xsl-output-declaration
> 
> 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:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="xml" omit-xml-declaration="yes"/>
> 
> <xsl:template match="/dummy">
> <xsl:copy-of select="."/>
> </xsl:template>
> </xsl:stylesheet>
> 
> Process2.xslt
> ================
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="text" omit-xml-declaration="yes"/>
> 
> <xsl:template match="/dummy">
> <xsl:value-of select="."/>
> </xsl:template>
> </xsl:stylesheet>
> 

Reply via email to