I've recorded the problem here, and have tested a fix. This will appear in the next maintenance release.


Unfortunately there's no guaranteed workaround. What triggers the problem here is that the expression ($aParam1 = 'testVal') is recognized as immutable (it will have the same value on each execution of the containing template), so it is pulled out as a global variable, and this triggers a search for expressions to replace with the new global variable; the saxon:stream() expression is being corrupted during this operation. Generally you will avoid the problem if you keep the template/function in which saxon:stream() is called as simple as possible.

Apologies for the inconvenience.

Michael Kay

On 17/01/2013 12:39, Amarnath B S wrote:
I am facing a problem with burst-mode streaming when stylesheet params are used.

The attached testGlobalVarStreaming.xsl stylesheet uses for-each loop to iterate over a list of nodes in streaming mode using saxon:stream function. However, if the body of the for-each loop contains reference to a stylesheet param, then streaming mode is not used. Instead, a single tree is built for nodes of the streamed doc.

With the reference to stylesheet param in for-loop, the execution-plan's (generated using -explain) streamingCopy expression as shown in the attached withParamReference.xml file, loads the streamed document twice; once in the streamingCopy/document node and again in streamingCopy/filter node. I suspect this is the cause of tree being built for the loaded document. 

For the above tests, I verified if streaming mode is used using the '-t' command-line option.

Are stylesheet param references not supposed to be used in burst-mode streaming? Or, is my usage incorrect? Kindly help.
Saxon version: Saxon-EE (evaluation copy)
testGlobalVarStreaming.xsl - stylesheet under test. 
withParamReference.xml - execution plan for testGlobalVarStreaming.xsl.
withoutParamReference.xml - execution plan with the reference to stylesheet param commented out.


Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:

saxon-help mailing list archived at http://saxon.markmail.org/