Generating XML conforming to a custom schema

In order to use w2x to convert a DOCX input file to an XML output file conforming to your custom schema, all you have to do is write a custom XSLT 1.0 stylesheet converting the “semantic” XHTML 1.0 Transitional generated by the Edit step to your custom schema.

Let’s call your custom XSLT 1.0 stylesheet “C:\Users\John\foo\xsl\xhtml_to_foo.xsl”. Command-line tool w2x must then be passed the following options:

-c

Execute a Convert step called “convert”.

-e XED_URL_or_file

Execute an Edit step called “edit”.

Example: -e w2x:xed/main.xed. Pass this stock XED script (converting the styled XHTML  1.0 Transitional created by the Convert step to “semantic” XHTML) to the conversion step called “edit”.

-t XSLT_URL_or_file

Execute a Transform step called “transform”.

Example: -t "C:\Users\John\foo\xsl\xhtml_to_foo.xsl".

Pass your custom XSLT 1.0 stylesheet to the conversion step called “transform”.

Stock XED script w2x:xed/main.xed creates a number of semantic XHTML elements having a class attribute starting with “role-“. Examples: <div class=”role-section1”>, <div class=”role-section2”>, <div class=”role-figure”>, <div class=”role-figcaption”>, <a class=”role-footnote-ref”>, <div class=”role-footnote”>, <a class=”role-xref”>, <span class=”role-index-term”>, etc. To learn how to process these elements, the simplest is to look how this is done in a stock XSLT stylesheet such as “w2x_install_dir/xslt/topic.xslt” or “w2x_install_dir/xslt/docbook.xslt”.