SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
XPath API for Java
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
| Introduction
| sql:connect
| sql:query
| sql:insert and sql:column
| sql:update and sql:column
| sql:delete
| sql:close
| Example
» | A Warning about Side-Effects
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# A Warning about Side-Effects

XSLT does not guarantee the order of execution of instructions. In principle, the `sql:close` instruction could be evaluated before the `sql:query` instruction, which would obviously be disastrous.

In practice, Saxon's order of execution for XSLT instructions is reasonably predictable unless you use variables, or unless you invoke stylesheet functions from within an XPath expression. Using the SQL extension instructions within templates that are directly invoked is thus fairly safe, but it is not a good idea to invoke them as a side-effect of computing a variable or invoking a function. The exceptions are `sql:connect` and `sql:query`: if you use these instructions to evaluate the content of a variable, then of course they will be executed before any instruction that uses the value of the variable.