[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Preview of 13121 - reuse of elements from structural specializations - with discussion of changed syntax
Sharing elements across specializationsThe process of specialization allows for easy reuse of elements from ancestor specializations; however, it is also possible to reuse elements from other unrelated specializations, as long as the dependency is properly declared to prevent invalid generalization or conref processing. A structural specialization can incorporate elements from unrelated domains or other structural specializations by referencing them in the content model of a specialized element. For example, a specialized reference topic could declare a specialized list <apilist> in which each <apilistitem> contains an <apiname> element, which is borrowed from the programming domain. Or a specialized concept topic could declare a specialized <process> section that contains the <steps> elements borrowed from task. The elements included in this manner must be specialized from ancestor content that is valid in the new context. For example, a specialized element can include the <steps> elements in its content model if it could validly include <ol>, because <steps> is specialized from <ol>. If the reusing and reused specializations share common ancestry, the reused elements must be valid in the reusing context at every level they share in common. For example, suppose there are two specializations of <task>: <mytask> and <yourtask>. The specializer of <mytask> wants to borrow <yoursteps> from <yourtask> instead of creating their own equivalent specialization. The <yoursteps> element is specialized from <steps> in <task>. The specializer of <mytask> can only include <yoursteps> where <steps> would be allowed; they cannot incorporate it anywhere <ol> is allowed, even though <ol> is in its ancestry, because the two specializations share <task> in their ancestry as well, and we need to maintain the validity of <task> as a generalization target. If we allowed <mytask> to transplant specializations of <steps> anywhere they wanted in the <mytask> model, then <mytask> would cease to be a valid specialization of <task>. Although a well-designed structural specialization hierarchy with controlled use of domains is still the primary means of sharing and reusing elements in DITA, the ability to also share elements declared elsewhere in the hierarchy allows for situations where relevant markup comes from multiple sources and would otherwise be developed redundantly. Domain attribute syntax for cross-specialization dependenciesWhen a structural specialization reuses elements from another structural or domain specialization, it has a dependency on the source specialization module that must be declared in the domains attribute in order for conref and generalization processing to function correctly. The domains attribute must include a parenthetical _expression_ that lists the ancestry for the current specialization. The final value, for the current specialization, must include the modules it depends on, separated by either a "+" for a dependency on a domain specialization or a "++" for a dependency on another structural specialization. In addition, it must include a separate parenthetical _expression_ for each reused domain or structural specialization that lists the ancestry of the reused specialization. Dependency on a domain specializationFor example, a codeConcept specialization could specialize from a concept and include elements from the programming domain. Its ancestry, and the ancestry of the domain it uses, would be declared as: domains="...(topic concept codeConcept+pr-d) (topic pr-d)" Dependency on a structural specializationFor example, a checklist specialization could specialize from reference and include elements from task. Its ancestry, and the ancestry of the domain it uses, would be declared as: domains="...(topic reference checklist++task) (topic task) Generalization with cross-specialization dependenciesDependencies across specializations limit generalization targets to those that either preserve the dependency or eliminate them. Some generalization targets will not be valid and should be detected before generalization occurs. When a structural specialization has a dependency on a domain specialization, then the domain cannot be generalized without also generalizing the reusing structural specialization. For example, if programming domain elements in codeConcept were generalized to their topic equivalents without also generalizing codeConcept elements, then the places where the content model of a codeConcept element includes programming domain elements would become invalid. However, codeConcept could be generalized to concept or topic, without generalizing programming domain elements, as long as the target document type includes the programming domain. When a structural specialization has a dependency on another structural specialization, then both must be generalized together to a common ancestor. For example, if the task elements in checklist were generalized without also generalizing checklist elements, then the checklist content models that referenced task elements would be broken. And if the checklist elements were generalized to topic without also generalizing the task elements, then the task elements would be out of place, since they cannot be validly present in topic. However, checklist and task can be generalized together to any ancestor they have in common: in this case topic. Generalizing processes should detect invalid generalization target combinations and report them as errors. |
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]