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-declar…
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>
Hello BaseX team,
I typically use the xslt:transform-text function to apply an XSLT stylesheet and obtain the result that is serialized by Saxon according to the xsl:output instructions in the stylesheet. The xslt:transform-report has the advantage of providing access to messages created by xsl:message instructions. I have a few questions about these functions:
Is there a way to use the xsl:transform-report function to obtain messages and the serialized result (instead of document nodes) that is currently returned by xslt:transform-text?
Is there a way to provide a base URI in the options of xsl:transform-text (or xsl:transform-report or xsl:transform)? If the input to the transformation is on disk then the base URI is set automatically, however if the input is held in memory then the base URI is not set so it could be helpful to be able to provide a base uri to the transformer as an option.
The documentation doesn't mention these capabilities so I'm guessing that these things are not currently possible.
Thank you,
Vincent
______________________________________________
Vincent M. Lizzi
Head of Information Standards | Taylor & Francis Group
E-Mail: vincent.lizzi(a)taylorandfrancis.com<mailto:vincent.lizzi@taylorandfrancis.com>
Web: www.tandfonline.com<http://www.tandfonline.com/>
Time zone: US Eastern
Taylor & Francis is a trading name of Informa UK Limited,
registered in England under no. 1072954
"Everything should be made as simple as possible, but not simpler."
[https://res.public.onecdn.static.microsoft/assets/bookwithme/misc/CalendarP…]<https://outlook.office.com/bookwithme/user/aa80d42cbb5b46dba06a5ad241d7665b…>
Book time to meet with me<https://outlook.office.com/bookwithme/user/aa80d42cbb5b46dba06a5ad241d7665b…>
Information Classification: General