Content Reference End (conrefend)

The content reference end mechansim specifies an element, that is the last element of a content reference range. It is used together with a content reference or content key reference, that specifies the first element.

Sample project: conrefend.zip

conrefend.ditamap

The <keydef> element in the conrefend.ditamap defines the key source using the @keys attribute for the source.dita topic. The source.dita topic is a database topic and not rendered in the output. Further on, it references the target.dita topic.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title>conrefend</title>
    <!--
        The source.dita file is not rendered in the output,
        because the <keydef> element implicitly sets processing-role="resource-only"
    -->
    <keydef keys="source" href="source.dita"/>
    <topicref href="target.dita"/>
</map>

source.dita

The source.dita topic contains an unordered list (<ul>) with 10 list items (<li>).

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="source">
  <title>source</title>
  <body>
    <ul>
      <li id="li01">list item 01</li>
      <li id="li02">list item 02</li>
      <li id="li03">list item 03</li>
      <li id="li04">list item 04</li>
      <li id="li05">list item 05</li>
      <li id="li06">list item 06</li>
      <li id="li07">list item 07</li>
      <li id="li08">list item 08</li>
      <li id="li09">list item 09</li>
      <li id="li10">list item 10</li>
    </ul>
  </body>
</topic>

target.dita

The target.dita topic pulls a range of <li> elements. The range starts with the <li> element li03 and ends with the <li> element li07.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="target">
    <title>target</title>
    <body>
        <ul>
            <!-- All <li> elements from li03 to li07 are pulled into the <ul> -->
            <li conkeyref="source/li03" conrefend=".#/li07"/>
        </ul>
    </body>
</topic>

The rendered output is:

  • list item 03
  • list item 04
  • list item 05
  • list item 06
  • list item 07