<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="sql-extension" page="query" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: sql:query</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: sql:query"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>sql:query</h1>
      <p><code>sql:query</code> 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 <code>sql:query</code> instruction as a child of <code>xsl:variable</code>.
The attributes are as follows:</p>
      <table>
         <tr>
            <td content="para">
               <p>connection</p>
            </td>
            <td content="para">
               <p>The database connection.
This is mandatory, the value is an expression, which must evaluate to a database connection
object as returned by <code>sql:connect</code>.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>table</p>
            </td>
            <td content="para">
               <p>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.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>column</p>
            </td>
            <td content="para">
               <p>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.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>where</p>
            </td>
            <td content="para">
               <p>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.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>row-tag</p>
            </td>
            <td content="para">
               <p>The element name to be used to contain each row. Must be a simple name (no colon
allowed). Default is "row".</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>column-tag</p>
            </td>
            <td content="para">
               <p>The element name to be used to contain each column. Must be a simple name (no colon
allowed). Default is "col".</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>disable-output-escaping</p>
            </td>
            <td content="para">
               <p>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 "&lt;" to "&amp;lt;".
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 
<a class="bodylink" href="../extensions/functions/parse.xml">saxon:parse</a>
extension function to process the contents of an XML column.</p>
            </td>
         </tr>
      </table>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="insert.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>