processing-order.dita 3.9 KB

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