Step 2-4. Declare @class
Attributes
@class
attribute value: <!-- ==================================================== XML Construct Domain Module Author: your name here Copyright (c) 2011 copyright holder license to use or not use or whatever ==================================================== --> <!ENTITY % xmlelem "xmlelem" > <!-- LONG NAME: XML Element --> <!ENTITY % xmlelem.content " (#PCDATA)* " > <!ENTITY % xmlelem.attributes ' %univ-atts; keyref CDATA #IMPLIED outputclass CDATA #IMPLIED ' > <!ELEMENT xmlelem %xmlelem.content; > <!ATTLIST xmlelem %xmlelem.attributes; > <!ATTLIST xmlelem %global-atts; class CDATA "+ topic/keyword xml-d/xmlelem " >
(The %global-atts;
parameter entity is defined in one of the base DITA
module files.)
There are several reasons for keeping the @class
attribute declaration separate from the main element and attribute declaration. By
putting all the class attribute declarations together in one place, it makes it easier
to find the declarations and see what the specialization hierarchy is. It also makes
it easier to re-use the element declarations by cut and paste. (This pattern becomes
much more critical in XSD-based specialization, where the re-use of base element type
declarations is by reference rather than via cut and paste.)
<!-- ============================================================= XML construct domain Provides phrase-level elements for identifying mentions of XML constructs: element types, attributes, etc. Copyright (c) 2011 copyright holder license to use or not use or whatever ============================================================= --> <!-- ============================================================= --> <!-- ELEMENT NAME ENTITIES --> <!-- ============================================================= --> <!ENTITY % xmlelem "xmlelem" > <!ENTITY % xmlatt "xmlatt" > <!ENTITY % textent "textent" > <!ENTITY % parment "parment" > <!ENTITY % numcharref "numcharref" > <!-- ============================================================= --> <!-- ELEMENT DECLARATIONS --> <!-- ============================================================= --> <!-- LONG NAME: XML Element --> <!ENTITY % xmlelem.content " (#PCDATA)* " > <!ENTITY % xmlelem.attributes ' %univ-atts; keyref CDATA #IMPLIED outputclass CDATA #IMPLIED ' > <!ELEMENT xmlelem %xmlelem.content; > <!ATTLIST xmlelem %xmlelem.attributes; > <!-- LONG NAME: XML Attribute --> <!ENTITY % xmlatt.content " (#PCDATA)* " > <!ENTITY % xmlatt.attributes ' %univ-atts; keyref CDATA #IMPLIED outputclass CDATA #IMPLIED ' > <!ELEMENT xmlatt %xmlatt.content; > <!ATTLIST xmlatt %xmlatt.attributes; > <!-- LONG NAME: Text entity --> <!ENTITY % textent.content " (#PCDATA)* " > <!ENTITY % textent.attributes ' %univ-atts; keyref CDATA #IMPLIED outputclass CDATA #IMPLIED ' > <!ELEMENT textent %textent.content; > <!ATTLIST textent %textent.attributes; > <!-- LONG NAME: Parameter entity --> <!ENTITY % parment.content " (#PCDATA)* " > <!ENTITY % parment.attributes ' %univ-atts; keyref CDATA #IMPLIED outputclass CDATA #IMPLIED ' > <!ELEMENT parment %parment.content; > <!ATTLIST parment %parment.attributes; > <!-- LONG NAME: Numeric character reference --> <!ENTITY % numcharref.content " (#PCDATA)* " > <!ENTITY % numcharref.attributes ' %univ-atts; keyref CDATA #IMPLIED outputclass CDATA #IMPLIED ' > <!ELEMENT numcharref %numcharref.content; > <!ATTLIST numcharref %numcharref.attributes; > <!-- ============================================================= --> <!-- SPECIALIZATION ATTRIBUTE DECLARATIONS --> <!-- ============================================================= --> <!ATTLIST xmlelem %global-atts; class CDATA "+ topic/keyword xml-d/xmlelem " > <!ATTLIST xmlatt %global-atts; class CDATA "+ topic/keyword xml-d/xmlatt " > <!ATTLIST textent %global-atts; class CDATA "+ topic/keyword xml-d/textent " > <!ATTLIST parment %global-atts; class CDATA "+ topic/keyword xml-d/parment " > <!ATTLIST numcharref %global-atts; class CDATA "+ topic/keyword xml-d/numcharref " > <!-- ================== End XML Domain ==================== -->
You should be seeing that this is a largely mechanical process that is mostly cutting and pasting of repeated declaration patterns. All of the actual thinking goes into the element type design. The declaration activity is purely mechanical.
In particular, having created the first declaration for <xmlelem>
, you copy it, paste it, and simply change "xmlelem" to the new element type name
everywhere it occurs in that element's declarations.