Skip to content

Commit f19e036

Browse files
authored
Merge pull request #938 from robander/conref
Revise conref topics
2 parents 441fc1b + a482745 commit f19e036

22 files changed

+746
-505
lines changed

specification/archSpec/base/conref-attributes-specified-on-elements.dita

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
originating context, even if they are not valid in an intermediate context. </p>
5353
<p otherprops="examples">For example, if topic A and topic C allow highlighting, and topic B does
5454
not, then a content reference chain of topic A-to-topic B-to-topic C should preserve any
55-
highlighting elements in the referenced content. The result, however it is achieved, must be
55+
highlighting elements in the referenced content. The result, however it is achieved, is
5656
equivalent to the result of resolving the conref pairs recursively starting from the original
5757
referencing element in topic A.</p>
5858
</conbody>

specification/archSpec/base/conref-overview.dita

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@
3535
<dt>Pushing content from the referencing element</dt>
3636
<dd>
3737
<p>The <xmlatt>conaction</xmlatt> attribute reverses the direction of reuse from pull to
38-
push. <ph >With a push, the referencing element is rendered before,
39-
after, or in place of the referenced element. The location (before, after, or in place
40-
of) is determined by the value of the <xmlatt>conaction</xmlatt> attribute.</ph>
41-
Because the <xmlatt>conaction</xmlatt> and <xmlatt>conrefend</xmlatt> attributes cannot
42-
both be used within the same referencing element, it is not possible to push a range of
43-
elements.</p>
38+
push. With a push, the referencing element is rendered before, after, or in place of the
39+
referenced element. The location (before, after, or in place of) is determined by the
40+
value of the <xmlatt>conaction</xmlatt> attribute. The <xmlatt>conaction</xmlatt> and
41+
<xmlatt>conrefend</xmlatt> attributes cannot both be used within the same referencing
42+
element, so it is not possible to push a range of elements.</p>
4443
</dd>
4544
</dlentry>
4645
</dl>
4746
<p>A fragment of DITA content, such as an XML document that contains only a single paragraph
48-
without a topic ancestor, does not contain enough information for the conref processor to be
49-
able to determine the validity of a reference to it. Consequently, the value of a conref must
50-
specify one of the following items:</p>
47+
without a topic ancestor, does not contain enough information for a conref processor to be
48+
able to determine the validity of a reference to it. Consequently, the value of a
49+
<xmlatt>conref</xmlatt> attribute must be one of the following items:</p>
5150
<ul>
5251
<li>A referenced element within a DITA map</li>
5352
<li>A referenced element within a DITA topic</li>

