TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using tex4ht, a formatted html file is obtained. It uses a css file and multiple classes such as

<span class="ec-lmbx-10x-x-109">toto</span>

However, when using a Content Management System (CMS) such as Joomla, such formatting classes are not desired since all the formatting is handled by the CMS. A clean html file is preferred with html tags such as < H3>, < H4>, ... but without formatting classes for each tag.

Is it possible to obtain, with tex4ht, such a clean html file with no formatting classes but only with formatting html tags?

share|improve this question
see tex.stackexchange.com/q/70059/2891 – michal.h21 Dec 28 '12 at 17:48
This reference has partly answered the question. However, I did not figure out how to eliminate the classes of < H3> and < H4> tags. – rasha Jan 1 '13 at 23:10

Edit: How to produce as clean output from tex4ht as possible is described in another answer. This answer is about further cleaning of the output.

Some things are rather difficult to modify in tex4ht. Easier is sometimes to use xslt styles to modify the output.

This fragment:

<h3 class="sectionHead"><span class="titlemark">1</span> <a 
 id="x1-10001"></a>hello world</h3>

Can be with this style

<xsl:stylesheet version="1.0"
   <xsl:output omit-xml-declaration = "yes" method="xml" />

<xsl:template match="@*|node()">
    <xsl:apply-templates select="@*|node()"/>

<xsl:template match="xhtml:h3|xhtml:h4|xhtml:h5">
<xsl:attribute name="id"><xsl:value-of select="xhtml:a/@id" /></xsl:attribute>
  <xsl:apply-templates />

<xsl:template match="xhtml:h3/xhtml:a|xhtml:h4/xhtml:a|xhtml:h5/xhtml:a" />
<xsl:template match="xhtml:h3/xhtml:span|xhtml:h4/xhtml:span|xhtml:h5/xhtml:span">
<xsl:apply-templates />


Translated as

<h3 id="x1-10001">1 hello world</h3>

I used id parameter so one can easily make link to the section,

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.