Example: Adding an existing domain attribute to certain elements using DTDs
This section is non-normative.
In this scenario, a company wants to use the
@otherprops
attribute specialization. However, they
want to make the attribute available only on certain elements:
<p>
, <div>
, and
<section>
.
The DITA architect will need to create an extension module and integrate it into the appropriate document-type shells.
-
The DITA architect creates an expansion module that adds the
@otherprops
attribute to the selected elements: acme-otherpropsAttExpansion.mod. The expansion module contains the following code:<?xml version="1.0" encoding="UTF-8"?> <!-- Add the otherprops attribute to certain elements --> <!ATTLIST p %otherpropsAtt-d-attribute;> <!ATTLIST div %otherpropsAtt-d-attribute;> <!ATTLIST section %otherpropsAtt-d-attribute;>
Note that the
%otherpropsAtt-d-attribute;
is defined in the separate attribute-specialization module that defines the@otherprops
attribute. - They then update the catalog.xml file to include the expansion module.
- They integrate the extension module into the applicable
document-type shell, after the declaration for the
@otherprops
attribute-specialization module:<!-- ============================================================= --> <!-- DOMAIN ATTRIBUTES DECLARATIONS --> <!-- ============================================================= --> ... <!ENTITY % otherpropsAtt-d-dec PUBLIC "-//OASIS//ENTITIES DITA 2.0 Otherprops Attribute Domain//EN" "otherpropsAttDomain.ent" >%otherpropsAtt-d-dec; <!ENTITY % otherprops-expansion-e-def PUBLIC "-//ACME//DITA 2.0 Otherprops Expansion//EN" "acme-otherpropsAttExpansion.mod" >%otherprops-expansion-e-def; ...
-
They remove the reference to the
@otherprops
attribute from theprops-attribute-extension
entity:<!-- ============================================================= --> <!-- DOMAIN ATTRIBUTE EXTENSIONS --> <!-- ============================================================= --> <!ENTITY % base-attribute-extensions "" > <!ENTITY % props-attribute-extensions "%audienceAtt-d-attribute; %deliveryTargetAtt-d-attribute; %otherpropsAtt-d-attribute; %platformAtt-d-attribute; %productAtt-d-attribute;" >
- They ensure that the
included-domains
entity contains the@otherprops
contribution to the@specializations
attribute:<!-- ============================================================= --> <!-- SPECIALIZATIONS ATTRIBUTE OVERRIDE --> <!-- ============================================================= --> <!ENTITY included-domains "&audienceAtt-d-att; &deliveryTargetAtt-d-att; &otherpropsAtt-d-att; &platformAtt-d-att; &productAtt-d-att;" >
- After checking the test topic to ensure that the attribute lists are modified as expected, the work is done.