Using Stylus Studio from the Command Line

Stylus Studio provides utilities that allow you to perform several Stylus Studio operations from the command line. These utilities, and where to find more information on them, are described in the following table.

Utility Name
Description
Where to Find More Information
struzzo
Invokes Stylus Studio
StylusDiff
Diffs two XML documents
StylusValidator
Validate XML
StylusXql
Execute an XQuery
StylusXslt
Apply a stylesheet
Table 5.

The executables for these command line utilities are located in the \bin directory where you installed Stylus Studio.

Invoking Stylus Studio from the Command Line

You use the Struzzo utility to invoke Stylus Studio from the command line and open a particular file. Stylus Studio recognizes the file extension and opens the file in the editor associated with that file type. If Stylus Studio is already running, the same instance is used to open the file specified in the file parameter.

You can optionally use the stylesheet or XQuery parameter to create a scenario with the stylesheet or XQuery you specify.

The Struzzo utility takes the following format:

Struzzo file 
              [stylesheet or XQuery
              ]
               

            

Table 6 describes the parameters for the Struzzo command.

Parameter
Description
file
The path of the document you want to open in Stylus Studio. This document is used as the source document in a scenario when you provide the stylesheet or XQuery parameter.
[stylesheet or XQuery]
The path of the stylesheet or XQuery you want to use to create a scenario.
Table 6. Struzzo Command Line Parameters

Applying a Stylesheet from the Command Line

You use the StylusXslt utility to apply a stylesheet from the command line. The StylusXslt utility uses the XSLT and XPath processors specified in Stylus Studio.

One way you might want to use the StylusXslt command-line utility is to chain stylesheets. That is, you can create a batch file in which Stylus Studio consecutively applies multiple stylesheets to the same XML source document. Stylus Studio creates temporary files to specify the result of one transformation as the source for the next transformation.

The StylusXslt utility takes the following format:

StylusXslt [-fop] [-print] source stylesheet [result] [param=value]...
               

            

Table 7 describes the parameters for the StylusXql command.

Parameter
Description
[-fop]
Invokes the Apache Formatting Objects Processor (FOP) to post-process the XSLT result.
[-print]
Sends the result of the transformation to the default printer.
source
The path of the XML document to which you want to apply the stylesheet specified in the stylesheet parameter.
stylesheet
The path of the XSLT you want to apply to the document specified in the source parameter.
[result]
File to which you want the XSLT result to be written. The default is stdout.
[param=value]
The name-value pair of a parameter in the stylesheet specified in the stylesheet parameter.
Table 7. StylusXslt Command Line Parameters

Executing an XQuery from the Command Line

 

XQuery support is available only in Stylus Studio XML Professional Edition.

You use the StylusXql utility to execute an XQuery from the command line. The format for invoking the utility is as follows:

StylusXql [-in <source>] [-out<
              output file>] [-param name+value] [-i] [-debug 
host[:port]] <XQuery file>
               

            

Table 8 describes the parameters for the StylusXql command. All parameters are required.

Parameter
Description
-in <source>
The path of the XML document to be used to set the current context for the XQuery.
-out <output file>
File to which you want the XQuery result to be written. The default is stdout.
-param name=value
The name-expression pair of a variable in the XQuery specified in the XQuery file parameter.
-i
Indents the XQuery result.
-debug host[:port]
Debugs the query using the debug server specified by the host and, optionally, port parameters.
XQuery file
The path of the XQuery you want to execute against the file specified in the -in <source> parameter.
Table 8. StylusXql Command Line Parameters

Validating XML from the Command Line

You use the StylusValidator utility to validate XML from the command line. StylusValidator uses the built-in Stylus Studio XML validator. All output from this utility goes to stdout.

The StylusValidator utility takes the following format:

StylusValidator [-q] [-noval] [-schema] filename
               

            

Table 9 describes the parameters for the StylusXql command.

Parameter
Description
[-q]
Quiet mode - errors are not printed to stdout.
[-noval]
Checks only for well-formedness. Does not check for errors.
[-schema file ]
Validates the XML document against the XML Schema specified in the file parameter.
filename
The path of the XML document you want to validate.
Table 9. StylusValidator Command Line Parameters

 
Free Stylus Studio XML Training: