The Saxon SQL Extension

The Saxon distribution includes a set of extension elements providing access to SQL databases. These are not intended as being necessarily a production-quality piece of software (there are many limitations in the design), but more as an illustration of how extension elements can be used to enhance the capability of the processor.

To use the SQL extension elements in a stylesheet, you need to define a namespace prefix (for example "sql") in the extension-element-prefixes attribute of the xsl:stylesheet element, and to map this prefix to a namespace URI, conventionally http://saxon.sf.net/sql. This namespace must be bound in the Configuration to the class net.sf.saxon.option.sql.SQLElementFactory. This binding can be done either by calling Configuration.setExtensionElementNamespace(), or by means of an entry in the configuration file.

This changed in Saxon 9.2. In Saxon 9.1 and earlier releases it was necessary to use a namespace ending in "/net.sf.saxon.sql.SQLElementFactory". It is still possible to use the same namespace, but it must now be bound explicitly.

This extension defines eight new stylesheet elements: sql:connect, sql:query, sql:insert, sql:column, sql:update, sql:delete, sql:execute, and sql:close, described in the following sections.

Note: this extension is not available on the .NET platform.