Specializing foreign or unknown content

Specializing <foreign> or <unknown> elements is an open extension to the DITA Architecture that allows DITA adopters to incorporate new or existing standard vocabularies for non-textual content, like MathML and SVG, as in-line objects.

Incorporating foreign or unknown content
There are three methods in which a DITA adopter can incorporate foreign content into DITA.
  • Implement <foreign> or <unknown> as a domain specialization.
  • Implement <foreign> or <unknown> as part of a structural specialization.
  • Do nothing; simply embed the foreign content within <foreign> or <unknown>.

Specialization of <foreign> or <unknown> should usually be implemented as a domain, but for those looking for more control over the content can implement foreign vocabulary as part of a structural specialization.

Embedding the content within an unspecialized <foreign> or <unknown> element, because of the ANY content model, offers the least amount of control over the content and hinders interoperability.

Foreign or unknown content and the architectural class attribute

The class attribute is used for a specific purpose in DITA. It identifies the specialization module for the element type as well as the ancestor element types and the specialization modules to which they belong. Every DITA element has to have a class attribute. Since the elements defined within the foreign vocabulary are non-DITA elements, there is no requirement for those elements to have an architectural class attribute. Elements that specialize <foreign> or <unknown>, therefore a DITA element, are required to have a class attribute.

Specializing foreign or unknown content using DTDs.

For more specific information on specializing DTDs, see Modularization in DTDs

<!-- declaration for the specialized wrapper -->
<!ENTITY % svg "svg">

<!-- included SVG document type -->
<!ENTITY % SVG.prefix "svg" >
<!ENTITY % svg-qname.mod
    PUBLIC "-//W3C//ENTITIES SVG 1.1 Qualified Name//EN"
           "svg-qname.mod" >

<!-- definition for the specialized wrapper  -->
<!ELEMENT svg ((%SVG.svg.qname;)>
<!ATTLIST svg %global-atts;
          class CDATA "+ topic/foreign svg-d/svg "
> 
An SVG example within a paragraph element
<p>This is an ellipse.
  <svg>
    <svg:svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<ellipse cx="300" cy="150" rx="200" ry="80"
style="fill:rgb(200,100,50);
stroke:rgb(0,0,100);stroke-width:2"/>

    </svg:svg>    
  </svg>.
</p> 
Specializing foreign content using XML Schemas
For more specific information on specializing XML Schemas, see Modularization in schemas
<!-- importing MathML document type --> 
<xs:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="mathml2.xsd">
 
<!-- definition for the specialized wrapper  -->
<xs:element name="mathML" type="mathML.class" />
<xs:complexType name="mathML.class">
  <xs:choice>
      <xs:element ref="mml:math" />
  </xs:choice>
  <xs:attribute name="outputclass" type="xs:string"/>
    <xs:attributeGroup ref="univ-atts"/>
    <xs:attributeGroup ref="global-atts"/>
    <xs:attribute ref="class" default="+ topic/foreign mathML/mathML"/>
</xs:complexType>

<!-- definition for each element extended by the domain  -->    
<xs:group name="ma-d-foreign">
  <xs:choice>
     <xs:element ref="mathML" />
  </xs:choice>
</xs:group>
  
<!-- definition for the named model groups  -->
<xs:group name="foreign">
   <xs:choice>
     <xs:group ref="foreign"/>
     <xs:group ref="ma-d-foreign"/>
   </xs:choice>
</xs:group>  
An XML Schema MathML specialization example
Use of a specialized <foreign> element with a <object> element using MathML.
<p>... as in the formula 
<object>
  <desc>4 + x</desc>
  <mathML>
    <mml:math display="block">
      <mml:mrow>
        <mml:mo>&sum;</mml:mo>
        <mml:mn>4</mml:mn>
        <mml:mo>+</mml:mo>
        <mml:mi>x</mml:mi>
      </mml:mrow>
    </mml:math>    
  </mathML>
 <object>.
</p> 

Return to main page.

OASIS DITA Architectural Specification v1.1 -- Committee Draft 13 February 2007
Copyright © OASIS Open 2005, 2007. All Rights Reserved.