DITA Specialization by Example Design Examples
Design examples
Design examples can define specialize elements, defined sets, restrict attributes on specialized elements, and define attributes.
Definition of specialized elements
Design examples use global attributes to define specialized elements and their content. An example element can specify a specialized element (using the dbexName attribute) and a position within a specialized container element (using the dbexOccurs attribute).
dbexName | The name of the specialized element.
You can define an element only once. Use $name to specify a position within a specialized container element that refers to an element defined elsewhere within the current module or that refers to a set defined in any module. |
none |
dbexContent | The policy for preserving base content in the specialized element. |
|
dbexOccurs | The number of occurrences of an element or set in the content model
for a specialized element.
Example elements may have an occurrence only within a specialized container element. |
|
To indicate textual content within a specialized container element, include text at the start of the content.
Note: In the future, the textual content may allow identifiers from an extensible hierarchical enumeration of data types for textual content or may allow example patterns that indicate the data type (such as dates).Definition of sets
Design examples can define sets of elements, primarily to provide a choice within the content of a specialized element.
dbexSet | Specifies the name of the set on the first member of the set defined
with a list or on the container element for a set defined within a container.
Also specifies the last member of a set defined as a list and the members of a set defined within a container. |
|
dbexOccurs | On the last member of a set defined as a list, specifies the number of occurrences of the position within the specialized container element. The members of the set provide a choice at the position. |
|
Restriction of base attributes
Design examples use can restrict attributes within specialized elements.
dbexAttributes | Declares the policy for preserving base attributes in the specialized
element.
Alternatively, specifies an attribute restriction. The restriction applies to the attributes of the example element that have values. If the dbexAttributes attribute specifies a restriction, no other attribute of the example element can specify a restriction. To apply the restriction to a single attribute, the dbexAttributes attribute must start with a name subfield that identifies the restricted attribute. The attribute restriction applies to the specialized element defined or referenced with the dbexName attribute or to the members of the set containing the attribute restriction or referenced with the dbexName. The element or set must be defined within the same module that specifies the restriction. |
|
dbexOccurs | Specifies that the example element restricts attributes instead of contributing to the content model of a specialized container element. If the example element appears within a set definition, the attribute restriction applies to every member element for the set. Otherwise, the dbexName attribute must define or refer to a specialized element. |
|
A specialized example element can restrict a base attribute by setting the value of the attribute as follows:
- value
- -
- base-occurs
- ?
- optional
- .
- required
- When dbexAttributes is set to min-base,
any value that is not a reserved word preserves the attribute with unchanged
occurrence in exactly the same way as the base-occurs value.
Attributes without values are dropped implicitly. The standard occurrence
values may be used to make the intent explicit.
The required value may be used to make an optional attribute required.
- !
- none
- Drops the attribute, which is useful when dbexAttributes is set to max-base.
- default: value
- optional default: value
- required default: value
- Sets a default or fixed value for the attribute depending on whether the attribute is optional or required.
- type: name
- type: namelist
- optional type: name
- required type: namelist
- optional type: namelist default: value
- Specifies the type of an attribute. Note: In the future, the type subfield may add identifiers from an extensible hierarchical enumeration of data types for attribute values (including the name and namelist types).
- list: value1 value2 ... valueN
- list: default: value1 value2 ... valueN
- Specifies a list of values for the attribute. An option attribute can designate the first value as a default value.
Where the existing datatype of the attribute doesn't permit the specification of a restriction as a value, the dbexAttributes attribute can be used to specify the restriction. The restriction applies to all attributes of the example element that have a value. An example element can specify restrictions either directly in the attribute values or with the dbexAttributes attribute but not both.
For instance, if the dbexAttributes attribute has a value of required, all attributes with values become required attributes. Similarly, if the dbexAttributes attribute has a value of none, all attributes with values are dropped from the specialized element. (Such dropped attributes must be optional.)
When the default subfield is specified as part of the restriction, the value of the subfield can be omitted. In this case, the value of each attribute is used as a default.
Where a restriction should apply to a single attribute but the example element has multiple required attributes, the dbexAttributes restriction can begin with a name subfield that identifies the restricted attribute. An attribute can be restricted for a specialized element in only one example element, but the same specialized element can be referenced in multiple example elements, each restricting different attributes.
Definition of specialized attributes
Design examples can define new global attributes.
An attribute specialization module has a single dbexBaseAttribute element (specialized from the data element) with a required name attribute, which can identify the specialized attributes as general or selection attributes.
The dbexBaseAttribute element can contain any number of dbexAttribute elements (another specialization of the data element) with the following attributes:
- name
- Specifies the name of the specialized attribute. The name is required.
- datatype
- Specifies the type of the specialized attribute as id, name, namelist, text, or a list subfield specifying the enumerated values (as with attribute restriction). The datatype defaults to text unless specified. Note: In the future, the datatype attribute may add identifiers from an extensible hierarchical enumeration of data types for attribute values (including the name and namelist types).
- value
- Specifies the default value of the specialized attribute.
Example of specialization by example
The following example shows the specialization example for the concept module:
<topic id="conceptExample" dbexName="concept"> <title dbexOccurs="..."/> <body dbexName="conbody"> <p dbexName="$BlockFlow"/> <section dbexName="$Division"/> </body> <related-links dbexOccurs="..."/> </topic>- Login to post comments
- 4801 reads