Can DITA tables be adapted for print and digital outputs?
DITA tables can be adapted for both print and digital outputs. This adaptability is a key feature of DITA that allows the same content to be used in various formats, such as PDFs for print and web pages for digital distribution.
Adapting DITA tables for various outputs involves managing content structure, conditional text, styling, and controlling page breaks.
Content Structure
DITA’s structured content approach separates content from its presentation. This means that the content itself remains the same, regardless of the output format.
Conditional Text
Use conditional processing attributes in DITA to include or exclude content based on the output format. For example, certain rows or columns can be specified to appear in print but are hidden in digital formats.
Styling
Define separate CSS styles for print and digital outputs. CSS for print can include page layout and formatting instructions (margins, page size, etc.), while CSS for digital formats can optimize content for screen display.
Page Breaks
Use page break elements (e.g., <pbreak>) in DITA to control where content should break across pages in printed documents. These elements ensure content flows correctly in print formats.
Example:
A DITA table needs to be adapted for both print and digital formats:
<table>
<caption>Product Catalog</caption>
<colgroup>
<col style="width: 33%"></col>
<col style="width: 33%"></col>
<col style="width: 33%"></col>
</colgroup>
<tbody>
<tr>
<th>Product</th>
<th>Description</th>
<th>Price</th>
</tr>
<!-- Additional rows -->
</tbody>
</table>
For print output, proper page breaks and a specific layout should be ensured using CSS.
<style>
@media print {
/* Define styles for print output */
body {
width: 8.5in;
margin: 1in;
}
table {
width: 100%;
}
}
</style>
For digital output, the table can be optimized for screen display with different styles:
<style>
@media screen {
/* Define styles for digital output */
table {
width: 100%;
}
}
</style>
In this example, the same DITA table content remains consistent, but the styles and conditional processing attributes are used to adapt it for print and digital outputs. This approach ensures that the content is optimized for each medium while maintaining content consistency.