1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN"
|
---|
3 | "concept.dtd">
|
---|
4 | <concept id="preprocess-conref" xml:lang="en-us">
|
---|
5 | <title>Conref (conref)</title>
|
---|
6 | <shortdesc>The <codeph>conref</codeph> step resolves conref attributes, processing only the DITA
|
---|
7 | maps or topics that use the @conref attribute. This step is implemented in XSLT.</shortdesc>
|
---|
8 | <conbody>
|
---|
9 | <section><p>The values of the @id attribute on referenced content are changed as the elements are pulled into
|
---|
10 | the new locations. This ensures that the values of the @id attribute within the referencing
|
---|
11 | topic remain unique.</p><p>If an element is pulled into a new context along with a cross reference that references the
|
---|
12 | target, both the values of the @id and @xref attributes are updated so that they remain
|
---|
13 | valid in the new location. For example, a referenced topic might include a section as in the
|
---|
14 | following example: <fig>
|
---|
15 | <title>Referenced topic that contains a section and cross reference</title>
|
---|
16 | <codeblock><topic id="referenced_topic">
|
---|
17 | <title>...</title>
|
---|
18 | <body>
|
---|
19 | <section id="sect"><title>Sample section</title>
|
---|
20 | <p>Figure <xref href="#referenced_topic/fig"/> contains an code sample that demonstrates ... .</p>
|
---|
21 | <fig id="fig"><title>Code sample</title>
|
---|
22 | <codeblock>....</codeblock>
|
---|
23 | </fig>
|
---|
24 | </section>
|
---|
25 | </body>
|
---|
26 | </topic></codeblock>
|
---|
27 | </fig></p><p>When the section is referenced using a @conref attribute, the value of the @id attribute on the
|
---|
28 | <fig> element is modified to ensure that it remains unique in the new context. At the
|
---|
29 | same time, the <xref> element is also modified so that it remains valid as a local
|
---|
30 | reference. For example, if the referencing topic has an @id set to "new_topic", then the
|
---|
31 | conrefed <section> element may look like this in the intermediate document.<fig>
|
---|
32 | <title>Resolved conrefed <section> element after the conref step</title>
|
---|
33 | <codeblock><section id="sect"><title>Sample section</title>
|
---|
34 | <p>Figure <xref href="#new_topic/d1e25"/> contains an code sample that demonstrates ... .</p>
|
---|
35 | <fig id="d1e25"><title>Code sample</title>
|
---|
36 | <codeblock>....</codeblock>
|
---|
37 | </fig>
|
---|
38 | </section></codeblock>
|
---|
39 | </fig></p><p>In this case, the value of the @id attribute on the <fig> element has been changed to a
|
---|
40 | generated value of "d1e25". At the same time, the <xref> element has been updated to use
|
---|
41 | that new generated ID, so that the cross reference remains valid.</p></section>
|
---|
42 | </conbody>
|
---|
43 | </concept>
|
---|