1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN"
|
---|
3 | "concept.dtd">
|
---|
4 | <concept id="processing-order" xml:lang="en-us">
|
---|
5 | <title>DITA-OT processing order</title>
|
---|
6 | <shortdesc>The order of processing is often significant when evaluating DITA content. Although the
|
---|
7 | DITA specification does not mandate a specific order for processing, the DITA-OT has determined that
|
---|
8 | performing filtering before conref resolution best meets user expectations. Switching the order of
|
---|
9 | processing, while legal, may give different results. </shortdesc>
|
---|
10 | <conbody>
|
---|
11 | <section>
|
---|
12 | <p>The DITA-OT project has found that filtering first provides several benefits. Consider the
|
---|
13 | following sample that contains a <note> element that both uses conref and contains a @product
|
---|
14 | attribute:<codeblock><note conref="documentA.dita#doc/note" product="MyProd"/></codeblock></p><p>If the @conref attribute is evaluated first, then documentA must be parsed in order to retrieve
|
---|
15 | the note content. That content is then stored in the current document (or in a representation of
|
---|
16 | that document in memory). However, if all content with product="MyProd" is filtered out, then that
|
---|
17 | work is all discarded later in the build.</p><p>If the filtering is done first (as in the DITA-OT), this element is discarded immediately, and
|
---|
18 | documentA is never examined. This provides several important benefits:<ul>
|
---|
19 | <li>Time is saved by discarding unused content as early as possible; all future steps can load the
|
---|
20 | document without this extra content.</li>
|
---|
21 | <li>Additional time is saved case by not evaluating the @conref attribute; in fact, documentA does
|
---|
22 | not even need to be parsed.</li>
|
---|
23 | <li>Any user reproducing this build does not need documentA. If the content is sent to a translation
|
---|
24 | team, that team can reproduce an error-free build without documentA; this means documentA can be
|
---|
25 | kept back from translation, preventing accidental translation and increased costs.</li>
|
---|
26 | </ul></p>
|
---|
27 | <p>If the order of these two steps is reversed, so that conref is evaluated first, it is possible
|
---|
28 | that results will differ. For example, in the code sample above, the @product attribute will
|
---|
29 | override the product setting on the referencing note. Assume that the <note> elements in
|
---|
30 | documentA is defined as
|
---|
31 | follows:<codeblock><note id="note" product="SomeOtherProduct">This is an important note!</note></codeblock></p>
|
---|
32 | <p>A process that filters out product="SomeOtherProduct" will remove the target of the original
|
---|
33 | conref before that conref is ever evaluated, which will result in a broken reference. Evaluating
|
---|
34 | conref first would resolve the reference, and only later filter out the target of the conref. While
|
---|
35 | some use cases can be found where this is the desired behavior, benefits such as those described
|
---|
36 | above resulted in the current processing order used by the DITA-OT..</p></section>
|
---|
37 | </conbody>
|
---|
38 | </concept>
|
---|