[Mediawiki-l] Script (XSLT) to convert XHTML to wiki

Victor STINNER victor.stinner at haypocalc.com
Tue Aug 16 00:25:50 UTC 2005


Hi,

I wrote a small XSLT style sheet to convert a XHTML document to the wiki
syntax. It supports the following anchors :
 * Text : <p>, <pre>, <br />
      * List : <ul>, <ol>, <li>
      * Title : <h1>, <h2>, <h3>, <h4>
      * Link : <a>
      * Table : <table>, <tr>, <th>, <td>

It take care of spaces: remove them between paragraphs, replace new line
by space, keep spaces in preformated paragraph, etc.

Todo: support <i>, <b>, <em> (small change, I just forgot to add them).

If you would like to use my script, you will need a XSLT processor like
Sablotron (works under Windows and Linux).

My script webpage (currently in french):
http://www.haypocalc.com/wiki/Html2wiki

Download scripts:
http://www.haypocalc.com/perso/prog/html2wiki/

You will also find a small sed script to convert HTML 4 documents to
XHTML document (replace <br> by <br />). But HTML tidy should works
better for this task ;-)

Bye, Haypo





More information about the MediaWiki-l mailing list