Version 1.3

2011-07-16 -- Version 1.3 has been released. See the news file for details. Download as usual from the download page or the  OpenSuSE Build Service. A Zero Install feed is also available.

Packages

2010-09-30 -- Packages for your distribution are now available from  the OpenSuSE Build Service.

Version 1.2

2010-08-24 -- Version 1.2 has been released. See the news file for details. Download as usual from the download page.

X11 algorithm

Translations:

XHTML 2 ODT

XHTML2ODT is a converting library from XHTML to  ODT. It is based on XSL stylesheets for portability, and is designed to help web applications export to the ODT document format.

Download the latest source from the download page (or click on the "Download" link in the top menu).

Packages for your distribution are available from the  OpenSuSE Build Service. Covered distributions:

For Zero Install users, a feed is available.


HaasOnline Crypto Trading Bot

Scripts

Included in the sources are the XSL stylesheets and two scripts to demonstrate the library. They are also meant to serve as example of full usage of the stylesheets, should you want to create your own export plugins. One is in PHP and the other is in Python. See also the references further down this page, and the usage examples.

Caveats

The HTML must be well-formed and valid, so I recommand running it through  Tidy before sending it to the stylesheets.

Those stylesheets do not build a whole ODT file, they only convert the XHTML to the equivalent OpenDocument XML. The result can then be inserted in a template ODT file. The input document may contain ODT XML, only the HTML will be converted (the ODT will be left untouched). This is very useful if your application already has a template engine which outputs XHTML, see the Dotclear plugin in the references for details.

Styles : some default styles will be added to the document, but not on the first pass. After converting to ODT, you must run the content.xml and the styles.xml files (in the ODT file) through the xsl/styles.xsl stylesheet to add the missing styles. When the default styles are added, the stylesheet checks that the style is not already present, so customizations to the template ODT file will be preserved. It will however add styles that are not used in the text, but that's harmless.

Images : images are not added, you must manually go trough the draw:image elements in the converted ODT text and use the xlink:href attribute to download or copy the image. While you're at it, you should update the image dimensions if the were not provided in the HTML img tag.

Tests

The unit tests are python-based, you need to install the  nose python module availble from PyPI (or your distribution).

Then, just run "nosetests tests".

References

Get involved

You want to contibute ? That's great ! Report a bug, suggest an enhancement, attach the code if you can, or simply get in touch with me by email : contact(a)xhtml2odt.org.

To create a new ticket on this website, you'll need to have an  OpenID account. If you already have one, you're good to go, just use the "OpenID Login" link at the top right of this page. If you don't, just go to  this page to choose your provider and setup an account. You may already have an OpenID without knowing it.

The source code is hosted  at Gitorious, should you want to check it out.

License

Copyright (C) 2009-2010  Aurelien Bompard.

License is  LGPL v2.1 or later.

Inspired by the  docbook2odt converter, by Roman Fordinal. Many thanks to him.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.