= [GenshiRecipes Genshi Recipes]: Transforming HTML documents = While Genshi [wiki:Documentation/xml-templates.html XML templates] need to be valid XML files, that does not mean you can't use Genshi to transform “old-school” HTML documents. Genshi can parse HTML input, and apply ''match templates'' to that input, in order to apply any kind of modification, such as adding site-specific chrome. Let's say you have the following HTML document (maybe produced by some application or component out of your control), and you'd like to integrate it in your site: {{{ #!text/html Aaarrgh

Aaargh

Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.

}}} What you'd like to do is: * Make that valid XHTML, with a proper DOCTYPE to trigger standards rendering mode in browsers. * Use “semantic” tags such as `` and `` instead of the more presentational `` and `` (whether or not that's really a good idea.) * Add a new `