25. Saxon-JS: Event handling
The natural unit of computation in XSLT is the template.
Saxon-JS leverages templates for event handling by using special modes. A template in the
ixsl:onchangemode, for example, will respond to “change” events on the elements it matches:<xsl:template mode="ixsl:onchange" match="select[@id='tz']"><!-- Handle changes to the drop down --></xsl:template>A template in the
ixsl:onclickmode will respond to “click” events on the elements it matches:<xsl:template mode="ixsl:onclick" match="input[@id='clock24']"><!-- Handle clicks on the 24-hour clock checkbox --></xsl:template>Generally, for all event types that “bubble”, a template in the mode
ixsl:ontypewill respond to “type” events in the DOM.