Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Here should go questions about transforming XML with XSLT and FOP.
Martin Honnen
Posts: 96
Joined: Tue Aug 19, 2014 12:04 pm

Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by Martin Honnen »

I am using XML Editor 18.1, build 2016112217 with the up to date Saxon 9.7 EE plugin (which is currently 9.7.0.14) to run an XSLT 3.0 stylesheet where the default mode is defined as streamable:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">

<xsl:mode streamable="yes" on-no-match="shallow-copy"/>

<xsl:template match="A">
<ANew>
<xsl:apply-templates/>
</ANew>
</xsl:template>

<xsl:template match="F">
<FNew>
<xsl:apply-templates/>
</FNew>
</xsl:template>

</xsl:stylesheet>
Now when I run this against an input document like

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Head>
<A/>
<B/>
</Head>
<Grp>
<D/>
<E/>
<SubGrp>
<E/>
<F/>
</SubGrp>
<SubGrp>
<E/>
<F/>
</SubGrp>
</Grp>
<Grp>
<D/>
<E/>
<SubGrp>
<E/>
<F/>
</SubGrp>
<SubGrp>
<E/>
<F/>
</SubGrp>
</Grp>
</Root>
Oxygen runs the transformation successfully but displays a transformation problem

Code: Select all

Engine name: Saxon-EE 9.7.0.14 (External)
Severity: warning
Description: Requested initial mode is streamable, but the supplied input is not streamed
which suggests I don't get streamed processing which I would like to get. In earlier versions of oXygen and the Saxon 9.7 EE plugin I would get an error that streamable processing requires a SaxSource or StreamSource as the input so I suppose the problem still is that oXygen does not supply a SaxSource or StreamSource but a DOMSource or similar.

Is there no way to integrate the Saxon 9.7 EE plugin so that streamed processing with a default mode works, supposedly by having oXygen provide a SaxSource or StreamSource to Saxon? After all one of the important new features in XSLT 3.0 is streaming and I would like to use that inside of oXygen, without having to resort to rewriting the XSLT to use xsl:stream/xsl:source-document or having to run Saxon from the command line.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by adrian »

Hello,

I can confirm that Saxon streaming is still not working with the updated external Saxon 9.7 add-on (bundles 9.7.0.14) in v18.1.
We are currently investigating this. I've logged this on our issue tracking tool and someone will provide an answer shortly.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by adrian »

Hi,

The issue seems to be triggered by a change in the API behavior of Saxon 9.7. Saxon 9.6 works fine in Oxygen with this same API.
You can find it logged here:
https://saxonica.plan.io/issues/3120

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
sorin_carbunaru
Posts: 402
Joined: Mon May 09, 2016 9:37 am

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by sorin_carbunaru »

Hello,

I wanted to let you know that the newly released oXygen 19.0 has a new Saxon-EE option named Enable streaming mode in the XML > XSLT-FO-XQuery > XSLT > Saxon > Saxon-HE/PE/EE options page, as well as in the scenario specific options. oXygen 19.0 come with Saxon 9.7.0.15.

Best wishes,
Sorin Carbunaru
oXygen XML
Martin Honnen
Posts: 96
Joined: Tue Aug 19, 2014 12:04 pm

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by Martin Honnen »

Sorin,

thanks for the pointer, however neither in my oXygen 19 installation nor in the documentation https://www.oxygenxml.com/doc/versions/ ... axon8.html have I been able to find the "enable streaming mode" option in the preferences settings. I do find it in the transformation scenario (https://www.oxygenxml.com/doc/versions/ ... lt-options) only.

Is the option missing in the global/project preferences dialogue?
sorin_carbunaru
Posts: 402
Joined: Mon May 09, 2016 9:37 am

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by sorin_carbunaru »

Hello again Martin,

You are right. The option is found only in the transformation scenario. When I wrote you, I took the information from an outdated note from our issue management tool. Sorry for that.
Martin Honnen
Posts: 96
Joined: Tue Aug 19, 2014 12:04 pm

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by Martin Honnen »

I have just tried to use an XSLT 3.0 stylesheet with streaming in oXygen 19 (2017062918) with the latest version of the Saxon 9.8 plugin (9.8.0.3), however, I still get a warning

Engine name: Saxon-EE 9.8.0.3 (External)
Severity: warning
Description: is streamable, but the input is not supplied as a stream
The details are as follows, the input XML is

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">

<xsl:param name="str" as="xs:string" select="'word'"/>

<xsl:mode on-no-match="shallow-copy"/>

<xsl:template match="*[b[contains(@test, $str)]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:for-each-group select="*" group-adjacent="boolean(self::b[contains(@test, $str)])">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<b test="{$str}">
<xsl:apply-templates select="current-group()/node()"/>
</b>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
stylesheet is

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">

<xsl:param name="str" as="xs:string" select="'word'"/>

<xsl:mode on-no-match="shallow-copy" streamable="yes"/>

<xsl:template match="a/b">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:for-each-group select="*" group-adjacent="boolean(self::b[contains(@test, $str)])">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<b test="{$str}">
<xsl:apply-templates select="current-group()/node()"/>
</b>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
"Enable streaming mode" on the Saxon EE specific transformation settings is checked.

So it looks as if the issue has not yet been resolved or as if there is a regression.
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by alex_jitianu »

Hello,

Unfortunately, we know about this limitation. To make the Saxon9.8 plugin use streaming, we had to change/enrich the API this plugin uses to interact with Oxygen. Oxygen 19.1 (to be released in about 2 months) will contain this API and the Saxon 9.8 plugin will work in streaming mode too.

Best regards,
Alex
Martin Honnen
Posts: 96
Joined: Tue Aug 19, 2014 12:04 pm

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by Martin Honnen »

I have installed oXygen 19.1 and tried again whether streaming works, I continue to get the warning

Code: Select all

Engine name: Saxon-EE 9.8.0.4 (External)
Severity: warning
Description: The unnamed mode is streamable, but the input is not supplied as a stream
with an XSLT 3.0 stylesheet and a streamable default mode.
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by alex_jitianu »

Hi Martin,

The Saxon 9.8 add-on's release was a bit delayed. We managed to release it on Monday. If you go to Help->Check for add-ons updates... you should be able to see the new version. Please update the add-on to version 19.1 and tell me if it starts working.

Best regards,
Alex
Martin Honnen
Posts: 96
Joined: Tue Aug 19, 2014 12:04 pm

Re: Using XSLT 3.0 and streamable default mode with Saxon 9.7 EE as external plugin

Post by Martin Honnen »

Updating didn't seem to find a new version but I uninstalled the existing version and then looked for available plugins which offered me that 19.1 version and now with that installed and another restart the streamed processing with a streamable mode finally works without any warning. That's great, now I can use my preferred coding approach and use it directly inside oXygen when exploring the streaming features in XSLT 3.0.
Post Reply