8

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?

3

1 Answer 1

3

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"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xhtml="http://www.w3.org/1999/xhtml"
   >
   <xsl:output omit-xml-declaration = "yes" method="xml" />


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

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

<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 />
</xsl:template>

</xsl:stylesheet>                                          

Translated as

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .