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:

valueconversion [ S ‘!’ S  conversion ]*
conversionstyle_spec S XHTML_element_name [ S attribute ]*
style_specstyle_name | style_pattern
style_pattern  → ‘/’ pattern ’/’ | ‘^’ pattern ‘$’
attributeattribute_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:

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