3.1.3.1. Dialog box allowing to add or modify an entry of the MS-Word style to XML element map

If you want paragraphs or text runs found in the input DOCX file and having a given custom MS-Word style to be converted to a specific XML element, please proceed as follows:

  1. Select an MS-Word style by:

    1. Clicking Character to list custom character (text run) styles and Paragraph to list custom paragraph styles.

    2. Selecting a style from the custom styles combobox.

    It's possible to add to the combobox custom styles coming from other DOCX files by clicking .

    [Note]About the "p-" and "c-" style name prefixes automatically added by w2x

    The name of a paragraph style is automatically given a "p-" or "tp-" prefix and the name of a character style is automatically given a "c-" prefix.

    For example, custom combined paragraph and character MS-Word style called "CodeSnippet" is represented in w2x by paragraph style "p-CodeSnippet" and by character style "c-CodeSnippet".

  2. There is just one way to map a character style to a specific XML element. For example, a text run found in the input DOCX file having a custom style c-FilePath is converted to an DITA element filepath.

    However, there are 4 different ways to map a paragraph style to a specific XML element. Therefore if you have selected a paragraph style, you must now choose a mapping type using the "Paragraph Mapping" combobox.

    Paragraph

    A paragraph found in the input DOCX file and having a custom style, e.g. p-Remark, is converted to an XML element, e.g. DITA draft-comment.

    Paragraph N to1

    Consecutive paragraphs all having the same custom style, e.g. p-Sidebar, are grouped into the same parent XML element, e.g. DITA note type="other" othertype="sidebar".

    Paragraph N to pre

    Consecutive paragraphs all having the same custom style and containing significant whitespace but no forced line breaks (that is, each paragraph typically containing a single line of code), e.g. p-programListing, are converted to text runs and then grouped into the same parent XML element where whitespace and line breaks are preserved, e.g. DITA codeblock.

    Paragraph 1 to pre

    A paragraph having a custom style and containing significant whitespace and forced line breaks (that is, a paragraph typically containing multiple lines of code), e.g. p-KeyboardInput, is converted to an XML element where whitespace and line breaks are preserved, e.g. DITA pre outputclass="keyboard-input".

    [Tip]

    The mapping type of a paragraph style — "Paragraph", "Paragraph N to1", "Paragraph N to pre" or "Paragraph 1 to pre" — is automatically suggested by this dialog box after you select this paragraph style. However the heuristics used to implement the suggestions being rather conservative, the suggestion will be generally "Paragraph".

  3. Type the name of the target element in the "Target XML Element" field.

    This element name must have no namespace prefix. This is possible because the setup assistant assumes that if needed to (e.g. output format is XHTML or DocBook 5.0), a default namespace has been specified in the XSLT stylesheets used to implement the conversion.

    [Caution]

    Carefully choose the target XML element otherwise you may end up with an invalid output file.

    For example, when the type of the mapping is "Paragraph N to1", do not choose DITA cite as a cite element may not have p child elements (DOCX paragraphs are converted to DITA p). Instead choose DITA elements like note or section.

  4. Optionally type up to 3 attribute name/value in the "Optional Attributes" fields.

    The name of an attribute must have no namespace prefix. More precisely, only the standard, predefined, "xml:" prefix is supported here.

  5. Click OK.