|
20 | 20 | an element in another file might look like this:
|
21 | 21 | </p><pre><ul conref="domestic_duck_warehouse.dita#domestic_warehouse/nesting_materials">
|
22 | 22 | <li/>
|
23 |
| -</ul></pre><p>This |
24 |
| - conref pulls a <ul> element from a warehouse topic that contains reusable |
25 |
| - elements relevant to domestic ducks. </p><p>If the topic containing this conref must |
26 |
| - be reusable, a hard-coded filename will be a problem. To use the reusable topic in a |
27 |
| - map that discusses wild ducks, the conref needs to point to a different warehouse |
28 |
| - topic file (wild_duck_warehouse.dita). </p><p>Rather than hard code the path to a |
29 |
| - file, you can use the conkeyref attribute to create a content reference that uses a |
30 |
| - key, rather than a filename. </p><image keyref="i_conkeyref" id="image_j4p_ysl_zx" |
31 |
| - base="2016/12"/><p>The first step in using a conkeyref is to create a DITA topic |
32 |
| - (domestic_duck_warehouse.dita) that contains a reusable element (including an id |
| 23 | +</ul></pre><p>This conref pulls a <ul> element from a warehouse topic that |
| 24 | + contains reusable elements relevant to domestic ducks. </p><p>If the topic |
| 25 | + containing this conref must be reusable, a hard-coded filename will be a problem. To |
| 26 | + use the reusable topic in a map that discusses wild ducks, the conref needs to point |
| 27 | + to a different warehouse topic file (wild_duck_warehouse.dita). </p><p>Rather than |
| 28 | + hard code the path to a file, you can use the conkeyref attribute to create a |
| 29 | + content reference that uses a key, rather than a filename. </p><image |
| 30 | + keyref="i_conkeyref" id="image_j4p_ysl_zx" base="2016/12"/><p>The first step in |
| 31 | + using a conkeyref is to create a DITA topic (domestic_duck_warehouse.dita) that |
| 32 | + contains a reusable element (including an id |
33 | 33 | attribute):</p><pre><ul id="nesting_materials">
|
34 | 34 | <li>Sawdust</li>
|
35 | 35 | <li>Wood shavings</li>
|
36 | 36 | <li>Sand</li>
|
37 | 37 | ...
|
38 |
| -</ul></pre><p>In |
39 |
| - a map that references the topic that will use the conkeyref, define a key for the |
40 |
| - warehouse file: |
| 38 | +</ul></pre><p>In a map that references the topic that will use the conkeyref, |
| 39 | + define a key for the warehouse file: |
41 | 40 | </p><pre><keydef keys="duck_warehouse" href="domestic_duck_warehouse.dita"/></pre><p>The
|
42 | 41 | example at the beginning of this topic shows a <ul> element with a conref.
|
43 | 42 | Replace the conref attribute with a conkeyref attribute that contains the key, a
|
44 | 43 | slash ('/'), and the id of the element to be pulled:
|
45 | 44 | </p><pre><ul conkeyref="duck_warehouse/nesting_materials">
|
46 | 45 | <li/>
|
47 |
| -</ul></pre><note>When |
48 |
| - using conkeyrefs you do not need to use the id of the topic that contains the |
49 |
| - referenced element. </note><p>When the topic containing the conkeyref is processed, |
50 |
| - the key duck_warehouse is replaced with the current key definition, which is |
51 |
| - domestic_duck_warehouse.dita. </p><p>You can reuse the topic containing the |
52 |
| - conkeyref in another DITA map, but you might need it to pull content from a file |
53 |
| - that is specific to the new map. To do this, add a <keydef> element to the new |
54 |
| - map that defines the key so that it points to a different file. In this example, the |
55 |
| - new map (that addresses wild ducks) defines the duck_warehouse key to point to |
56 |
| - wild_duck_warehouse.dita: |
| 46 | +</ul></pre><note>When using conkeyrefs you do not need to use the id of the topic |
| 47 | + that contains the referenced element. </note><p>When the topic containing the |
| 48 | + conkeyref is processed, the key duck_warehouse is replaced with the current key |
| 49 | + definition, which is domestic_duck_warehouse.dita. </p><p>You can reuse the topic |
| 50 | + containing the conkeyref in another DITA map, but you might need it to pull content |
| 51 | + from a file that is specific to the new map. To do this, add a <keydef> element |
| 52 | + to the new map that defines the key so that it points to a different file. In this |
| 53 | + example, the new map (that addresses wild ducks) defines the duck_warehouse key to |
| 54 | + point to wild_duck_warehouse.dita: |
57 | 55 | </p><pre><keydef keys="duck_warehouse" href="wild_duck_warehouse.dita"/></pre><p>The
|
58 | 56 | file wild_duck_warehouse.dita defines a different <ul> element; however, it must
|
59 |
| - use the same id |
60 |
| - attribute:</p><pre><ul id="nesting_materials"> |
| 57 | + use the same id attribute:</p><pre><ul id="nesting_materials"> |
61 | 58 | <li>Ferns</li>
|
62 | 59 | <li>Twigs</li>
|
63 | 60 | <li>Grass</li>
|
64 | 61 | ...
|
65 |
| -</ul></pre><p>When |
66 |
| - this new key is used in the wile duck map, the unordered list of wild duck nesting |
67 |
| - materials is used.</p><p>Finally, note that all the same rules that apply to conrefs |
68 |
| - also apply to conkeyrefs: </p><ul id="ul_gzh_wmv_qx"> |
| 62 | +</ul></pre><p>When this new key is used in the wild duck map, the unordered list |
| 63 | + of wild duck nesting materials is used.</p><p>Finally, note that all the same rules |
| 64 | + that apply to conrefs also apply to conkeyrefs: </p><ul id="ul_gzh_wmv_qx"> |
69 | 65 | <li>The referencing element must be the same type (element name) as the referenced
|
70 | 66 | element. </li>
|
71 | 67 | <li>The referencing element must be valid (for instance, a <ul> element must
|
|
0 commit comments