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. Specify the type of the mapping using the Type combobox.

    Character

    A text run found in the input DOCX file and having a custom style, e.g. c-FilePath, is converted to an XML element, e.g. DITA filepath.

    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".

  2. Specify the name of a custom MS-Word style[3] in the "MS-Word Style Name" field.

    This name is preferably chosen by clicking it in the list below the "MS-Word Style Name" field. This list contains all the custom MS-Word styles (if any) found in the input DOCX file.

    It's possible to add to the list below the "MS-Word Style Name" field more custom styles coming from other DOCX files. This is done by clicking .

    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".

  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.



[3] It's possible to type the name of a stock MS-Word style, p-Heading1, p-Caption, c-IntenseEmphasis, c-Hyperlink, etc, but in this case, there is no guarantee that you'll get the results you expect.