sql:query
sql:query
performs a query, and writes the results of the query to
the result tree, using elements to represent the rows and columns. If you want to process
the results in the stylesheet, you can write the results to a temporary tree by using
the sql:query
instruction as a child of xsl:variable
.
The attributes are as follows:
connection |
The database connection.
This is mandatory, the value is an expression, which must evaluate to a database connection
object as returned by |
table |
The table to be queried (the contents of the FROM clause of the select statement). This is mandatory, the value is an attribute value template. |
column |
The columns to be retrieved (the contents of the SELECT clause of the select statement). May be "*" to retrieve all columns. This is mandatory, the value is an attribute value template. |
where |
The conditions to be applied (the contents of the WHERE clause of the select statement). This is optional, if present the value is an attribute value template. |
row-tag |
The element name to be used to contain each row. Must be a simple name (no colon allowed). Default is "row". |
column-tag |
The element name to be used to contain each column. Must be a simple name (no colon allowed). Default is "col". |
disable-output-escaping |
Allowed values are "yes" or "no", default is "no". The value "yes" causes the content of all rows/columns to be output as is, without converting special characters such as "<" to "<". This is useful where the database contains XML or HTML markup that you want to be copied into the result document. Use this option with care, however, since it applies to all the columns retrieved, not only to those that contain XML or HTML. An alternative is to use the saxon:parse extension function to process the contents of an XML column. |