Should fn:transform in SaxonCS support XSLT version 4?
Added by Martin Honnen about 3 years ago
I am trying to run fn:transform
from XQuery 4 in SaxonCS, calling an XSLT 4 stylesheet:
xquery version "4.0";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'xml';
let $xslt :=
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="4.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
xmlns:ext="http://example.com/mf"
extension-element-prefixes="ext"
expand-text="yes">
<xsl:template name="ext:sequence">
<xsl:param name="select" as="item()*"/>
<xsl:param name="separator" select="''"/>
<xsl:for-each select="$select" separator="{{$separator}}">
<xsl:sequence select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>,
$seq := ('a', 'b', <c/>, 'd', 'e', <f/>, <g/>, 'h')
return <e>{transform(map { 'stylesheet-node' : $xslt, 'initial-template' : QName('http://example.com/mf', 'sequence'), 'template-params' : map { QName('', 'select') : $seq }, 'xslt-version' : 4.0})?output}</e>
I get the error: "The transform option xslt-version is higher than the XSLT version supported by this processor".
Is that expected? Is there so far no support in fn:transform
to use XSLT 4?
Replies (5)
Please register to reply
RE: Should fn:transform in SaxonCS support XSLT version 4? - Added by Martin Honnen about 3 years ago
If I don't specify the xslt-version
option, as shown below, I get told "Attribute xsl:for-each/@separator is allowed only if XSLT 4 is enabled".
xquery version "4.0";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'xml';
let $xslt :=
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="4.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
xmlns:ext="http://example.com/mf"
extension-element-prefixes="ext"
expand-text="yes">
<xsl:template name="ext:sequence">
<xsl:param name="select" as="item()*"/>
<xsl:param name="separator" select="''"/>
<xsl:for-each select="$select" separator="{{$separator}}">
<xsl:sequence select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>,
$seq := ('a', 'b', <c/>, 'd', 'e', <f/>, <g/>, 'h')
return <e>{transform(map { 'stylesheet-node' : $xslt, 'initial-template' : QName('http://example.com/mf', 'sequence'), 'template-params' : map { QName('', 'select') : $seq }})?output}</e>
RE: Should fn:transform in SaxonCS support XSLT version 4? - Added by Michael Kay about 3 years ago
I'm pretty sure it's not something that we've tested.
RE: Should fn:transform in SaxonCS support XSLT version 4? - Added by Michael Kay about 3 years ago
Raised and fixed here: https://saxonica.plan.io/issues/5140
RE: Should fn:transform in SaxonCS support XSLT version 4? - Added by Martin Honnen almost 3 years ago
Now with Saxon 11.1, I can run XQuery 4 calling fn:transform
running XSLT 4, but it doesn't suffice to set the xqueryCompiler.setLanguageVersion("4.0")
, I also have to enable syntax extensions on the processor (processor.setConfigurationProperty(Feature.ALLOW_SYNTAX_EXTENSIONS, true);
), otherwise I get an error like "XTSE0020 Attribute xsl:for-each/@separator is allowed only if XSLT 4.0 is enabled".
Is that as intended/expected? Or shouldn't a request to run XQuery version 4.0 allow me to call fn:transform
for XSLT version 4.0?
RE: Should fn:transform in SaxonCS support XSLT version 4? - Added by Michael Kay almost 3 years ago
I've added a specific test for both SaxonJ and SaxonCS that this works, and it's passing OK on the development branch - I don't know if I did anything to make it work, haven't tried running the test under 11.1 as issued.
Please register to reply