script

Script elements are essential components of X-SQLT language. They define what and how will be processed and where to store results of this processing. Each script element consists of the source, xsql, transform and destination elements.

You can define as many script elements as you want in the project (but at least one). By using the test attribute, you can skip execution of given script. Although the name attribute is optional, you can use it to identify your script elements.


Example

    
  <?xml version="1.0" ?>
  <xsqlt>
    <script name="script-title" 
            test="condition-to-execute">
      <source> ... </source>
      <xsql> ... </xsql>
      <transform> ... </transform>
      <destination> ... </destination>
    </script>
    <script>
      ...
    </script>
    ...
  </xsqlt>      
    

Attributes

name
Optional attribute that represents the script title.
test
As you can see in example above, you can use test attribute to set up a condition for processing individual scripts. The condition can refer to parameters and to the content of named streams (supported are streams of size lower than 256 bytes). For named streams, there is also a special identifier "stream$size" declared, that can be used to test the stream size (all sizes are supported here).

Child elements

source
Identifies the source of script processing. This could be a file, database or stream (X-SQLT supports named streams, that can be used to comfortably link results of individual scripts into the complex chain). See source.
xsql
This element is applicable only there, where the database source or database destination is used. It declares the SQL script, that will be executed over the given source database. This could be a standard SQL script or extended SQL script. See xsql.
transform
Specifies the transformation options. Transformation is applied on the source file or on results of SQL processing, based on the kind of source and on the presence of xsql element in the script. If there is not defined any transform element, no transformation is applied. Transformation element can define XSLT, XPath, or any other kind of transformation, that is supported by concrete processor of X-SQLT language (like XML, CSV or JSON transformations implemented in X-SQLT Command-line Processor). See transform.
destination
Identifies the destination (target) of script processing. This could be a file, named temporary stream or database. So, results of SQL processing and / or the selected transformation will be stored into the file, stream or database that is specified here. This element has exactly the same syntax as source element. See destination.

Parent element

xsqlt
See xsqlt (a root element).