This topic describes the set of steps commonly known as the pre-processing stage of a DITA build. These steps typically run at the start of any build using the DITA-OT, regardless of the final output format.
Each step described corresponds to one Ant target in the build pipeline. The general Ant target "preprocess" will call all of the targets described here.
The gen-list step examines the input files and creates lists of topics, images, document properties, or other content. These lists are used by later steps in the pipeline. For example, one list includes all topics that make use of the conref attribute; only those files are processed during the conref stage of the build. This step is implemented in Ant and Java.
The result of this list is a set of several list files in the temporary directory, including dita.list and dita.xml.properties.
| List file property | List file | List property | Usage |
|---|---|---|---|
| canditopicsfile | canditopics.list | canditopicslist | |
| chunkedditamapfile | chunkedditamap.list | chunkedditamaplist | |
| chunkedtopicfile | chunkedtopic.list | chunkedtopiclist | |
| codereffile | coderef.list | codereflist | topics with coderef |
| conreffile | conref.list | conreflist | Documents that contains conref attribute that need to be resolved in preprocess. |
| conrefpushfile | conrefpush.list | conrefpushlist | |
| conreftargetsfile | conreftargets.list | conreftargetslist | |
| copytosourcefile | copytosource.list | copytosourcelist | |
| copytotarget2sourcemapfile | copytotarget2sourcemap.list | copytotarget2sourcemaplist | |
| flagimagefile | flagimage.list | flagimagelist | |
| fullditamapandtopicfile | fullditamapandtopic.list | fullditamapandtopiclist | All of the ditamap and topic files that are referenced during the transformation. These may be referenced by href or conref attributes. |
| fullditamapfile | fullditamap.list | fullditamaplist | All of the ditamap files in dita.list |
| fullditatopicfile | fullditatopic.list | fullditatopiclist | All of the topic files in dita.list |
| hrefditatopicfile | hrefditatopic.list | hrefditatopiclist | All of the topic files that are referenced with an href attribute |
| hreftargetsfile | hreftargets.list | hreftargetslist | link targets |
| htmlfile | html.list | htmllist | resource files |
| imagefile | image.list | imagelist | Images files that are referenced in the content |
| keyfile | key.list | keylist | List of keys. The format
is:keyname "=" link "(" source ")"
Both href and source URLs
are relative to base directory. |
| keyreffile | keyref.list | keyreflist | Topics and maps which have key references. |
| outditafilesfile | outditafiles.list | outditafileslist | |
| relflagimagefile | relflagimage.list | relflagimagelist | |
| resourceonlyfile | resourceonly.list | resourceonlylist | |
| skipchunkfile | skipchunk.list | skipchunklist | |
| subjectschemefile | subjectscheme.list | subjectschemelist | |
| subtargetsfile | subtargets.list | subtargetslist | |
| tempdirToinputmapdir.relative.value | |||
| uplevels | |||
| user.input.dir | Absolute input directory path | ||
| user.input.file.listfile | Input file list file | ||
| user.input.file | Input file path, relative to input directory |
The debug-filter stage processes all referenced DITA content, and creates copies in a temporary directory for use during the remainder of the build. Several modifications are made during this process.
As the files are copied, the following modifications are made:
This step is implemented in Java.
The copy-files step copies related non-DITA resources to the output directory, such as HTML files referenced in a map or images referenced by DITAVAL files.
The conrefpush step resolves "conref push" references. The conref push feature was added in the DITA 1.2 specification, and the associated processing is available in DITA-OT version 1.5 and later. This step only processes documents that use conref push (or that are updated due to the push action). The step is implemented in Java.
The conref step resolves traditional conref attributes, processing only the documents that use the conref attribute. Each map or topic is processed with XSLT to resolve the attributes.
As part of the process, IDs within referenced content are changed as they are pulled into the new location. This is done in order to ensure that IDs within the original (referencing) topic remain unique.
<topic id="referenced_topic">
<title>...</title>
<body>
<section id="sect"><title>Sample section</title>
<p>Look at the next figure <xref href="#referenced_topic/fig">here</xref>.</p>
<fig id="fig"><title>Sample</title>
<p>This is a rather useless figure, but it
illustrates a point.</p>
</fig>
</section>
</body>
</topic>
<section><title>Sample section</title>
<p>Look at the next figure <xref href="#new_topic/d1e25">here</xref>.</p>
<fig id="d1e25"><title>Sample</title>
<p>This is a rather useless figure, but it
illustrates a point.</p>
</fig>
</section>
In this case, the ID of the figure has been changed to a generated value of "d1e25". At the same time, the <xref> element has been updated to use that new generated ID, so that the reference stays local in the updated topic.
The move-meta-entries step pushes metadata back and forth between maps and topics. For example, index entries and copyrights in the map are pushed into affected topics, so that topics may be processed later in isolation while retaining all relevant metadata.
The keyref step examines all keys defined in the source material, and updates key references appropriately. Links that make use of keys are updated so that any href value is replaced by the appropriate target; key based text replacement is also evaluated. The keyref mechanism was defined as part of the DITA 1.2 standard, and is available in DITA-OT 1.5 and later.
This step is implemented in Java.
The coderef module resolves references made with the <coderef> element, which was added in DITA 1.2. This module is available in DITA-OT 1.5 and later.
The <coderef> element is used inside of <codeblock> to reference code stored externally in non-XML documents. During the pre-process step, this Java module pulls the referenced content into the <codeblock> element.
The mapref module resolves references from one map to another.
<topicref href="other.ditamap" format="ditamap"/>
<mapref href="other.ditamap"/>
In either case, the element that references the other map is replaced by the topic references from the other map. Relationship tables are pulled into the referencing map as a child of the root element (<map> or a specialization of <map>).
This step is implemented in XSLT.
The mappull step pulls content from referenced topics into maps, and cascades data within maps.
The chunk step is a Java module that breaks apart and assembles referenced DITA content based on the chunk attribute in maps.
These two steps work together to create links based on a map and move those links into referenced topics. The links are created based on hierarchy (parent/child), the collection-type attribute (sequential or family links), and relationship tables.
The maplink module first runs an XSLT program that evaluates the map, and places all generated links into a single file in the temporary processing directory. Once that file is created, the move-links module runs a Java program that pushes the generated links into the proper topics.
The topicpull module pulls content into <xref> and <link> elements (if needed).
For <xref> elements, if the <xref> does not contain link text, the target is examined and link text is pulled. For example, a reference to a topic will pull the title of the topic; a reference to a list item will pull the number of the item. If the <xref> element references a topic that has a short description, and the <xref> element does not already contain a child <desc> element, a <desc> element is created with the short description of the target.
The process is similar for <link> elements. If the <link> does not have a child <linktext> element, one is created with the appropriate link text. Similarly, if the <link> element does not have a child <desc> element, and the short description of the target can be determined, a <desc> is created with the short description of the target.
This step is implemented in XSLT.