1.19. Process variables

Almost all child elements and attribute values in a process element can include variables which are substituted just before the execution of the process-command. Example: <upload base="%0/">.

VariableDescription
%0, %1, %2, ..., %9, %*

A process-command can have a parameter. This string is split like in a command line. A part of the split parameter can be referenced as variable %0, %1, %2, ..., %9.

%* can be used to reference the whole parameter of the process-command.

%D, %d

%D is the file name of the document being edited. Example: C:\novel\chapter1.xml.

This variable is replaced by an empty string if the document being edited is found on a remote HTTP or FTP server.

%d is the URL of the document being edited. Example: file:///C:/novel/chapter1.xml.

%P, %p

%P is the name of the directory containing the document being edited. Example: C:\novel.

This variable is replaced by an empty string if the document being edited is found on a remote HTTP or FTP server.

%p is the URL of the directory containing the document being edited. Example: file:///C:/novel.

Note that this URL does not end with a '/'.

%N, %R, %E

%N is the base name of the document being edited. Example: chapter1.xml.

%R is the base name of the document being edited without the extension, if any (sometimes called the root name). Example: chapter1.

%E is the extension of the document being edited, if any. Example: xml.

Note that the extension does not start with a '.'.

%n, %r, %eSimilar to %N, %R, %E except that these variables contain properly escaped URI components. For example if %R contains "foo bar", then %r contains "foo%20bar".
%S

%S is the native path component separator of the platform. Example: '\' on Windows.

%UUser's account name. Example: john.
%H, %h%H is the user's home directory. Example: /home/john.

%h is the URL of the user's home directory. Example: file:///home/john.

Note that this URL does not end with a '/'.

%A, %a%A is the user's preferences directory. Example: /home/john/.xxe10.

%a is the URL of the user's preferences directory. Example: file:///home/john/.xxe10.

Note that this URL does not end with a '/'.

%X, %x

%X is the name of the user's current working directory (that is, the current working directory of XXE). Example: C:\Users\john\Documents\report.

%x is the URL of the user's current working directory. Example: file:///C:/Users/john/Documents/report.

Note that this URL does not end with a '/'.

%W, %w

%W is the name of the temporary process directory. Example: C:\temp\xxe1023E45.

%w is the URL of the temporary process directory. Example: file:///C:/temp/xxe1023E45.

Note that this URL does not end with a '/'.

%C, %c

%C is the name of the directory containing the XXE configuration file from which the process command has been loaded. Example: C:\Program Files\XMLmind_XML_Editor\addon\config\docbook.

%c is the URL of the above directory. Example: file:///C:/Program%20Files/XMLmind_XML_Editor/addon/config/docbook.

Note that this URL does not end with a '/'.

The "%" character can be escaped using "%%". The above variables can be specified as %{0}, %{1}, ..., %{R}, %{E}, etc, if it helps (see note about escaped URIs).

In addition to the above variables, a process command may reference any Java™ system property or environment variable. Examples: %{user.home} (for system property user.home), %{HOME} (for environment variable HOME)

[Note]

Most attribute and element values described in this documentation as being URIs (data type anyURI) in fact are not URIs. These attribute and element values can contain %-variables. They are required to be valid URIs only after the %-variables have been substituted with their values.

The problem is that URIs may also contain escaped characters which look very much like references to %-variables. For example, a whitespace must be escaped as "%20", which looks like a reference to variable %20.

In practice:

  1. It is recommended to specify variables as %{0}, %{1}, ..., %{d}, %{E}, etc, rather than as %0, %1, ..., %d, %E, etc, because it makes clear what is a variable reference and what is an escaped character.

  2. An escaped character such as "%20" should be specified as "%%20". However in practice there is no need to do so because variable %20 is almost never defined and a reference to a variable which is not defined is left as is.

Example: relative URI "docs/my report/my.doc.%0", where variable %0 represents a file extension, should be specified as "docs/my%%20report/my%%20doc.%0". However, "docs/my%20report/my%20doc.%0" works fine too as long as the macro-command or the process commands is passed less than 21 arguments.