Page 1 of 1

using SAXON in streaming mode

Posted: Fri Apr 09, 2010 5:40 pm
by PaulHermans
From the Saxon documentation:
The document that is processed in streaming mode must be read using the doc() function (or in XSLT, the document() function). The query or stylesheet may also process other documents (for example a document named on the command line) but this is not necessary. In XSLT it is often useful to activate the stylesheet at a named template using the -it option on the command line, which allows activation without a primary input document.
This is part of the stylesheet:

Code: Select all

<xsl:template match="/" name="main">
<metadata>
<xsl:apply-templates select="saxon:stream(doc('0001_exportM.xml')/Collection/Artefact)"/>
</metadata>
</xsl:template>
My transformation scenario:
using Saxon-EE 9.2.0.6
- with settings: initial template: main.

Oxygen doesn't allow me to run this transformation scenario without indicating an input file, which I do not need, since it is called from the saxon:stream function.
Of course I can point to a dummy file, ...

Paul

Re: using SAXON in streaming mode

Posted: Mon Apr 12, 2010 5:44 pm
by george
Hi Paul,

That is indeed a limitation that was not removed when we added support for setting the initial template for Saxon 9. We plan to make the XML field optional and report an error later, when the transformation is executed, in case an XML is required (as in case of XSLT 1.0 or if initial template is not set).

Best Regards,
George