22.8 Importing HTML files as insets

To include existing HTML code as an inset, by importing HTML from a source other than the DITA files you are converting, use a DITA HTML Macro PI marker. The content of the marker should look like this:

<?dthtm HTML Macro="<$.\\filename.htm>" ?>

where filename.htm is the name of the HTML file you want to import. Place the marker in your DITA document wherever you want the imported HTML to appear in your DITA2Go output.

If the HTML you are importing is not a fragment, but a complete HTML file with both <head> and <body> sections, to omit all but the <body> part use a DITA2Go macro expression (see §37.6 Using expressions in macros) in the content of the HTML Macro marker. Code such as the following would select all text between <body> and </body> from filename.htm:

<?dthtm HTML Macro='<$(($.\\filename.htm after "<body>") before "</body>")>' ?>

The single dot after the second $ indicates that the file you are importing is in the current directory; if it is in some other directory, use a full path name.

Note:  You must use the two-backslash form of separator: backslash (\) instead of a forward slash (/) so that the DITA2Go expression evaluator does not take it as a division operator; and two of them, the first to escape the second backslash in the PI marker.

Previous Topic:  22.7.2 Using Web-safe colors

Next Topic:  22.9 Providing hover text for links in HTML

Parent Topic:  22. Converting to HTML/XHTML

Sibling Topics:

22.1 Deciding which type of output to produce

22.2 Setting up an HTML project

22.3 Including starting code and entity references

22.4 Supplying values for the <head> element

22.5 Specifying HTML <body> attributes

22.6 Specifying document-wide properties for HTML

22.7 Defining text colors for HTML

22.9 Providing hover text for links in HTML

22.10 Generating XHTML for Confluence 4.x

22.11 Exporting content for database input

22.12 Specifying a starting topic for HTML or XHTML

22.13 Using framesets

22.14 Passing W3C validation tests