Bug #3335


Lazy evaluation of sequence constructors - instructions with side effects evaluated early

Added by Pieter Masereeuw almost 7 years ago. Updated almost 7 years ago.

Start date:
Due date:
% Done:


Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Contact person:
Additional contact persons:



I have a problem with Saxon-JS. It seems to be related with either some optimization or, more likely, with concurrency.

I have a template that calls a named template "deactivate" (it modifies the current page sothat it looks disabled).

After that, it schedules an action for loading an external document (ixsl:schedule-action). The scheduled action is a named template that renders the document (<xsl:apply-templates select="doc(someurl)">). After rendering the document, it calls a named template "reactivate", which undoes the work of the earlier "deactivate".

I added a lot of xsl:messages, and in the console of Chrome, I see that template "reactivate" is sometimes called earlier than "deactivate". This seems to be especially the case when the doc() function has been passed a URL that it has seen before (so XSLT need not physically reload the document).

The "deactivate" template has the following structure:

  • xsl:message "started"

  • xsl:for-each:

    -- message "inside for-each"

  • xsl:message "completed"

Looking at the output in the Chrome console, the messages of the for-each show up at a strange moment, for example when the "completed" message of the entire template has already been printed.

I do recognize the fact that I may be doing things wrong, but I hope that you can shed some light on this. And if it does appear to be a bug, I think you want to know.

Now the application is relatively complex (and written in a mixture of Dutch, English and even a small amount of PHP), so if you are willing to investigate, perhaps I can give some instructions on how to reproduce the problem or even share my screen - I will be most happy to offer any help that is needed. Also, if I need to attempt to reduce the size of the application, let me know.

The behaviour is also seen in Firefox, but in my Firefox, xsl:messages are not shown in the console.

I attach the files plus a screen selection of the Chrome console. The numbers indicate, more or less, the expected order of messages.

Kind regards,

Pieter Masereeuw


chrome-console-log.png (99 KB) chrome-console-log.png Screen print selection of Chrome console Pieter Masereeuw, 2017-07-04 18:14 (1.1 MB) The application (refer to folder gtb) Pieter Masereeuw, 2017-07-04 18:14 (247 KB) Pieter Masereeuw, 2017-07-05 08:58

Please register to edit this issue

Also available in: Atom PDF Tracking page