jd.xslt - Command-Line

This is a description of all command-line arguments and options to jd.xslt.

Synopsis:  java jd.xml.xslt.Stylesheet [options] xmluri [xsluris...]

xmluri is the URI of a XML document or "-" for STDIN.
xsluris... are zero or more URIs of stylesheet documents. If their number is
 = 0: use the associated stylesheets of the XML document
 = 1: transform the input with that stylesheet
 > 1: chain the stylesheets using the output of a transformation as input to next one
Possible URIs are relative or absolute file names (like a.xml, c:\a.xsl) or absolute URLs (like http://myhost.com/a.xml).
The uri urn:jdxslt:identity denotes the identity transformation. 1

The valid options are:

-entityresolver <class> Set a SAX EntityRresolver: class is the name of a class that implements the interface org.xml.sax.EntityResolver.
-errorstack In case of an error the transformation aborts and displays a diagnostic error message. If this option is switched on, then the stack trace of the error is also shown.
-help or -? Print the command-line help.
-media media Filter associated stylesheets by their media attribute.
-model class Set a model builder factory which is used to construct models from XML documents. This option allows easy integration of jd.bigxml into the commandline interface.
class is the name of a class that implements the class jd.xml.xpath.model.build.ModelBuilderFactory.
The class values normal and big are recognized as abbreviations for the normal and jd.bigxml model.
-model:key value Set a property of the current model builder factory. This option especially allows easy to customize the properties of jd.bigxml by a commandline input.
-msglistener class Set a message listener which is invoked for xsl:message instructions. class is the name of a class that implements the interface jd.xml.xslt.MessageListener.
-out file Write the transformation output to the file. It will overwrite the file if it already exists. If the file name contains a nonexistent directory, then the directory is automatically created. If the -out option is not set, the output is written to the console.
-out:<property> method Set the value of a xsl:output property. This option overrides the output property as specified by the stylesheet.
Example: -out:indent yes -out:method xml
The possible values for -out:method are xml, html, text and the non standard output methods canonical-xml and empty (see Output-Extensions).
-param name expr Set the value of a top-level parameter with the given name. expr is a XPath expression which can be evaluated without an expression context. Multiple -param options are possible.
Example:  -param n 1 -param b true() -param s 'abc'
will set the top-level parameter named n to the number value 1, the parameter b to the boolean value true and the parameter s to the string value 'abc'.
-parser class Set the parser which is used to parse XML and XSL documents.
class is the name of a class that implements one of these interfaces:
-   org.xml.sax.XMLReader
-   org.xml.sax.Parser
-   org.xmlpull.v1.XmlPullParser
jd.xslt automatically instantiates a default parser if this option is not set.
The class names of some popular parser are listed on the parser page.
-parserxml class Set the parser which is used to parse xml documents.
-parserxsl class Set the parser which is used to parse stylesheet documents.
-proxy url Use a proxy host when accessing documents which are referenced by a URL.
url is the url of the proxy, consisting of protocol, host name and port (for instance http://myproxy:8080). When the protocol is not specified then it defaults to http. When the port is not specified it defaults to the protocol-dependent default port.
-repeat number Execute the transformation n times. Use this option in combination with -verbose to gather more accurate timing information, since JIT compilers need some time to gain full performance.
-security class Set a XsltSecurityManager: class is the name of a class that implements the interface jd.xml.xslt.XsltSecurityManager.
-trace Create trace output.
-title title Filter associated stylesheets by their title attribute.
-uriresolver class  Set an uriresolver, which is used to resolve URIs to a XML document: class is the name of a class that implements the interface jd.xml.util.UriResolver or javax.xml.transform.URIResolver.
-validate Validate XML documents.
-verbose Turn on verbose mode to display transformation and performance info.
-w0 Recover silently from recoverable errors 2.
-w1 Report recoverable errors and continue (default).
-w2 Treat recoverable errors as fatal.

Argument Files

Any command-line argument starting with the character '@' is treated as argument file, i.e the file which is denoted by the rest of that argument string is opened, and the argument is replaced by the file content, with each line of the file producing a new argument.

Exit Codes

The command-line process terminates with a call to System.exit(int exitcode): The following exit codes are defined:

Value Constant Meaning
0 CommandLine.EXIT_OK no errors
1 CommandLine.EXIT_INCORRECT_USAGE a wrong command-line parameter was supplied
2 CommandLine.EXIT_PARSE_ERROR a parse error occured
3 CommandLine.EXIT_STYLESHEET_ERROR the stylesheet contains a syntax error
4 CommandLine.EXIT_RUNTIME_ERROR a runtime error during transformation occured


[1]  The identity transformation can especially be used to create a document version with proper indentation or a document in canonical XML form:
java jd.xml.xslt.Stylesheet -out:method canonical-xml test.xml urn:jdxslt:identity
java jd.xml.xslt.Stylesheet -out:indent yes test.xml urn:jdxslt:identity
[2]  Currently these recoverable errors are handled by the -wx options:
  1. If there is an error when evaluation a call to the document()-function, then the processor may recover by returning an empty node-set.
  2. If the content of a xsl:processing-instruction contains the string ?>, then the processor may recover by inserting a space after any occurrence of ? that is followed by a >.
  3. If the content of a xsl:comment contains the string -- or ends with -, then the processor may recover by by inserting a space after any occurrence of - that is followed by another - or that ends the comment.


main page