Issue with switching the global context item to the HTML document within an ixsl:event template
The context item within an ixsl:event template switches to the matching node which may either be the event target node or the first matching ancestor of the target node. Such a template works effectively as a new transform, so all global variables are re-evaluated, the context item for global variables in this case is the document node of the html page hosting the event node. Likewise, the root expression '/' will return the host document node.
This behaviour, where context is switched, is intentional and helpful when writing to the HTML page in response to a user event, it's also reasonably intuitive. There is an issue, however: if a source document parameter was set in the initial transform, no reference to this is available within an ixsl:event template (global variables are re-evaluated). The proposed solution for this is to provide an ixsl:source() function that will always return the document node of the source for the original transform, or return an empty sequence if this was not set.
Please register to edit this issue