DITA Proposed Feature #12013 Referencing a range of elements

Allow users to select a range of content referenced elements

Longer description

This feature would allow a user to conref more than one element at a time. For example, this feature would allow a user to conref steps 2 to 5 in a task. Currently, a user wishing to reuse a series of adjacent elements must create a conref to each referenced node. This feature would enable a short-hand allowing a user to denote a range of content references by marking the start and end elements. This proposal has a minor design changes from the original IssueNumber17c.html proposal http://www.oasis-open.org/committees/download.php/15118/IssueNumber17c.html (simplified attribute name and value names ).

Statement of Requirement


Use Cases

Reusing a series of elements
An user needs to reuse a series of adjacent elements such as list items.

The reusable content exists in a target DITA topic or map. The elements which will be conref'd to as the start and end of the ranges must have id attributes.

The user will create a range by adding a pair of elements in the source topic. The first element in the source must be the same type as the start element of the target range. The user will add a conref attribute that points to the start target and set the value of the conreftype attribute to "start." The second element in the pair must be the same as the end target element with a conref pointing to the end of the targeted range and should have conref attribute value of "end." The user should only create ranges on target elements that share the same parent element.

Processors will resolve the range by pulling in the start target and following sibling elements across to and including the end target.

Assumptions, Error Conditions and Error Handling

Assumptions for the target instance are:


Assumptions for the source instance are:


Error conditions may occur if


These types of error conditions may occur when the author and reuser are different actors. If the author has created a topic which is being reused through the conref range feature, and the author goes and reorders the elements in the target instance, an error condition can be created.

Processors should fail on first error. It is not expected that processors will be able to pull in the referenced range if any of these error conditions are met. Standard XML validation will not be able to catch these error conditions. Tools will need to add additional business rules checking if they need to enforce valid conref ranges. These error conditions will most likely be caught when a processor attempts to resolving a conref range.

Scope

This proposal introduces a new universal attribute that acts as a type modifier on the existing "conref" attribute. The attribute is called "conreftype" and would modify the default action for processing content references.

Technical Requirements

Add a new attribute in the DTD and XML Schema.

The change in DTD syntax in the id-atts entity within commonElements.mod


<!ENTITY % id-atts  
            'id         NMTOKEN                            #IMPLIED
             conref     CDATA                              #IMPLIED
             conreftype    (start | end )           #IMPLIED'>


Note: Additional enumerated values may be added to the structure as a result of the conref push proposal (http://www.oasis-open.org/committees/download.php/15120/IssueNumber17e.html).

The change in XML Schema syntax:


<xs:attributeGroup name="id-atts">
        <xs:annotation>
            <xs:documentation>ID attributes (%id-atts;) is a parameter entity declaration in the
                topic DTD that includes attributes that enable the naming and referencing
                of elements in a DITA topic: <keyword>id</keyword> and <keyword>conref</keyword>.
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="id" type="xs:NMTOKEN"/>
        <xs:attribute name="conref" type="xs:string"/>
        <xs:attribute name="conreftype" type="conreftype-atts.class"/>
    </xs:attributeGroup>
    
    <xs:simpleType name="conreftype-att.class">
            <xs:restriction base="xs:string">
                <xs:enumeration value="start"/>
                <xs:enumeration value="end"/>
                
             </xs:restriction>
    </xs:simpleType>


Note: Additional enumerated values may be added to the structure as a result of the conref push proposal (http://www.oasis-open.org/committees/download.php/15120/IssueNumber17e.html).

Base processing would change to pull in the start and end content references as well as all intermediate contiguous nodes. Base processing should operate on the assumption that the reuser will place the start and end pointers adjacent to each other. In the sourced document, the start and end elements must appear in the correct order (start before end), must have ids set and should share the same parent element. Although ids are not necessary on the intermediate ids for processing purposes, authors should be encouraged to set ids on all items intended for reuse to make the system more flexible.

Figure 1. Source topic with ids
<topic id="x">
 	...
 	<body>
 		<of>
 			<li id="apple">A</li>
 			<li id="bear">B</li>
 			<li id="cat">C</li>
 			<li id="dog">D</li>
 			<li id="eel">E</li>
 		</of>
 	</body>
 </topic>
 
Figure 2. Reusing topic with conrefs

 <topic id="y">
 	...
 	<body>
 		<of>
 			<li>My own first step</li>
 			<li conref="target.dita#x/bear" conreftype="start"/>
 			<li conref="target.dita#x/dog" conreftype="end"/>
 			<li>And a different final step</li>
 		</of>
 	</body>
 </topic>
 
Figure 3. Processed result of reusing topic
 <topic id="y">
 	...
 	<body>
 		<of>
 			<li>My own first step</li>
 			<li>B</li>
 			<li>C</li>
 			<li>D</li>
 			<li>And a different final step</li>
 		</ol>
 	</body>
</topic>

New or Changed Specification Language


Costs

Time to design 2 meetings; cost to implement is higher.

Benefits

If a reuser wants to grab a range, then marking the range by start and end values is much easier and much less risky than grabbing the range by pointing to each element individually. When a new element is added within the scope of the range, it is automatically picked up by default.