Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

1 Answer 1

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,

share|improve this answer

Your Answer

 
discard

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.