Map Specialization Step 3: Create faq-map Map Type Module
Find the file map.mod in the standard DITA DTD distribution. You will be cutting and pasting from map.mod into the new module file for the faq-map map type.
- Create the file faq-map/dtd/faq-map.mod and give it this content:
<?xml version="1.0" encoding="UTF-8"?> <!--======================================= FAQ Map map type module. Represents a single FAQ publication Copyright (c) 2011 Your Name Here ======================================= --> <!-- ======== End of FAQ Map Module ====== -->
- In map.mod find the declaration for
%map.content;
, copy that declaration and the next three declarations (%map.attributes;
and the ENTITY and ATTLIST declarations for<map>
), and paste them into the faq-map.mod file after the header comment:<?xml version="1.0" encoding="UTF-8"?> <!--======================================= FAQ Map map type module. Represents a single FAQ publication Copyright (c) 2011 Your Name Here ======================================= --> <!ENTITY % map.content "((%title;)?, (%topicmeta;)?, (%anchor; | %data.elements.incl; | %navref; | %reltable; | %topicref;)* )" > <!ENTITY % map.attributes "title CDATA #IMPLIED id ID #IMPLIED %conref-atts; anchorref CDATA #IMPLIED outputclass CDATA #IMPLIED %localization-atts; %topicref-atts; %select-atts;" > <!ELEMENT map %map.content;> <!ATTLIST map %map.attributes; %arch-atts; domains CDATA "&included-domains;" > <!-- ======== End of FAQ Map Module ====== -->
- Modify these declarations by changing "map" to "faq-map" everywhere,
e.g.:
<!ENTITY % faq-map.content "((%title;)?, (%topicmeta;)?, (%anchor; | %data.elements.incl; | %navref; | %reltable; | %topicref;)* )" > <!ENTITY % faq-map.attributes ... <!ELEMENT faq-map %faq-map.content;> <!ATTLIST faq-map %faq-map.attributes; ... >
- Change the definition of the
%faq-map.content;
parameter entity to:<!ENTITY % faq-map.content "((%title;)?, (%topicmeta;)?, (%keydef)*, (%faq-question-group;), (%reltable;)*)" >
- Change the value of the
@domains
attribute declaration in the pub-map ATTLIST declaration to reflect the module hierarchy and the required map domains:<!ATTLIST faq-map %faq-map.attributes; %arch-atts; domains CDATA "(map faq-map mapGroup faq-mapDomain) &included-domains;" >
- Validate the test document. You should get messages to the effect that the parameter
entities
%keydef;
and%faq-question-group;
were referenced but not declared.Because this map type module depends on specific domains, we have to locally declare the parameter entities for the element types we use from those domains because the domain-provided parameter entities are not included by the shell DTD until after the map type module is included.
- Immediately after the header comment, add these parameter entity declarations:
<!ENTITY % keydef "keydef" > <!ENTITY % faq-question-set "faq-question-set" >
Validate the test document again. It should now give a message that the document is missing required content.
- Edit the test document to add the minimum allowed content, resulting in this document:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE faq-map PUBLIC "faq-map" "dtd/faq-map.dtd"> <faq-map> <title>FAQ Map Test 01</title> <topicmeta></topicmeta> <keydef keys="foo"/> <faq-question-set> </faq-question-set> </faq-map>
Validate the test document again. It should now complain that the element type
<faq-question-set>
is not declared, which of course it is not. - Immediately before the ending comment, add the
@class
attribute declaration for the<faq-map>
element:c<!ATTLIST faq-map %global-atts; class CDATA "- map/map faq-map/faq-map " >
At this point the faq-map map type should be ready to use as soon as the faq-mapDomain module is defined.