Specialization

DITA Bootstrap provides a DTD specialization, so Bootstrap components can be authored as native DITA elements with specialized attributes instead of @outputclass values.

Specialization is the standard DITA mechanism for defining that an element type or attribute is derived from an ancestor type. Unlike generic XML, DITA formally records the parent-child relationship between element types, so a new element inherits the semantics and the processing behavior of the element it was derived from.

Information architects use specialization to define new kinds of information while maximizing reuse and minimizing maintenance costs. It is appropriate when existing elements cannot express the semantics you need or when the output requires specialized processing.

The @class attribute records each element's ancestry, mapping its current name to its more general equivalents. A processor that does not recognize a specialized element can therefore fall back to the base element it was derived from.

Why use a Bootstrap specialization

Without specialization, a Bootstrap component is authored by adding @outputclass values to generic DITA elements. The DITA Bootstrap DTD instead provides native DITA elements with specialized attributes for Bootstrap styling. The markup describes the component, and the specialization carries the Bootstrap-specific details.

<card color="primary" border="1" rounded="yes">
  <title>Card Title</title>
  <p>Card content goes here.</p>
</card>

Using the DTD

Topics that use the specialized elements must declare the DITA Bootstrap DTD in the document type declaration:

<!DOCTYPE topic PUBLIC 
  "-//DITA Bootstrap//DTD DITA Bootstrap Topic//EN" 
  "bootstrap-topic.dtd">

Bootstrap components

The DTD includes handling for the following Bootstrap components:

Component Elements Extends
Accordions <accordion>, <accordion-item> <bodydiv>, <section>
Alerts <alert> <section>
Badges <badge> <ph>
Buttons <button> <xref>
Button groups <button-group>, <button-toolbar> <bodydiv>
Cards <card>, <card-header>, <card-footer> <section>, <div>
Carousels <carousel>, <carousel-item> <ul>, <li>
Collapse <collapse> <bodydiv>
Icons <icon> <ph>
Grid layout <grid-row>, <grid-col> <bodydiv>
List groups <list-group> <ul>
Offcanvas <offcanvas> <section>
Pagination <pagination> <section>
Popovers <popover> <xref>
Tabs <tabbed-dialog> <bodydiv>
Thumbnails <thumbnail> <image>
Pictures <picture> <div>
Tooltips <tooltip> <xref>

Bootstrap Extension components

The Bootstrap Extension specialization adds elements for Bootstrap Extension features. Topics that use them must declare the extension DTD instead:

<!DOCTYPE topic PUBLIC
  "-//DITA Bootstrap//DTD DITA Bootstrap Extension Topic//EN"
  "bootstrap-ext-topic.dtd">
Component Elements Extends
Counter <counter> <ph>
Parallax <parallax> <section>
Slider <slider> <bodydiv>
Whitebox <whitebox>, <whitebox-item> <ul>, <li>

Colors and borders

Most specializations, and many base DITA elements, support common attributes to control their appearance:

Color themes
Standard Bootstrap themes: primary, secondary, success, danger, warning, info, light and dark.
Border thickness
Numeric values from 1 to 5 control the border width.
Rounded corners
Values such as yes, no, pill or circle.