specification/archSpec/base/conref-processing.dita

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
</prolog>
2020
<conbody>
2121
<note>The DITA <xmlatt>conref</xmlatt> attribute is a transclusion mechanism similar to XInclude
22-
and to HyTime value references. DITA differs from these mechanisms, however, in that conref
23-
validity does not apply simply to the current content at the time of replacement, but to the
24-
possible content given the restrictions of both the referencing document type and the referenced
25-
document type.</note>
22+
and to HyTime value references. DITA differs from these mechanisms, however, in that conref
23+
validity does not apply simply to the current content at the time of replacement, but to the
24+
possible resolved content given the restrictions of both the referencing document type and the
25+
referenced document type.</note>
2626
<p>When content is reused between two documents with different domains or constraints, it is
2727
possible for the reused content to include domain extensions that are not defined for the new
2828
context, or to include elements that would be constrained out of the new context. When pulling
@@ -33,5 +33,59 @@
3333
<p>A conref processor <term outputclass="RFC-2119">SHOULD NOT</term> permit resolution of a reuse
3434
relationship that could be rendered invalid under the rules of either the reused or reusing
3535
content.</p>
36+
<p>When resolving <xmlatt>conkeyref</xmlatt> attributes, processors <term outputclass="RFC-2119"
37+
>SHOULD</term> issue a warning when a <xmlatt>conkeyref</xmlatt> reference cannot be
38+
resolved and there is no <xmlatt>conref</xmlatt> attribute to use as a fallback. Processors
39+
<term outputclass="RFC-2119">MAY</term> issue a warning when a <xmlatt>conkeyref</xmlatt>
40+
cannot be resolved to an element and a specified <xmlatt>conref</xmlatt> is used as a
41+
fallback.</p>
42+
<section id="error-conditions" outputclass="errorcondition">
43+
<title>Common error conditions related to conref ranges</title>
44+
<p>When encountering the following error conditions, an implementation can optionally issue an
45+
error message.</p>
46+
<table id="table_pbn_czf_scc">
47+
<tgroup cols="2">
48+
<colspec colname="col1" colnum="1" colwidth="1*"/>
49+
<colspec colname="col2" colnum="2" colwidth="1*"/>
50+
<thead>
51+
<row>
52+
<entry colname="col1">Condition or Issue</entry>
53+
<entry colname="col2">Result</entry>
54+
</row>
55+
</thead>
56+
<tbody>
57+
<row>
58+
<entry colname="col1">The <xmlatt>conref</xmlatt> attribute cannot be resolved in the
59+
target document (the target element might have been removed or its id has changed). </entry>
60+
<entry colname="col2">The <xmlatt>conref</xmlatt> is ignored.</entry>
61+
</row>
62+
<row>
63+
<entry colname="col1">The <xmlatt>conrefend</xmlatt> attribute cannot be resolved in
64+
the target document (the target element might have been removed or its id has
65+
changed).</entry>
66+
<entry colname="col2">Range cannot be resolved, optional recovery processes the result
67+
as a simple conref.</entry>
68+
</row>
69+
<row>
70+
<entry colname="col1">Start and end elements are not siblings in the target
71+
document.</entry>
72+
<entry colname="col2">If the start element exists, optional recovery processes the
73+
result as a simple conref. </entry>
74+
</row>
75+
<row>
76+
<entry colname="col1">End element occurs before the start element in the target
77+
document.</entry>
78+
<entry colname="col2">If the start element exists, optional recovery processes the
79+
result as a simple conref.</entry>
80+
</row>
81+
<row>
82+
<entry colname="col1">An element has a <xmlatt>conrefend</xmlatt> attribute but is
83+
missing the <xmlatt>conref</xmlatt> attribute.</entry>
84+
<entry colname="col2">No result.</entry>
85+
</row>
86+
</tbody>
87+
</tgroup>
88+
</table>
89+
</section>
3690
</conbody>
3791
</concept>

specification/archSpec/base/conref.dita

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
33
<concept id="conref" xml:lang="en-us">
44
<title>Content <ph >reference</ph> (conref)</title>
5-
<shortdesc >The DITA conref attributes provide mechanisms for reusing content.
6-
DITA content references support reuse scenarios that are difficult or impossible to implement
7-
using other XML-based inclusion mechanisms like XInclude and entities. Additionally, DITA content
8-
references have rules that help ensure that the results of content inclusion remain valid after
5+
<shortdesc>The DITA conref attributes provide mechanisms for reusing content. DITA content
6+
references support reuse scenarios that are difficult or impossible to implement using many
7+
XML-based inclusion mechanisms like XInclude and entities. Additionally, DITA content references
8+
have rules that help ensure that the results of content inclusion remain valid after
99
resolution</shortdesc>
1010
<prolog>
1111
<metadata>

