2.2. Using xxetool to convert documents

Usage:

xxetool [Advanced Option]* convert [Other Option]*
     [-t XSLT_stylesheet_file_or_URL]?
     [-r|-ru resource_name resource_value]*
     [-p|-pu XSLT_stylesheet_param_name XSLT_stylesheet_param_value]*
     process_command_name doc_file_or_URL
     [-s|-u process_command_arg]*

Converts XML document doc_file_or_URL using process command in XMLmind XML Editor - Commands called process_command_name, found in any of the XXE configuration files scanned during the startup of xxetool (see XMLmind XML Editor - Configuration and Deployment).

Options:

-t XSLT_stylesheet_file_or_URL

Use this alternate XSLT style sheet instead of the one specified in the first transform child element of the process command.

If specified process command has no transform child element but has subProcess child elements, these sub-processes are searched recursively for a transform child element.

-r|-ru resource_name resource_value

Copy specified resource rather than the one specified in the <copyProcessResources name="resource_name"> child element of the process command.

-ru is useful when the resource value is a relative filename that needs to be converted to an absolute "file:" URL.

-p|-pu XSLT_stylesheet_param_name XSLT_stylesheet_param_value

Add/replace corresponding XSLT style sheet parameter in the first transform child element of the process command.

-pu is useful when the parameter value is a relative filename that needs to be converted to an absolute "file:" URL.

If specified process command has no transform child element but has subProcess child elements, these sub-processes are searched recursively for a transform child element.

-s|-u process_command_arg

Pass these arguments to the process command as the values of process variables %0, %1, ..., %9.

If -s (String) is specified, the argument is passed as is.

If -u (URL) is specified, the argument, a file or directory name, is first converted to an URL.

Other options:

-profile -|file_or_URL

Apply this conditional processing (profiling) file to the document being converted.

This file may be

  • a ".ditaval" file optionally ending with "?media=screen" (default media) or "?media=print"

  • OR a ".profiles" file ending with a fragment (e.g. "#my_profile") specifying the ID of the selected profile.

Specify "-" to suppress profiling.

-d

Sets the debug attribute of the process command to value true (no matter what has been specified in the process element).

This prevents the process command from deleting its work directory (/tmp/xxeNNNN/) at the end of the processing.

-v|-vv|-vvv

Turn verbosity on. The more Vs, the more verbose.

Advanced options:

-auth credentials

This option can be used to specify authentication credentials for a given server. This allows to connect to the specified server without interactively asking the user to enter a username and a password.

String credentials consists in 6 fields: host, port, prompt, scheme, username, password, in that order, separated by a newline character ('\n'). Fields host, port, prompt, scheme can be left empty, which means: match any. The UTF-8 bytes of the string are then encoded in base-64.

Command-line utility XXE_install_dir/bin/authvalue allows to generate such encoded string. Example: encode string "\n\nDocument Store\n\nvictoria\nsecret":

/opt/xxe/bin$ authvalue victoria secret - "Document Store"
CgpEb2N1bWVudCBTdG9yZQoKanZpY3RvcmlhCnNlY3JldA==

/opt/xxe/bin$ xxetool convert -auth CgpEb2N1bWVudCBTdG9yZQoKanZpY3RvcmlhCnNlY3JldA== \
docb.toHTML http://www.acme.com/docstore/push_up.xml -u docs/

Command-line utility authvalue is auto-documented. Type authvalue, then press Enter to display a short documentation explaining how to use this utility.

-putpref key value

Adds or replace preference specified by key/value to the set of the user's preferences.

Note that the -putpref, -putprefs, -delprefs options change the user's preferences only during this invocation of xxetool. xxetool reads, but never writes the contents of file XXE_user_preferences_dir/preferences.properties.

-putprefs property_file_or_URL

Similar to -putpref except that several key/value pairs may be read from specified property file.

-delpref key

Removes preference specified by key from the set of the user's preferences.

Examples:

Example 1. Convert a DocBook document to multi-page HTML

  1. First run "xxetool convert" to list all availables process commands:

    $ xxetool convert
    
    db5.toEclipseHelp
    db5.toEpub
    ...
    docb.toHTML
    ...
  2. Process command docb.toHTML[2] looks good. Run "xxetool convert docb.toHTML" to print its online help:

    $ xxetool convert docb.toHTML
    
    xxetool convert [options] docb.toHTML docbook_file_or_URL \
      -u output_dir_filename_or_URL
    
      Convert DocBook document docbook_file_or_URL to multi-page HTML.
      Create the HTML pages in directory output_dir_filename_or_URL.
    
      Example:
      xxetool convert docb.toHTML doc.xml -u out/
    
  3. Use process command docb.toHTML to convert DocBook document help.xml to multi-page HTML created in directory docs/help/.

    $ xxetool convert -p toc.section.depth 4 -p chunk.section.depth 2 \
        docb.toHTML help.xml \
        -u docs/help

Example 2. Convert a DocBook document to PDF

  1. First run "xxetool convert" to list all availables process commands:

    $ xxetool convert
    
    db5.toEclipseHelp
    db5.toEpub
    ...
    docb.toPSFile
    ...
  2. Process command docb.toPSFile[3] looks good. Run "xxetool convert docb.toPSFile" to print its online help:

    $ xxetool convert docb.toPSFile
    
    xxetool convert [options] docb.toPSFile docbook_file_or_URL \
      -s pdf -s "|pdf" -u pdf_file_or_URL
    
      Convert DocBook document docbook_file_or_URL to PDF file pdf_file_or_URL.
    
      Example:
      xxetool convert docb.toPSFile doc.xml -s pdf -s "|pdf" -u out/doc.pdf
    ...
  3. Use process command docb.toPSFile to convert DocBook document doc.xml to commands.pdf.

    $ xxetool convert -t fo_docbook.xsl \
        -p toc.section.depth 4 -p callout.graphics 0 -p variablelist.as.blocks 1 \
        docb.toPSFile doc.xml \
        -s pdf -s "|pdf" -u docs/commands/commands.pdf

    Notice that an alternate, customized, XSLT style sheet, fo_docbook.xsl, is used instead of the stock docbook.xsl.




[2] The docb.toHTML process command is defined in XXE_install_dir/addon/config/docbook/xslMenu.incl.

[3] The docb.toPSFile process command is defined in XXE_install_dir/addon/config/docbook/xslMenu.incl.