Creating XHTML content with OpenOffice.org and Writer2xhtml

The default behavior of Writer2xhtml is to export content and formatting. Alternatively you can export content only; this can be controlled with a configuration file. The configuration file cleanxhtml.xml uses some built-in text- and paragraph styles in OpenOffice.org to create well-structured XHTML documents, using most of the semantic tags offered by XHTML.

Paragraph styles

For your paragraphs, the style Text body is used for ordinary paragraphs: <p>...</p>.

The style Sender is used to produce <address>...</address>.

The style Quotations is used to produce blockquotes.

Several paragraphs with this style are collected to a single blockquote: <blockquote><p>...</p><p>...</p></blockquote>.

The style preformatted text is used to produce <pre>...</pre>.

The style Horizontal line is used to produce <hr>.

Other paragraph styles

If you format paragraphs with other styles, they will be exported as ordinary paragraphs (<p>) with a class attribute. For example this paragraph has style My Own Style, which will be exported as <p class=”MyOwnStyle”>...</p>.

Definition lists

OpenOffice.org does not support definition lists directly. Instead you can use two paragraph styles:

Any sequence of these are wrapped in a single <dl>...</dl>, like this:

This is a term.
This is the definition of the term.
This is another term.
This is the definition of the other term.

Text styles

A number of text styles maps to XHTML elements as well: Use the text styles CitationDefinitionEmphasisExampleSource TextStrong EmphasisTeletype – User entry – Variable to produce <cite>, <dfn>, <em>, <samp>, <code>, <strong>, <tt>, <kbd>, <var>.

Hard character formatting

If you export content only, hard character formatting is ignored in general. An exception to this rule is bold, italics, superscript, subscript and fixed pitch fonts, which are exported to <b>, <i>, <sup>, <sub> and <tt> respectively.