Saxonica: XSLT and XQuery Processing: Handling client system events

Handling client system events

As well as handling user-events on DOM elements, Saxon-CE also handles events raised by objects such as window that live outside the DOM.

Event handlers for such objects are written in the form of template rules. The match pattern is different from that for conventional templates because the pattern must be an ixsl function (e.g. ixsl:window() ) that returns the object whose event is to be handled. The mode name is the type of event, for example ixsl:onhashevent. An event notification causes a new transformation to take place, using the existing stylesheet. The initial context item for the transformation is set to the matched object.

While an event is being processed, the function ixsl:event() can be called to return the Event object; its properties and methods are available via the ixsl:get() and ixsl:call() functions.

Note that client system events can be caused both by user interaction and by your own XSLT. Browser behavior will be more predictable if your design does not rely on differentiating between events originating from users and from your own code.