2. HDITA support

XMLmind DITA Converter fully supports HDITA, which specifies how to write DITA topics and maps in html5.svg HTML5.

Important
Important
Only XHTML5, that is, the XML syntax of HTML5, is supported. Plain HTML5 is not supported.
In practice, this means that all tags must be closed (e.g. <img/> and not <img>), all attributes must have a quoted value (e.g. controls="" and not controls) and that elements like head and body may not be omitted.
Template of an HDITA topic (lwdita_templates/hdita_topic.html Opens in new window):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="UTF-8"/>
    <title>Topic title here</title>
  </head>
  <body>
    <article id="???">
      <h1>Topic title here</h1>
      <p>Short description here.</p>
      <p>Topic body starts here.</p>
    </article>
  </body>
</html>
Template of an HDITA map (lwdita_templates/hdita_map.html Opens in new window):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="UTF-8"/>
    <title>Map title here</title>
  </head>
  <body>
    <nav>
      <h1>Map title here</h1>
      <ul>
       <li><p><a href="???"></a></p>
         <ul>
           <li><p><a href="???"></a></p></li>
           <li><p><a href="???"></a></p></li>
         </ul>
       </li>
       <li><p><a href="???"></a></p></li>
     </ul>
    </nav>
  </body>
</html>

§ Implementation specificities

  • When the ID of the HDITA topic is not explicitly specified (or specified as "???" like in the above template), the topic is automatically given an ID based on the basename of the file containing it (the file extension is removed and non-NCName characters are replaced by '_'). Examples: id="intro" if the HDITA topic is found in file "intro.html", id="Basic_Concepts" if found in "Basic Concepts.html".
  • Adding attribute data-class="concept" to the top-level article element may be used to generate a DITA concept rather than a DITA topic.
  • An internal link may be specified as <a href="#TARGET_ID"> or <a href="#./TARGET_ID"> or <a href="#TOPIC_ID/TARGET_ID">.
  • A footnote may be represented by <div data-class="fn">, in addition to <span data-class="fn">.
    A footnote reference may be represented by <a href="#FOOTNOTE_ID"></a>.
  • Only the meta elements having the following names are translated to their DITA equivalent (that is, elements contained in the prolog of a DITA topic or the topicmeta of a DITA map):
    • audience
    • author
    • category
    • created or dcterms.created (maps to <critdates>/<created>)
    • keyword (maps to <keywords>/<keyword>)
    • permissions
    • publisher or dcterms.publisher
    • resourceid
    • revised or dcterms.modified (maps to <critdates>/<revised>)
    • source
    A meta element having any other name is translated to DITA element data.
  • While most HTML5 elements are faithfully translated to their DITA equivalent,
    • some elements (br, hr, iframe, script, etc) are simply ignored;
    • some other elements are translated to a DITA ph or div having an outputclass attribute reflecting their HTML5 origin.
      Example 1: element small is translated to DITA <ph outputclass="role-small">.
      Example 2: an h1 element other than the very first one (specifying the title of the topic) is translated to DITA <div outputclass="role-h1">.
      Example 3: nested sections are translated to DITA <div outputclass="role-section">.

§ Limitations

  • Only XHTML5, that is, the XML syntax of HTML5, is supported. Plain HTML5 is not supported.
  • A link to another HDITA topic which is part of the same DITA document must be specified as <a href="TOPIC_PATH#TOPIC_ID/TARGET_ID">. Something like <a href="TOPIC_PATH#TARGET_ID"> or <a href="TOPIC_PATH#./TARGET_ID"> won't work.
  • Using attribute rowspan in td or th elements will generally cause an incorrect DITA table to be generated.