preprocess-conref.html 9.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2019"><meta name="DC.rights.owner" content="(C) Copyright 2019"><meta name="DC.type" content="concept"><meta name="description" content="The conref step resolves content references, processing only the DITA maps or topics that use the conref attribute. This step is implemented in XSLT."><meta name="DC.subject" content=", fig, xref, section, conref, resolving, id, resolution, preprocessing, XSLT, step"><meta name="keywords" content=", fig, xref, section, conref, resolving, id, resolution, preprocessing, XSLT, step"><meta name="DC.relation" scheme="URI" content="../reference/preprocessing.html"><meta name="DC.relation" scheme="URI" content="../reference/preprocess-conrefpush.html"><meta name="DC.relation" scheme="URI" content="../reference/preprocess-profile.html"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="preprocess-conref"><meta name="DC.language" content="en-US"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Resolve content references (conref)</title></head><body id="preprocess-conref"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 3.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../topics/installing-client.html">Installing DITA-OT</a></li><li><a href="../topics/alternative-input-formats.html">Authoring formats</a></li><li><a href="../topics/building-output.html">Building output</a></li><li><a href="../parameters/index.html">Setting parameters</a></li><li><a href="../topics/customizing.html">Customizing DITA-OT</a></li><li><a href="../topics/troubleshooting-overview.html">Troubleshooting</a></li><li><a href="../reference/index.html">Reference</a><ul><li><a href="../reference/architecture.html">DITA-OT architecture</a><ul><li><a href="../reference/processing-structure.html">Processing structure</a></li><li><a href="../reference/map-first-preprocessing.html">Map-first preprocessing</a></li><li><a href="../reference/processing-pipeline-modules.html">Processing modules</a></li><li><a href="../reference/processing-order.html">Processing order</a></li><li><a href="../reference/preprocessing.html">Pre-processing modules</a><ul><li><a href="../reference/preprocess-genlist.html">Generate lists (gen-list)</a></li><li><a href="../reference/preprocess-debugfilter.html">Debug and filter (debug-filter)</a></li><li><a href="../reference/preprocess-mapref.html">Resolve map references (mapref)</a></li><li><a href="../reference/preprocess-branch-filter.html">Branch filtering (branch-filter)</a></li><li><a href="../reference/preprocess-keyref.html">Resolve key references (keyref)</a></li><li><a href="../reference/preprocess-copy-to.html">Copy topics (copy-to)</a></li><li><a href="../reference/preprocess-conrefpush.html">Conref push (conrefpush)</a></li><li class="active"><a href="../reference/preprocess-conref.html">Resolve content references (conref)</a></li><li><a href="../reference/preprocess-profile.html">Filter conditional content (profile)</a></li><li><a href="../reference/preprocess-topic-fragment.html">Resolve topic fragments and code references (topic-fragment)</a></li><li><a href="../reference/preprocess-chunk.html">Chunk topics (chunk)</a></li><li><a href="../reference/preprocess-metadata.html">Move metadata (move-meta-entries) and pull content into maps (mappull) </a></li><li><a href="../reference/preprocess-maplink.html">Map based linking (maplink)</a></li><li><a href="../reference/preprocess-topicpull.html">Pull content into topics (topicpull)</a></li><li><a href="../reference/preprocess-flagging.html">Flagging (flag-module)</a></li><li><a href="../reference/preprocess-clean-map.html">Map cleanup (clean-map)</a></li><li><a href="../reference/preprocess-copyfiles.html">Copy related files (copy-files)</a></li></ul></li><li><a href="../reference/XhtmlWithNavigation.html">HTML-based processing modules</a></li><li><a href="../reference/pdf-transform.html">PDF processing modules</a></li></ul></li><li><a href="../reference/DITA_spec-support.html">DITA specification support</a></li><li><a href="../reference/license.html">License</a></li></ul></li><li><a href="../topics/dita-and-dita-ot-resources.html">Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Resolve content references (conref)</h1>
  8. <div class="body conbody"><p class="shortdesc">The <code class="ph codeph">conref</code> step resolves content references, processing only the DITA maps or topics that
  9. use the <code class="keyword markupname xmlatt">@conref</code> attribute. This step is implemented in XSLT.</p>
  10. <section class="section">
  11. <p class="p">The values of the <code class="keyword markupname xmlatt">@id</code> attribute on referenced content are changed as the elements are pulled
  12. into the new locations. This ensures that the values of the <code class="keyword markupname xmlatt">@id</code> attribute within the referencing
  13. topic remain unique.</p>
  14. <div class="p">If an element is pulled into a new context along with a cross reference that references the target, both the
  15. values of the <code class="keyword markupname xmlatt">@id</code> and <code class="keyword markupname xmlatt">@xref</code> attributes are updated so that they remain valid in
  16. the new location. For example, a referenced topic might include a section as in the following example: <figure class="fig fignone"><figcaption><span class="fig--title-label">Figure 1. </span>Referenced topic that contains a section and cross reference</figcaption>
  17. <pre class="pre codeblock language-xml normalize-space show-line-numbers show-whitespace"><code>&lt;topic id="referenced_topic"&gt;
  18. &lt;title&gt;...&lt;/title&gt;
  19. &lt;body&gt;
  20. &lt;section id="sect"&gt;
  21. &lt;title&gt;Sample section&lt;/title&gt;
  22. &lt;p&gt;Figure &lt;xref href="#referenced_topic/fig"/&gt;
  23. contains a code sample that demonstrates ... .&lt;/p&gt;
  24. &lt;fig id="fig"&gt;
  25. &lt;title&gt;Code sample&lt;/title&gt;
  26. &lt;codeblock&gt;....&lt;/codeblock&gt;
  27. &lt;/fig&gt;
  28. &lt;/section&gt;
  29. &lt;/body&gt;
  30. &lt;/topic&gt;</code></pre>
  31. </figure></div>
  32. <div class="p">When the section is referenced using a <code class="keyword markupname xmlatt">@conref</code> attribute, the value of the <code class="keyword markupname xmlatt">@id</code>
  33. attribute on the <code class="keyword markupname xmlelement">&lt;fig&gt;</code> element is modified to ensure that it remains unique in the new
  34. context. At the same time, the <code class="keyword markupname xmlelement">&lt;xref&gt;</code> element is also modified so that it remains valid
  35. as a local reference. For example, if the referencing topic has an <code class="keyword markupname xmlatt">@id</code> set to "new_topic", then
  36. the conrefed element may look like this in the intermediate document <code class="keyword markupname xmlelement">&lt;section&gt;</code>. <figure class="fig fignone"><figcaption><span class="fig--title-label">Figure 2. </span>Resolved conrefed <code class="keyword markupname xmlelement">&lt;section&gt;</code> element after the conref step</figcaption>
  37. <pre class="pre codeblock language-xml normalize-space show-line-numbers show-whitespace"><code>&lt;section id="sect"&gt;
  38. &lt;title&gt;Sample section&lt;/title&gt;
  39. &lt;p&gt;Figure &lt;xref href="#new_topic/d1e25"/&gt; contains a code sample
  40. that demonstrates ... .&lt;/p&gt;
  41. &lt;fig id="d1e25"&gt;
  42. &lt;title&gt;Code sample&lt;/title&gt;
  43. &lt;codeblock&gt;....&lt;/codeblock&gt;
  44. &lt;/fig&gt;
  45. &lt;/section&gt;</code></pre>
  46. </figure></div>
  47. <p class="p">In this case, the value of the <code class="keyword markupname xmlatt">@id</code> attribute on the <code class="keyword markupname xmlelement">&lt;fig&gt;</code> element has
  48. been changed to a generated value of "d1e25". At the same time, the <code class="keyword markupname xmlelement">&lt;xref&gt;</code> element has
  49. been updated to use that new generated ID, so that the cross reference remains valid.</p>
  50. </section>
  51. </div>
  52. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../reference/preprocessing.html" title="The pre-processing operation is a set of steps that typically runs at the beginning of every DITA-OT transformation. Each step or stage corresponds to an Ant target in the build pipeline; the preprocess target calls the entire set of steps.">Pre-processing modules</a></div><div class="previouslink"><strong>Previous topic:</strong> <a class="link" href="../reference/preprocess-conrefpush.html" title="The conrefpush step resolves &#34;conref push&#34; references. This step only processes documents that use conref push or that are updated due to the push action. This step is implemented in Java.">Conref push (conrefpush)</a></div><div class="nextlink"><strong>Next topic:</strong> <a class="link" href="../reference/preprocess-profile.html" title="The profile step removes content from topics and maps based on the rules in DITAVAL files or the print attribute setting. Output can differ based on when filtering is done.">Filter conditional content (profile)</a></div></div></nav></article></main></body></html>