openjade Command in Linux



The openjade command in Linux applies DSSSL stylesheets to SGML or XML documents. DSSSL (Document Style Semantics and Specification Language) is a standardized language used to specify stylesheets for SGML (Standard Generalized Markup Language) documents.

The DSSSL engine takes an SGML or XML document as input and outputs it into various formats such as RTF, TeX, MIF, or XML representation of the flow object tree.

Table of Contents

Here is a comprehensive guide to the options available with the openjade command −

Installation of openjade Command

By default, the openjade tool may not be available in Linux to install it, use the instructions given below −

To install openjade on Ubuntu, Kali Linux, Debian, and other Debian-based distributions, use the following command −

sudo apt install openjade

To install it on Arch Linux, use the command given below −

sudo pacman -S openjade

To install it on CentOS, use −

sudo yum install openjade

To install it on Fedora, use the following command −

sudo dnf install openjade

To verify the installation, check the version of the openjade command −

openjade --version
openjade Command in Linux1

Or check the binary path using the which command −

which openjade
openjade Command in Linux2

Syntax of openjade Command

The syntax of the openjade command is as follows −

openjade [options] [inputfile]

The [options] field is used to specify various options to change the command’s behavior. The [inputfile] is used to specify the SGML or XML document.

openjade Command Options

The options of the openjade command are listed below −

Options Description
-a linktype --activate=linktype Activates a specific link type, limiting some output
-A architecture --architecture=architecture Parses with respect to a specified architecture
-d dsssl_spec Specifies the system identifier (URI or path) of the DSSSL stylesheet to use
-E number --max-errors=number Limits the number of errors (default: 200)
-G --debug Enables debug mode (Displays a stack trace when an error occurs in expression evaluation. Disables tail-call optimization)
-c filename --catalog=filename Uses catalog files instead of the document entity to resolve system identifiers (The first DOCUMENT entry in the catalog is used)
-f file --error-file=file Redirects errors to a specified file
-s --strict Enables strict compliance mode (Ensures no predefined character names or entity mappings are used, which helps check portability across DSSSL implementations)
-t output_type --output-type=output_type Specifies the output format (fot, rtf, tex, sgml, xml, html, mif)
-o output_file --output-file=output_file Specifies the output file name (If not provided, OpenJade generates an output filename based on the input file s name and output type)
-V variable Defines a DSSSL variable with a value of #t (true). Takes priority over any existing definitions in the stylesheet
-V variable=value Defines a DSSSL variable with a specified value (This definition takes priority over any existing ones in the stylesheet)
-V definition --define=definition Defines a DSSSL variable with a specific value using a Scheme expression
-w warning_type --warning=warning_type Controls warnings (Multiple -w options can be used, with types like xml, mixed, sgmldecl, should)

Examples of openjade Command in Linux

In this section, the usage of the openjade command will be discussed with examples −

Transforming SGML to RTF

To transform SGML to RTF, use the following command −

openjade -d stylesheet.dsl -t rtf -o output.rtf file.sgml

The -d option is used to specify the stylesheet or .dsl file. The -t (--output-type) option is used to specify the output format; a list of output formats is given below −

  • fot
  • rtf
  • tex
  • sgml
  • xml
  • html
  • mif

The -o (--output-file) option is used to specify the output file.

The above command will generate an RTF file in the current working directory from the file.sgml, using the DSSSL specified in stylesheet.dsl.

openjade Command in Linux3

Transforming XML to HTML

Similarly, to generate HTML from the XML, use the following command −

openjade -d stylesheet.dsl -t html -o output.html file.xml

Enabling Debugging

To enable the debugging mode, use the -G or --debug option −

openjade -d stylesheet.dsl -G file.sgml

Passing Variable to Stylesheet

To pass a variable to the stylesheet, use the -V option with the variable.

openjade -V title= "My File" -d stylesheet.dsl file.sgml

The above command overrides or sets the value of a variable named title to My File.

Generating XML Representation of the Flow Object Tree

To generate an XML representation of the DSSSL flow object tree use the following command −

openjade -d stylesheet.dsl -t fot -o flow_objects.xml file.xml
openjade Command in Linux4

Enabling Strict Compliance

To enable strict compliance to ensure the stylesheet is portable by adhering strictly to DSSSL specifications, use the -s or --strict option −

openjade -s -d stylesheet.dsl file.xml

Moving Errors to a File

To move errors to a file, use the -f or --error-file option −

openjade -f errors.log -d stylesheet.dsl file.xml

Controlling Warnings

To display the specific warnings, use the -w or --warning option with the warning type −

openjade -d stylesheet.dsl -w duplicate file.xml

Multiple warnings can also be specified −

openjade -d stylesheet.dsl -w duplicate -w empty file.xml

Displaying help

To display help about the openjade command, use the -h or --help option −

openjade -h

Conclusion

The openjade command in Linux is a handy tool for applying DSSSL stylesheets to SGML or XML documents, allowing transformation into formats like RTF, TeX, or HTML. Its syntax allows customization of output formats, specification of stylesheets, and enabling debugging, strict mode, and customizing the warnings.

In this tutorial, we explained the openjade command, its installation, syntax, options, and usage in Linux with examples.

Advertisements