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).

Attribute Description Special values
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.
max-base
Preserve as much base content as possible.

This value is the default when dbexContent isn't specified and the content doesn't include any example elements with specialized names or explicit occurrence.

min-base
Preserve as little base content as possible. If all of the base content is optional and no content is specified, this value results in empty content.

This value is the default when dbexContent isn't specified and the content includes example elements with specialized names or explicit occurrence.

Note: In the future, this attribute may add identifiers from an extensible hierarchical enumeration of data types for textual content.
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.

-
base-occurs
The same occurrence as the corresponding position within the content of the base element for the specialized container element.

This value is the default when dbexOccurs isn't specified on the example element.

?
optional
.
required
*
any
+
some
An explicit occurrence of the position within the specialized container element.
!
none
Where dbexContent specifies max-base, omit the content of the base position within the specialized container element.
...
base-list
Include as many base positions as possible between the preceding and following positions (those with specialized names or explicit occurrence) within the specialized container element.
define
Define specialized elements from the current example element or its contents at any depth for later reference but don't add them to the specialized container element.
#
ignore
Treat the example element and its contents as a comment.

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.

Attribute Description Special values
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.

member-set
Allowed but not required on members of a set defined as a list.

Required for members of a set defined within a container element.

end-set
Terminates a set defined with an explicit list.
append-set
Terminates a set that defined with a list of specialized elements added to the base set for the position. Note: Defining a set by appending specialized elements to a base set is unstable.
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.
-
base-occurs
?
optional
.
required
*
any
+
some
Specifies the occurrence of a set defined as a list within a specialized container element.

The occurrence for a set can be specified only on the last member of the set.

!
none
When appending to a base set, drops the example element from the list of appended elements. Note: Dropping base members from an extended set is unstable.
define-set
Defines a set for later reference from contained example elements at any depth that have a dbexOccurs value of member-set. The dbexSet attribute must be set to a name. Note: Defining sets by containment is unstable.

Restriction of base attributes

Design examples use can restrict attributes within specialized elements.

Attribute Description Special values
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.

max-base
Preserve as many base attributes as possible.

Attributes that aren't dropped explicitly are preserved. Attributes without a restriction are preserved unchanged.

This value is the default when dbexAttributes isn't specified.

min-base
Preserve as few base attributes as possible. If all of the base attributes are optional and no values or restrictions are specified, this value results in an empty attribute list.

Attributes without a value or restriction are dropped implicitly. Attributes with a value and no restriction are preserved unchanged.

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.
define-attribute
Restricts attributes. Note: Restricting attributes by reference or for a set is unstable.

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>
XML.org Focus Areas: BPEL | DITA | ebXML | IDtrust | OpenDocument | SAML | UBL | UDDI
OASIS sites: OASIS | Cover Pages | XML.org | AMQP | CGM Open | eGov | Emergency | IDtrust | LegalXML | Open CSA | OSLC | WS-I