Advanced embedding method: first invoke a preprocessor which will
generate intermediate .ditac files, then invoke the XSLT 2.0 engine
in order to transform all these .ditac files.

This method consists in first invoking the PreProcessor in order to pre-process the DITA
source files into a ditac_lists.ditac_lists file and
one or more .ditac files; then invoking the Saxon XSLT
2.0 engine in order to transform all the .ditac files.

For some output formats, PDF, RTF, etc, the final third step consists
in invoking an XSL-FO processor such as Apache
FOP in order to convert the XSL-FO generated by the XSLT
stylesheets to the desired output format.

A PreProcessor is not concerned about
the exact output format. However its behaves differently
depending on the target Media .

A PreProcessor handles to an ResourceHandler all the resource files,
typically image files, referenced in the DITA source using
relative URLs. An ResourceHandler is
registered with a PreProcessor using method
setResourceHandler .

In the case of
the Embed2 sample, we use the simplest
possible ResourceHandler which is ResourceCopier .

In the case of Embed2, the above loop is not
strictly needed. We specified
preProc.setChunking(Chunking.SINGLE) and therefore
the PreProcessor generates a single
.ditac file.

Copy the resources of the XSLT stylesheets (CSS stylesheets,
icons, etc) to output subdirectory res/. Note that
the images referenced in the DITA source, if any, have already been
copied to output subdirectory img/ by the
ImageCopier.

Compiling and executing the Embed2
sample

Compile the Embed2 sample by running
ant in
ditac_install_dir/doc/manual/embed/.

Execute
the Embed2 sample by running
antembed2 in
ditac_install_dir/doc/manual/embed/.
This will convert
ditac_install_dir/docsrc/manual/manual.ditamap
to single HTML 4.01 page
ditac_install_dir/doc/manual/embed/manual.html.

Note
that Embed2.java contains ``hardwired filenames''.
This means that this sample cannot be run from elsewhere than
ditac_install_dir/doc/manual/embed/.