XSQL is an XML-based format for describing simple stored
procedures that can parse XML data, query or update database tables
and compose XML output. Both input and output XMLs of such
procedures are usually standard three-level documents: a top-level
ROWSET element contains some
ROW elements and
ROW contains one element
per database field. XSQL lets the application developer avoid
writing routine code for parsing and composing such documents: the
server translates a short and self-evident XSQL description into a
relatively long Virtuoso/PL procedure.
XSQL pages are usually executed from XSLT stylesheets by calling
function. When the page is executed, it can access an XML entity
that is context entity of the
processXSQL() call. This entity is used inside
the page as an implicit parameter called "context XML".
An XSQL document that describes one procedure is called "XSQL page". A page consists of small directives. Every directive is written as a single XML element from namespace "urn:oracle-xsql" (the typical namespace prefix is "xsql"). Every directive describes one standard operation. The resulting Virtuoso/PL procedure will execute all directives in turn. Directives are of four sorts:
|Parameter assignments create and initialize local variables ("page parameters") that can be used in the rest of page.|
|Data modification requests can insert, delete or update data in database tables.|
|XML generators can query database or page parameters and produce XML fragments. These fragments form the resulting XML that is returned by the procedure.|
|DML directives let the author to put arbitrary Virtuoso/PL code in the procedure.|
All directives are children of one op-level element called 'xsql:page'. This element can have any number of attributes but no one attribute is used by Virtuoso. These attributes may be used by specialized XSQL editors and standalone XSQL processors that should establish a database connection to read and write data so store connection details as attributes of 'xsql:page'.
The XSQL development cycle consists of editing '.xsql' resources in the file system or Virtuoso DAV. The editing can take place using a regular text editor or a supporting XML editor or some specialized third-party XSQL tool.