specification/archSpec/base/conref.ditamap

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@
44
<title>Content reference (conref)</title>
55
<topicref href="conref.dita" keys="conref">
66
<topicref href="conref-overview.dita"/>
7+
<topicref keyref="attributes-conref"/>
8+
<topicref keyref="attributes-conkeyref"/>
9+
<topicref keyref="attributes-conrefend"/>
710
<topicref keyref="attributes-conaction"/>
8-
<topicref keyref="attributes-conrefend"/>
9-
<topicref keyref="attributes-conkeyref"/>
10-
<topicref keyref="attributes-conref"/>
1111
<topicref keyref="attributes-useconreftarget"/>
1212
<topicref href="conref-processing.dita"/>
1313
<topicref href="conref-attributes-specified-on-elements.dita"/>
1414
<topicref href="handling-xref-and-conref-within-topics.dita"/>
15+
<topicref href="examples-conref.dita">
16+
<topicref href="example-conref-simple.dita"/>
17+
<topicref href="example-conref-conkeyref.dita"/>
18+
<topicref href="example-conref-range-list.dita"/>
19+
<topicref href="example-conref-range-blocks.dita"/>
20+
<topicref href="example-conref-range-conkeyref.dita"/>
21+
<topicref href="example-conref-conaction-replace.dita"/>
22+
<topicref href="example-conref-conaction-pushbefore.dita"/>
23+
<topicref href="example-conref-conaction-pushafter.dita"/>
24+
<topicref href="example-conref-includes-xref.dita"/>
25+
<topicref href="example-conref-includes-xref-and-keyscope.dita"/>
26+
</topicref>
1527
</topicref>
1628
<reltable title="Source&lt;-->Target">
1729
<relheader>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
3+
<concept id="example_conaction_pushafter">
4+
<title>Example: Using <xmlatt>conaction</xmlatt> to push content after another element</title>
5+
<shortdesc>In this scenario, a <xmlatt>conref</xmlatt> and <xmlatt>conaction</xmlatt> are used to
6+
push content after an element in another topic.</shortdesc>
7+
<conbody>
8+
<p>Consider the following topic, which is set up to push a step after a step in another topic.
9+
It needs to use two step elements to set up the reuse. The referencing element itself uses
10+
<codeph>conaction="mark"</codeph> to mark the referenced element. The element to be pushed
11+
immediately follows the marking element and uses <codeph>conaction="pushafter"</codeph>:
12+
<codeblock>&lt;steps>
13+
&lt;step conaction="mark" conref="example.dita#example/b">
14+
&lt;cmd/>
15+
&lt;/step>
16+
&lt;step conaction="pushafter">
17+
&lt;cmd>Do this after B&lt;/cmd>
18+
&lt;/step>
19+
&lt;/steps></codeblock></p>
20+
<p>The referenced element is in the file <filepath>example.dita</filepath>, which looks like
21+
this before a processor resolves the
22+
reference:<codeblock>&lt;task id="example" xml:lang="en">
23+
&lt;title>Example topic&lt;/title>
24+
&lt;taskbody>
25+
&lt;steps>
26+
&lt;step id="a">&lt;cmd>A&lt;/cmd>&lt;/step>
27+
&lt;step id="b">&lt;cmd>B&lt;/cmd>&lt;/step>
28+
&lt;step id="c">&lt;cmd>C&lt;/cmd>&lt;/step>
29+
&lt;/steps>
30+
&lt;/taskbody>
31+
&lt;/task></codeblock></p>
32+
<p>After the content reference is resolved, the document <filepath>example.dita</filepath>
33+
includes the pushed <xmlelement>step</xmlelement> element after the step with
34+
<xmlatt>id</xmlatt> set to
35+
<keyword>b</keyword>:<codeblock>&lt;task id="example" xml:lang="en">
36+
&lt;title>Example topic&lt;/title>
37+
&lt;taskbody>
38+
&lt;steps>
39+
&lt;step id="a">&lt;cmd>A&lt;/cmd>&lt;/step>
40+
&lt;step id="b">&lt;cmd>B&lt;/cmd>&lt;/step>
41+
&lt;step>&lt;cmd>Do this after B&lt;/cmd>&lt;/step>
42+
&lt;step id="c">&lt;cmd>C&lt;/cmd>&lt;/step>
43+
&lt;/steps>
44+
&lt;/taskbody>
45+
&lt;/task></codeblock></p>
46+
</conbody>
47+
</concept>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
3+
<concept id="example_conaction_pushbefore">
4+
<title>Example: Using <xmlatt>conaction</xmlatt> to push content before another element</title>
5+
<shortdesc>In this scenario, a <xmlatt>conref</xmlatt> and <xmlatt>conaction</xmlatt> are used to
6+
push content before an element in another topic.</shortdesc>
7+
<conbody>
8+
<p>Consider the following topic, which is set up to push a step before a step in another topic.
9+
It needs to use two step elements to set up the reuse. The referencing element itself uses
10+
<codeph>conaction="mark"</codeph> to mark the referenced element. The element to be pushed
11+
immediately preceeds the marking element and uses <codeph>conaction="pushbefore"</codeph>:
12+
<codeblock>&lt;steps>
13+
&lt;step conaction="pushbefore">
14+
&lt;cmd>Do this before B&lt;/cmd>
15+
&lt;/step>
16+
&lt;step conaction="mark" conref="example.dita#example/b">
17+
&lt;cmd/>
18+
&lt;/step>
19+
&lt;/steps></codeblock></p>
20+
<p>The referenced element is in the file <filepath>example.dita</filepath>, which looks like
21+
this before a processor resolves the
22+
reference:<codeblock>&lt;task id="example" xml:lang="en">
23+
&lt;title>Example topic&lt;/title>
24+
&lt;taskbody>
25+
&lt;steps>
26+
&lt;step id="a">&lt;cmd>A&lt;/cmd>&lt;/step>
27+
&lt;step id="b">&lt;cmd>B&lt;/cmd>&lt;/step>
28+
&lt;step id="c">&lt;cmd>C&lt;/cmd>&lt;/step>
29+
&lt;/steps>
30+
&lt;/taskbody>
31+
&lt;/task></codeblock></p>
32+
<p>After the content reference is resolved, the document <filepath>example.dita</filepath>
33+
includes the pushed <xmlelement>step</xmlelement> element before the step with
34+
<xmlatt>id</xmlatt> set to
35+
<keyword>b</keyword>:<codeblock>&lt;task id="example" xml:lang="en">
36+
&lt;title>Example topic&lt;/title>
37+
&lt;taskbody>
38+
&lt;steps>
39+
&lt;step id="a">&lt;cmd>A&lt;/cmd>&lt;/step>
40+
&lt;step>&lt;cmd>Do this before B&lt;/cmd>&lt;/step>
41+
&lt;step id="b">&lt;cmd>B&lt;/cmd>&lt;/step>
42+
&lt;step id="c">&lt;cmd>C&lt;/cmd>&lt;/step>
43+
&lt;/steps>
44+
&lt;/taskbody>
45+
&lt;/task></codeblock></p>
46+
</conbody>
47+
</concept>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
3+
<concept id="example_conaction_pushreplace">
4+
<title>Example: Using <xmlatt>conaction</xmlatt> to replace content</title>
5+
<shortdesc>In this scenario, a <xmlatt>conref</xmlatt> and <xmlatt>conaction</xmlatt> are used to
6+
replace content in another topic.</shortdesc>
7+
<conbody>
8+
<p>Consider the following task in <filepath>example.dita</filepath> that has the
9+
<xmlatt>id</xmlatt> attribute set to <keyword>example</keyword>. The task contains a
10+
<xmlelement>step</xmlelement> element with the <xmlatt>id</xmlatt> set to
11+
<keyword>b</keyword>:</p>
12+
<codeblock id="codeblock_scr_wqh_psb">&lt;task id="example" xml:lang="en">
13+
&lt;title>Example topic&lt;/title>
14+
&lt;taskbody>
15+
&lt;steps>
16+
&lt;step id="a">&lt;cmd>A&lt;/cmd>&lt;/step>
17+
&lt;step id="b">&lt;cmd>B&lt;/cmd>&lt;/step>
18+
&lt;step id="c">&lt;cmd>C&lt;/cmd>&lt;/step>
19+
&lt;/steps>
20+
&lt;/taskbody>
21+
&lt;/task></codeblock>
22+
<p>In order to replace the step with <codeph>id="b"</codeph>, another topic must combine a
23+
<xmlatt>conaction</xmlatt> value of <keyword>pushreplace</keyword> with a
24+
<xmlatt>conref</xmlatt> attribute that references this
25+
<xmlelement>step</xmlelement>:<codeblock>&lt;!-- Steps element within another task -->
26+
&lt;steps>
27+
&lt;step conaction="pushreplace"
28+
conref="example.dita#example/b">
29+
&lt;cmd>Updated B&lt;/cmd>
30+
&lt;/step>
31+
&lt;/steps>
32+
&lt;/task></codeblock></p>
33+
<p>The result will be an updated version of <filepath>example.dita</filepath> which contains the
34+
pushed <xmlelement>step</xmlelement>:<codeblock>&lt;task id="example" xml:lang="en">
35+
&lt;title>Example topic&lt;/title>
36+
&lt;taskbody>
37+
&lt;steps>
38+
&lt;step id="a">&lt;cmd>A&lt;/cmd>&lt;/step>
39+
&lt;step id="b">&lt;cmd>Updated B&lt;/cmd>&lt;/step>
40+
&lt;step id="c">&lt;cmd>C&lt;/cmd>&lt;/step>
41+
&lt;/steps>
42+
&lt;/taskbody>
43+
&lt;/task></codeblock></p>
44+
</conbody>
45+
</concept>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
3+
<concept id="example_simple_conkeyref">
4+
<title>Example: Simple <xmlatt>conkeyref</xmlatt> usage</title>
5+
<shortdesc>In this scenario, a <xmlatt>conkeyref</xmlatt> attribute is used as an indirect
6+
reference to pull content from the referenced element in another topic.</shortdesc>
7+
<conbody>
8+
<p>Consider the following topic:</p>
9+
<codeblock>&lt;task id="setup-widget" xml:lang="en">
10+
&lt;title>Setting up the widget&lt;/title>
11+
&lt;taskbody>
12+
&lt;steps>
13+
&lt;step>&lt;cmd>Turn the widget on for the first time.&lt;/cmd>&lt;/step>
14+
&lt;step>&lt;cmd>Follow the prompts to select your language and region.&lt;/cmd>&lt;/step>
15+
<b>&lt;step conkeyref="reuselibrary/setup-profile">&lt;cmd>&lt;/cmd>&lt;/step></b>
16+
&lt;step>&lt;cmd>Step outside and activate the widget.&lt;/cmd>&lt;/step>
17+
&lt;/steps>
18+
&lt;/taskbody>
19+
&lt;/task></codeblock>
20+
<p>The key is defined as a reference to a resue library:</p>
21+
<codeblock>&lt;map>
22+
&lt;title>Key definitions&lt;/title>
23+
&lt;keydef keys="reuselibrary" href="reuse-library.dita"/>
24+
&lt;!-- ... -->
25+
&lt;/map></codeblock>
26+
<p>The library topic <filepath>reuse-library.dita</filepath> is set up as follows:</p>
27+
<codeblock>&lt;task id="reuse-library" xml:lang="en">
28+
&lt;title>Reuse library topic&lt;/title>
29+
&lt;taskbody>
30+
&lt;steps>
31+
&lt;!-- ... other steps used across tasks ... -->
32+
&lt;step id="setup-profile">
33+
&lt;cmd>Follow the prompts to set up your name and contact information.&lt;/cmd>
34+
&lt;info>Contact information is optional, but recommended.&lt;/info>
35+
&lt;/step>
36+
&lt;/steps>
37+
&lt;/taskbody>
38+
&lt;/task></codeblock>
39+
<p>When the <xmlatt>conkeyref</xmlatt> attribute is resolved, the key resolves to the topic
40+
that contains the referenced ID <codeph>setup-profile</codeph>. The result is the same as if
41+
the original topic contained
42+
<codeph>conref="reuse-library.dita#reuse-library/setup-profile"</codeph> instead of
43+
<codeph>conkeyref="reuselibrary/setup-profile"</codeph>. However, the indirection created by
44+
using a key allows this reference to resolve differently in other contexts.</p>
45+
<p>The processed version of the original topic will include content from the referenced
46+
element:</p>
47+
<codeblock>&lt;task id="setup-widget" xml:lang="en">
48+
&lt;title>Setting up the widget&lt;/title>
49+
&lt;taskbody>
50+
&lt;steps>
51+
&lt;step>&lt;cmd>Turn the widget on for the first time.&lt;/cmd>&lt;/step>
52+
&lt;step>&lt;cmd>Follow the prompts to select your language and region.&lt;/cmd>&lt;/step>
53+
<b>&lt;step>
54+
&lt;cmd>Follow the prompts to set up your name and contact information.&lt;/cmd>
55+
&lt;info>Contact information is optional, but recommended.&lt;/info>
56+
&lt;/step></b>
57+
&lt;step>&lt;cmd>Step outside and activate the widget.&lt;/cmd>&lt;/step>
58+
&lt;/steps>
59+
&lt;/taskbody>
60+
&lt;/task></codeblock>
61+
</conbody>
62+
</concept>

0 commit comments

Comments
 (0)