Specializing to include non-DITA content

You can extend DITA to incorporate standard vocabularies for non-textual content, such as MathML and SVG, as markup within DITA documents. This is done by specializing the <foreign> element.

There are three methods of incorporating foreign content into DITA.

  • A domain specialization of the <foreign> element. This is the usual implementation.
  • A structural specialization using the <foreign> element. This affords more control over the content model.
  • Directly embedding the non-DITA content within <foreign> element. If the non-DITA content has interoperability or vocabulary naming issues such as those that are addressed by specialization in DITA, they must be addressed by means that are appropriate to the non-DITA content.

Do not use <foreign> element to include textual content or metadata in DITA documents.

Example: Creating an element domain specialization for SVG

This section is non-normative.

The following code sample, which is from the svgDomain.ent file, shows the domain declaration for the SVG domain.

<!-- ============================================================= -->
<!--                   SVG DOMAIN ENTITIES                         -->
<!-- ============================================================= -->

<!-- SVG elements must be prefixed, otherwise they conflict with
     existing DITA elements (e.g., <desc> and <title>.
  -->
<!ENTITY % NS.prefixed "INCLUDE" >
<!ENTITY % SVG.prefix "svg" >

<!ENTITY % svg-d-foreign
   "svg-container
   "
>

Note that the SVG-specific %SVG.prefix; parameter entity is declared. This establishes the default namespace prefix to be used for the SVG content embedded with this domain. The namespace can be overridden in a document-type shell by declaring the parameter entity before the reference to the svgDomain.ent file. Other foreign domains might need similar entities when required by the new vocabulary.

For more information, see the svgDomain.mod file that is shipped with the DITA Technical Content edition. For an example of including the SVG domain in a document-type shell, see task.dtd.