## Customizing the semantic XML files generated by w2x

### Converting custom character styles to semantic tags

Converting a custom character style to an XHTML element (possibly having specific attributes) is simple and does not require writing a XED script. Suffice for that to pass parameter inlines.convert to the Edit step.

Example 1: convert text spans having a “`Code`” character style to XHTML element `code`:

    -p edit.inlines.convert "c-Code code"

Notice that the name of character style in the generated XHTML+CSS file is always prefixed by “`c-`“.

The syntax for the value of parameter `inlines.convert` is:

    value →  conversion [ S ‘!’ S  conversion ]*
    conversion → style_spec S XHTML_element_name [ S attribute ]*
    style_spec →  style_name | style_pattern
    style_pattern  → ‘/’ pattern ’/’ | ‘^’ pattern ‘$’
    attribute → attribute_name ‘=’ quoted_attribute_value
    quoted_attribute_value →  “’” value “’” | ‘”’ value ‘”’

Example 2: in addition to what’s done in above example 1, convert text spans having a “`Abbrev`” character style to XHTML element `abbr` having a `title=”???”` attribute:

    -p edit.inlines.convert "c-Code code ! c-Abbrev abbr title='???'"

What if the semantic XHTML created by the Edit step is then converted to DITA or DocBook by the means of a Transform step?

In the case of XHTML elements `code` and `abbr`, there is nothing else to do because the stock XSLT stylesheets already support these elements:

- `w2x_install_dir/xslt/topic.xslt` converts XHTML `code` to DITA `codeph` and XHTML `abbr` to DITA `keyword`,
- `w2x_install_dir/xslt/docbook.xslt` converts XHTML `code` to DocBook `code` and XHTML `abbr` to DocBook `abbrev`.

The general case which also requires using custom XSLT stylesheets is explained in section The general case.