16.1. About process commands
Like macro-commands, a process command in XMLmind XML Editor - Commands is a command specified in XML. But a macro-command acts on elements, attributes and on the text or node selection, while a process command acts on files.
Moreover the current working directory (that is, directory "
.") of a process command is always a temporary directory especially created for the execution of the process command. This means that all files and directories created in this temporary directory will go away once the execution of the process command is complete.
rng_section_config/common.incl (same file for all variants):
<mkdir dir="images" />
<resources match="^[a-zA-Z][a-zA-Z0-9.+-]*:/.+" />
<resources match=".+\.(png|jpg|jpeg|gif)" copyTo="images" />
<transform stylesheet="html.xsl" file="__doc.xml" to="__doc.html" />
<copyFile file="__doc.html" to="%0" />
<copyFiles files="images/*" toDir="images" />
process element has a number of child elements which are verbs acting on files and directories. Among these verbs, you'll find
mkdir in XMLmind XML Editor - Commands.
Here we use
mkdir to create an
images/ directory. The
images/ directory will contain a copy of some of the image files referenced in the "Simple Section" document being converted.
copyDocument in XMLmind XML Editor - Commands is used to copy the document being converted to
__doc.xml. Note that in the case the document being converted contains inclusions (XInclude, DITA
conref, etc), these inclusions are fully transcluded in order to ease the job of the XSLT engine.
resources element in XMLmind XML Editor - Commands specifies that resource files referenced in the document being converted by the means of absolute URIs (e.g.
<image source="http://www.acm.com/logo.gif"/>) should be ignored.
resources element specifies that resource files referenced in the document being converted by the means of relative URIs ending with "
.jpg", etc, (e.g.
<image source="photos/photo43.jpg"/>) should be copied to the
Of course, this implies a fixup of the corresponding reference in
<image source="photos/photo43.jpg"/> becomes
transform in XMLmind XML Editor - Commands invokes the XSLT engine (Saxon 6.5 or Saxon 9 depending on the version of the XSLT stylesheet) in order to transform
__doc.html using stylesheet
upload in XMLmind XML Editor - Commands is used to upload file
__doc.html and directory
images/ to the location specified by
By upload, we really mean upload and not simply copy these files somewhere else on the local file system. For example, if you install the add-on called "FTP virtual drive plug-in", you'll be able to select an "
ftp:" (or "
ftps:" or "
sftp:") URI using
selectConvertedFile and then upload file
__doc.html and directory
images/ to the FTP server you have chosen.
All commands may be passed a parameter. This parameter may be considered to contain a number of arguments separated with whitespace (an argument itself containing whitespace should be quoted using single or double quotes). Variable
%0 specifies the first argument,
%2 the second one, etc, up to
%9. For example, if a macro or process command is passed parameter "
one 'two three' four", then
%0 contains "
%1 contains "
two three" and
%2 contains "
sect.toHTML is passed a parameter containing the quoted URI of the save file, hence
%0 contains the URI of the save file.